Skip to Main Content
It looks like you're using Internet Explorer 11 or older. This website works best with modern browsers such as the latest versions of Chrome, Firefox, Safari, and Edge. If you continue with this browser, you may see unexpected results.

Examples A-D

Example reference formats for different source types

Referencing within Code [For Computing Students] examples

The structure of a typical class/source file should contain:

• Header

• Disclaimer/copyright

• References

• Code

Header

A typical header would normally include a few important headings as follows:

/**

Program: Java Graphics Screen Application

Filename: GraphicsJFrame.java

@author: © Gary Hill 

Course: BSc Computing

Module: Graphics Programming

Tutor: Gary Hill

@version: 1.1

Notes 1.1 Added centreWindow method

Date: 28/10/11

*/

Disclaimer/ Copyright

A typical disclaimer/copyright section may be considered good practice that confirms that the student is claiming that the code is the work of the student unless otherwise stated. One suggestion is as follows:

/*

File: GraphicsJFrame.java

Disclaimer: The following source code is the sole work of the author unless otherwise stated.

Copyright (C) Gary Hill. All Rights Reserved.

*/

Class Library/SDK Referencing

There would need to be a reference to the standard SDK used for the source file, but any used beyond those expected would clearly need to be identified:

//<-*****jfreechart (2012) [2] - START

import org.jfree.chart.ChartFactory;

import org.jfree.data.time.TimeSeriesCollection;

import org.jfree.data.xy.XYDataset;

import org.jfree.ui.RefineryUtilities;

//->***** jfreechart (2012) [2] – END

Method Referencing

As methods are self-contained, it is suggested that the reference is given at the start of the method block as follows:

//<-***** Hill (2012) [1] - START

public void centreWindow()

{//Center the window

Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

Dimension frameSize = getSize();

…………..

}

//>-*****Hill(2012) [1] - END

Referencing within Methods/Classes

Methods are self-contained, but for referencing of code within a block of code it is suggested that the reference is given at the start and end of the code section for clarity as follows:

//<-***** Hill(2012) [1] - START

Transform3D temp = new Transform3D();

viewObjectFromGroup.getTransform(temp);

Transform3D tempDelta = new Transform3D();

tempDelta.setTranslation(new Vector3f(0.0f, 0.0f, -1.0f));

temp.mul(tempDelta);

System.out.println(temp);

float matrix[] = new float[16]; //declare array of 16 floats for matrix

temp.get(matrix);

if (matrix[11] <= 1.0) //object front face z = 1

{

System.out.println("Don't multiply Transform3D at: "+matrix[11]);

}

else //setTransform

{

viewObjectFromGroup.setTransform(temp);

}

//>-*****Hill(2012) [1] - END