org.geotools.graph.structure.basic
Class BasicGraphable

java.lang.Object
  extended byorg.geotools.graph.structure.basic.BasicGraphable
All Implemented Interfaces:
Graphable, java.io.Serializable
Direct Known Subclasses:
BasicDirectedEdge, BasicDirectedNode, BasicEdge, BasicNode

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

Basic implementation of Graphable. This class serves as the root in the hierarchy of basic graph components.

Components in the basic hierarchy implement the Serializable interface. However serialization will fail if a Graphable object contains a reference to a non serializable object.

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

Constructor Summary
BasicGraphable()
          Constrcuts a new a graph component.
 
Method Summary
 int getCount()
          Returns the value of the counter for the component.
 int getID()
          Returns an identifier for the component.
 java.lang.Object getObject()
          Returns the underlying object referenced by the graph component.
 boolean isVisited()
          Determines if the component has been marked as visited.
 void setCount(int count)
          Sets the value of the counter for the component.
 void setID(int id)
          Sets the identifying integer for the component.
 void setObject(java.lang.Object obj)
          Sets the underlying object reference for the component.
 void setVisited(boolean visited)
          Marks the component as being visited/unvisited.
 java.lang.String toString()
          Returns the id of the component as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.geotools.graph.structure.Graphable
getRelated
 

Constructor Detail

BasicGraphable

public BasicGraphable()
Constrcuts a new a graph component. Sets the visited flag to false, counter to -1, and generates a new id.

Method Detail

getID

public int getID()
Description copied from interface: Graphable
Returns an identifier for the component. This number is not necessarily persistent or unique.

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

setID

public void setID(int id)
Description copied from interface: Graphable
Sets the identifying integer for the component.

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

getObject

public java.lang.Object getObject()
Description copied from interface: Graphable
Returns the underlying object referenced by the graph component.

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

setObject

public void setObject(java.lang.Object obj)
Description copied from interface: Graphable
Sets the underlying object reference for the component.

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

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()

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)

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()

setCount

public void setCount(int count)
Description copied from interface: Graphable
Sets 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:
setCount in interface Graphable
Parameters:
count - The new value of the counter for the component.
See Also:
Graphable.setCount(int)

toString

public java.lang.String toString()
Returns the id of the component as a string.

See Also:
Graphable.getID()


Copyright © GeoTools. All Rights Reserved.