Class BasicGraphable
Object
BasicGraphable
- All Implemented Interfaces:
Serializable
,Graphable
- Direct Known Subclasses:
BasicDirectedEdge
,BasicDirectedNode
,BasicEdge
,BasicNode
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.
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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
getCount()
Returns the value of the counter for the component.int
getID()
Returns an identifier for the component.Returns the underlying object referenced by the graph component.boolean
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
Sets the underlying object reference for the component.void
setVisited
(boolean visited) Marks the component as being visited/unvisited.toString()
Returns the id of the component as a string.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface Graphable
getRelated
-
Constructor Details
-
BasicGraphable
public BasicGraphable()Constructs a new a graph component. Sets the visited flag to false, counter to -1, and generates a new id.
-
-
Method Details
-
getID
public int getID()Description copied from interface:Graphable
Returns an identifier for the component. This number is not necessarily persistent or unique. -
setID
public void setID(int id) Description copied from interface:Graphable
Sets the identifying integer for the component. -
getObject
Description copied from interface:Graphable
Returns the underlying object referenced by the graph component. -
setObject
Description copied from interface:Graphable
Sets the underlying object reference for the component. -
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. -
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 interfaceGraphable
- Parameters:
visited
- True if visited(on), false if unvisited(off).- See Also:
-
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. -
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. -
toString
Returns the id of the component as a string.
-