uk.ed.inf.graph.colour
Interface INodeColourHandler<N extends IBasicNode<N,? extends IBasicEdge<N,?>>,E extends IBasicEdge<N,E>>

Type Parameters:
N - the graph node, which must implement the interface IBasicNode.
E - the graph edge, which must implement the interface IBasicEdge.

public interface INodeColourHandler<N extends IBasicNode<N,? extends IBasicEdge<N,?>>,E extends IBasicEdge<N,E>>

Implementers of this interface will provide a handler class for an object that provides the colour to a node. The colour being one or more properties that are associated with the graph node. The handler facilitates the storage of the colour and can be copied and perform the copying of the colour object itself. The handler is required because a colour can be of any type and each node in a graph can potentially have a different colour type. Implementers of this interface provides a mechanism handle diverse colour object types. Another important issue handles here is the copy of a nodes colour when the node is copied. Depending of the usage of the graph or node, the colour value may or may not be copied. The decision to copy can be application dependent and so the supplier of the implementation of this interface can use the copyObject(newNode) method to control this behaviour. The newNode parameter provides the method with information about the node to be copied to and as a consequence the graph it belongs to and it;s topology. Any of these may be important in deciding if or how to copy the colour value.

Author:
smoodie

Method Summary
 java.lang.Object copyColour(N newNode)
          Copy the colour object.
 INodeColourHandler<N,E> createCopy()
          Create a copy of this colour handler.
 java.lang.Object getColour()
          Get the colour value.
 N getNode()
          Gets the node that ones this colour handler.
 void setColour(java.lang.Object colour)
          Set the colour value.
 void setNode(N node)
          Sets the node that will own this handler and the associated colour value.
 

Method Detail

setColour

void setColour(java.lang.Object colour)
Set the colour value.

Parameters:
colour - The colour value to set.

getColour

java.lang.Object getColour()
Get the colour value.

Returns:
the colour instance.

createCopy

INodeColourHandler<N,E> createCopy()
Create a copy of this colour handler. This should not copy the object value, which should be left as null or the default value.

Returns:
a new instance of the copy handler.

copyColour

java.lang.Object copyColour(N newNode)
Copy the colour object. The new node to copied to is provided to enable the copy method to decide how to copy the object based on the newNode. For example if the newNode belongs to another Graph then the a deep copy of the object may be performed.

Parameters:
newNode - The new node the colour will be copied to.
Returns:
The copied object.

setNode

void setNode(N node)
Sets the node that will own this handler and the associated colour value.

Parameters:
node - The node that will own this instance. Can be null.

getNode

N getNode()
Gets the node that ones this colour handler.

Returns:
the owning node. Can be null.