org.geotools.graph.structure.opt
Class OptGraphable

java.lang.Object
  extended byorg.geotools.graph.structure.opt.OptGraphable
All Implemented Interfaces:
Graphable, java.io.Serializable
Direct Known Subclasses:
OptDirectedEdge, OptDirectedNode, OptEdge, OptNode

public abstract class OptGraphable
extends java.lang.Object
implements Graphable, java.io.Serializable

Root of class hierarchy for optimized implementation of graph components. The optimizations reduce the space taken up by graph components:

Objects in the optimized hierarchy implement the Serializable interface.

Author:
Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
See Also:
Graphable, Serialized Form

Constructor Summary
OptGraphable()
          Constructs a new optimized graphable object.
 
Method Summary
 int getCount()
          Returns the value of the counter for the component.
 int getID()
          Returns 0.
 java.lang.Object getObject()
          Returns null.
 boolean isVisited()
          Determines if the component has been marked as visited.
 void setCount(int count)
          To minimize space, the counter is stored as a byte.
 void setID(int id)
          Does nothing.
 void setObject(java.lang.Object obj)
          Does nothing.
 void setVisited(boolean visited)
          Marks the component as being visited/unvisited.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.geotools.graph.structure.Graphable
getRelated
 

Constructor Detail

OptGraphable

public OptGraphable()
Constructs a new optimized graphable object. Visited flag it set to false and counter set to -1.

Method Detail

setID

public void setID(int id)
Does nothing.

Specified by:
setID in interface Graphable
Parameters:
id - New identifying integer.
See Also:
Graphable.setID(int)

getID

public int getID()
Returns 0.

Specified by:
getID in interface Graphable
Returns:
Identifying integer.
See Also:
Graphable.getID()

setVisited

public void setVisited(boolean visited)
Description copied from interface: Graphable
Marks the component as being visited/unvisited. The visited flag serves as a binary switch for the component which can be used for graph queries, graph traversals, or user defined purposes.

Specified by:
setVisited in interface Graphable
Parameters:
visited - True if visited(on), false if unvisited(off).
See Also:
Graphable.setVisited(boolean)

isVisited

public boolean isVisited()
Description copied from interface: Graphable
Determines if the component has been marked as visited. The visited flag serves as a binary switch for the component which can be used for graph queries, graph traversals, or user defined purposes.

Specified by:
isVisited in interface Graphable
Returns:
True if visited(on), false if unvisited(off).
See Also:
Graphable.isVisited()

setCount

public void setCount(int count)
To minimize space, the counter is stored as a byte. Therefore the counter can take on values from -128 to 127.

Specified by:
setCount in interface Graphable
Parameters:
count - The new value of the counter for the component.
See Also:
Graphable.setCount(int)

getCount

public int getCount()
Description copied from interface: Graphable
Returns the value of the counter for the component. Graph components have a counter associated with them to be used for graph queries, graph traversals, or user defined purposes.

Specified by:
getCount in interface Graphable
Returns:
int The value of the counter for the component.
See Also:
Graphable.getCount()

setObject

public void setObject(java.lang.Object obj)
Does nothing.

Specified by:
setObject in interface Graphable
Parameters:
obj - The entity being modelled by the graph component.
See Also:
Graphable.setObject(Object)

getObject

public java.lang.Object getObject()
Returns null.

Specified by:
getObject in interface Graphable
Returns:
Underlying object reference, the entity being modelled by graph component.
See Also:
Graphable.getObject()


Copyright © GeoTools. All Rights Reserved.