net.ggtools.grand.graph
Class NodeImpl

java.lang.Object
  extended by net.ggtools.grand.graph.AttributeManager
      extended by net.ggtools.grand.graph.NodeImpl
All Implemented Interfaces:
GraphObject, Node
Direct Known Subclasses:
AntTargetNode

public class NodeImpl
extends AttributeManager
implements Node

Author:
Christophe Labouisse

Field Summary
 
Fields inherited from interface net.ggtools.grand.graph.Node
ATTR_CONDITIONAL_NODE, ATTR_MAIN_NODE, ATTR_MISSING_NODE, ATTR_START_NODE
 
Fields inherited from interface net.ggtools.grand.graph.GraphObject
ATTR_ALL, ATTR_NONE
 
Constructor Summary
NodeImpl(java.lang.String name, Graph graph)
          Creates an new NodeImpl.
 
Method Summary
 void accept(NodeVisitor visitor)
          Accepts a visitor.
 void addBackLink(Link link)
          Add a link to the node.
 void addLink(Link link)
          Add a link to the node.
 boolean equals(java.lang.Object obj)
          Returns true of the current object and obj are equals.
 java.util.Collection getBackLinks()
          Returns links coming to the node.
 java.lang.String getDescription()
          Returns a short description (one line of less) of the node.
 Graph getGraph()
          Gets the owner graph of the object.
 java.util.Collection getLinks()
          Returns links originating from the node.
 java.lang.String getName()
          Gets the object's name.
 java.lang.String getSource()
          Returns the source snippet for the node.
 int hashCode()
          Compute a hash code for the current node.
 void removeBackLink(Link link)
          Remove a link from the node.
 void removeLink(Link link)
          Remove a link from the node.
 void setDescription(java.lang.String desc)
          Sets the node's description.
 void setSource(java.lang.String newSource)
          Sets the source snippet for the node.
 java.lang.String toString()
           
 
Methods inherited from class net.ggtools.grand.graph.AttributeManager
clearAttributes, getAttributes, hasAttributes, setAttributes
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.ggtools.grand.graph.GraphObject
clearAttributes, getAttributes, hasAttributes, setAttributes
 

Constructor Detail

NodeImpl

public NodeImpl(java.lang.String name,
                Graph graph)
Creates an new NodeImpl.

Parameters:
name - node's name
graph - owner graph.
Method Detail

equals

public boolean equals(java.lang.Object obj)
Returns true of the current object and obj are equals. Two Nodes are equals when they belong to the same graph and they have the same name.

Overrides:
equals in class java.lang.Object
Parameters:
obj - object to compare the node to.
Returns:
true if this is equal to obj.
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Compute a hash code for the current node. A Node's hash will be his name's hashcode.

Overrides:
hashCode in class java.lang.Object
Returns:
hash code for the current node.
See Also:
Object.hashCode()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getLinks

public java.util.Collection getLinks()
Description copied from interface: Node
Returns links originating from the node. The implementing class should insure that the returned list only contains objects implementing the Link interface. The returned collection should allow modification operations.

Specified by:
getLinks in interface Node
Returns:
list of links.

getBackLinks

public java.util.Collection getBackLinks()
Description copied from interface: Node
Returns links coming to the node. The implementing class should insure that the returned list only contains objects implementing the Link interface. The returned collection should allow modification operations.

Specified by:
getBackLinks in interface Node
Returns:
list of links.

getDescription

public java.lang.String getDescription()
Description copied from interface: Node
Returns a short description (one line of less) of the node.

Specified by:
getDescription in interface Node
Returns:
description.

setDescription

public void setDescription(java.lang.String desc)
Description copied from interface: Node
Sets the node's description.

Specified by:
setDescription in interface Node
Parameters:
desc - node's description

getGraph

public Graph getGraph()
Description copied from interface: GraphObject
Gets the owner graph of the object.

Specified by:
getGraph in interface GraphObject
Returns:
the owning graph.

getName

public java.lang.String getName()
Description copied from interface: GraphObject
Gets the object's name.

Specified by:
getName in interface GraphObject
Returns:
object's name.

addLink

public void addLink(Link link)
Description copied from interface: Node
Add a link to the node. This method should be called when the link starts from the node. The implementations should try to preserve the order in which the nodes were added.

Specified by:
addLink in interface Node
Parameters:
link - link to add

addBackLink

public void addBackLink(Link link)
Description copied from interface: Node
Add a link to the node. This method should be called when the link ends at the node. The implementations should try to preserve the order in which the nodes were added.

Specified by:
addBackLink in interface Node
Parameters:
link - link to add

removeLink

public void removeLink(Link link)
Description copied from interface: Node
Remove a link from the node. This method should be called when the link starts from the node.

Specified by:
removeLink in interface Node
Parameters:
link - link to remove

removeBackLink

public void removeBackLink(Link link)
Description copied from interface: Node
Remove a link from the node. This method should be called when the link ends at the node.

Specified by:
removeBackLink in interface Node
Parameters:
link - link to remove

accept

public void accept(NodeVisitor visitor)
Description copied from interface: Node
Accepts a visitor. The implementation should call the appropriate visitNode method of the visitor.

Specified by:
accept in interface Node

getSource

public java.lang.String getSource()
Description copied from interface: Node
Returns the source snippet for the node. Implementations may return null if no source is available or if the source concept is not relevant.

Specified by:
getSource in interface Node
Returns:
The source snippet for the node or null;

setSource

public void setSource(java.lang.String newSource)
Sets the source snippet for the node.

Parameters:
newSource -


Copyright © 2004-2005 ggTools. All Rights Reserved.