Package net.ggtools.grand.graph
Interface Node
-
- All Superinterfaces:
GraphObject
- All Known Implementing Classes:
AntTargetNode
,NodeImpl
public interface Node extends GraphObject
Interface implemented by nodes populating the graph.- Author:
- Christophe Labouisse
-
-
Field Summary
Fields Modifier and Type Field Description static int
ATTR_CONDITIONAL_NODE
Attribute bit to be set on conditional nodes.static int
ATTR_MAIN_NODE
Attribute bit to be set on main nodes.static int
ATTR_MISSING_NODE
Attribute bit to be set on missing nodes, that is nodes created by the graph producer even if no such node exists in the original data source.static int
ATTR_PREFIXED_NODE
Attribute bit to be set on the prefixed node(s).static int
ATTR_START_NODE
Attribute bit to be set on the start node(s).-
Fields inherited from interface net.ggtools.grand.graph.GraphObject
ATTR_ALL, ATTR_NONE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.Collection<Link>
getBackLinks()
Returns links coming to the node.String
getDescription()
Returns a short description (one line of less) of the node.Collection<Link>
getLinks()
Returns links originating from the node.String
getSource()
Returns the source snippet for the node.void
removeBackLink(Link link)
Remove a link from the node.void
removeLink(Link link)
Remove a link from the node.void
setDescription(String description)
Sets the node's description.-
Methods inherited from interface net.ggtools.grand.graph.GraphObject
clearAttributes, getAttributes, getGraph, getName, hasAttributes, setAttributes
-
-
-
-
Field Detail
-
ATTR_MAIN_NODE
static final int ATTR_MAIN_NODE
Attribute bit to be set on main nodes. The definition of a main node depends on the graph's source. For Ant, a main node will be a target with a description attribute.- See Also:
- Constant Field Values
-
ATTR_MISSING_NODE
static final int ATTR_MISSING_NODE
Attribute bit to be set on missing nodes, that is nodes created by the graph producer even if no such node exists in the original data source. The cause of such creations depends on the graph's source. For Ant projects, missing nodes may be created when a target (or an antcall) refers a non existing node.- See Also:
- Constant Field Values
-
ATTR_CONDITIONAL_NODE
static final int ATTR_CONDITIONAL_NODE
Attribute bit to be set on conditional nodes. A node is conditional if the whole content's execution is subject to a condition like Ant targets with aif
orunless
attribute set.- See Also:
- Constant Field Values
-
ATTR_START_NODE
static final int ATTR_START_NODE
Attribute bit to be set on the start node(s). The definition of a start node depends of the graph's source. For Ant, the start node is the default target.- See Also:
- Constant Field Values
-
ATTR_PREFIXED_NODE
static final int ATTR_PREFIXED_NODE
Attribute bit to be set on the prefixed node(s). A node is prefixed if there exists a node with a shorter name corresponding to a target with the same location. Ant creates these forimport
ed project files.- See Also:
- Constant Field Values
-
-
Method Detail
-
getLinks
Collection<Link> getLinks()
Returns links originating from the node. The implementing class should ensure that the returned list only contains objects implementing the Link interface. The returned collection should allow modification operations.- Returns:
- list of links.
-
getBackLinks
Collection<Link> getBackLinks()
Returns links coming to the node. The implementing class should ensure that the returned list only contains objects implementing the Link interface. The returned collection should allow modification operations.- Returns:
- list of links.
-
addLink
void addLink(Link link)
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.- Parameters:
link
- link to add
-
addBackLink
void addBackLink(Link link)
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.- Parameters:
link
- link to add
-
removeLink
void removeLink(Link link)
Remove a link from the node. This method should be called when the link starts from the node.- Parameters:
link
- link to remove
-
removeBackLink
void removeBackLink(Link link)
Remove a link from the node. This method should be called when the link ends at the node.- Parameters:
link
- link to remove
-
getDescription
String getDescription()
Returns a short description (one line of less) of the node.- Returns:
- description.
-
setDescription
void setDescription(String description)
Sets the node's description.- Parameters:
description
- node's description
-
accept
void accept(NodeVisitor visitor)
Accepts a visitor. The implementation should call the appropriatevisitNode
method of the visitor.- Parameters:
visitor
- NodeVisitor
-
getSource
String getSource()
Returns the source snippet for the node. Implementations may returnnull
if no source is available or if the source concept is not relevant.- Returns:
- The source snippet for the node or
null
;
-
-