public class GraphNode extends Data
Modifier and Type | Field and Description |
---|---|
static int |
BLACK_COLOR |
static int |
GRAY_COLOR |
private Bag |
mBag
A Bag of objects that maybe associated with the node.
|
private java.util.Set<GraphNode> |
mChildren
The list of children of the job/node in the abstract graph.
|
private int |
mColor
The color the node is colored.
|
private GraphNodeContent |
mContent
The content associated with this node.
|
private int |
mDepth
The depth of the node from the root or any arbitary node.
|
private java.lang.String |
mLogicalID
The logical id of the job as identified in the dax.
|
private java.lang.String |
mLogicalName
The logical name of the node as identified in the dax.
|
private java.util.Set<GraphNode> |
mParents
The list of parents of the job/node in the abstract graph.
|
static int |
WHITE_COLOR |
Constructor and Description |
---|
GraphNode()
The default constructor.
|
GraphNode(java.lang.String id)
The overloaded constructor.
|
GraphNode(java.lang.String id,
GraphNodeContent content)
The overloaded constructor.
|
GraphNode(java.lang.String id,
java.lang.String name)
The overloaded constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(GraphNode child)
Adds a child to end of the child list.
|
void |
addParent(GraphNode parent)
Adds a parent to end of the parent list.
|
boolean |
childrenColored(int color)
Returns if all the children of the node have the color that is specified.
|
java.lang.String |
childrenToString()
A convenience methods that generates a comma separated list of children
as String
|
java.lang.Object |
clone()
Returns a copy of the object.
|
boolean |
equals(java.lang.Object obj)
Matches two GraphNode objects.
|
Bag |
getBag()
Returns the bag of objects associated with the node.
|
java.util.Collection<GraphNode> |
getChildren()
Returns a list of
GraphNode objects that are children of the
node. |
GraphNodeContent |
getContent()
Returns the content associated with the node.
|
int |
getDepth()
Returns the depth of the node in the graph.
|
java.lang.String |
getID()
Returns the logical id of the graph node.
|
java.lang.String |
getName()
Returns the logical name of the graph node.
|
java.util.Collection<GraphNode> |
getParents()
Returns a list of
GraphNode objects that are parents of the node. |
int |
hashCode()
Calculate a hash code value for the object to support hash based Collections.
|
boolean |
isColor(int color)
Returns if the color of the node is as specified.
|
boolean |
parentsColored(int color)
Returns if all the parents of that node have the color that is specified.
|
java.lang.String |
parentsToString()
A convenience methods that generates a comma separated list of parents
as String
|
void |
removeChild(GraphNode child)
Removes a child linkage to the node.
|
void |
removeParent(GraphNode parent)
Removes a parent linkage to the node.
|
void |
resetEdges()
Reset all the edges associated with this node.
|
void |
setBag(Bag bag)
Sets the bag of objects associated with the node.
|
void |
setChildren(java.util.Collection<GraphNode> children)
It sets the children to the node.
|
void |
setColor(int color)
Sets the color of the node to the color specified
|
void |
setContent(GraphNodeContent content)
Sets the content associated with the node.
|
void |
setDepth(int depth)
Sets the depth associated with the node.
|
void |
setParents(java.util.Collection<GraphNode> parents)
It adds the parents to the node.
|
java.lang.String |
toString()
The textual representation of the graph node.
|
setToString, vectorToString
public static final int WHITE_COLOR
public static final int GRAY_COLOR
public static final int BLACK_COLOR
private java.lang.String mLogicalID
private java.lang.String mLogicalName
private int mDepth
private int mColor
private java.util.Set<GraphNode> mParents
GraphNode
object.private java.util.Set<GraphNode> mChildren
GraphNode
object.private GraphNodeContent mContent
public GraphNode()
public GraphNode(java.lang.String id)
id
- the id of the node in the graph.public GraphNode(java.lang.String id, GraphNodeContent content)
id
- the id of the node in the graph.content
- the content to be associated with the node.public GraphNode(java.lang.String id, java.lang.String name)
id
- the logical id of the node.name
- the name of the node.public void setBag(Bag bag)
bag
- the Bag
to be associated with the node.public void setContent(GraphNodeContent content)
content
- the GraphNodeContent
to be associated with the node.public void setParents(java.util.Collection<GraphNode> parents)
parents
- public void setChildren(java.util.Collection<GraphNode> children)
children
- public void setDepth(int depth)
depth
- public Bag getBag()
public GraphNodeContent getContent()
public java.util.Collection<GraphNode> getParents()
GraphNode
objects that are parents of the node.GraphNode
objects.public java.util.Collection<GraphNode> getChildren()
GraphNode
objects that are children of the
node.GraphNode
objects.public void addChild(GraphNode child)
child
- adds a child to the node.public void addParent(GraphNode parent)
parent
- adds a parent to the node.public void removeChild(GraphNode child)
child
- child to be removed.public void removeParent(GraphNode parent)
parent
- parent to be removed.public final void resetEdges()
public java.lang.String getID()
public java.lang.String getName()
public int getDepth()
public boolean isColor(int color)
color
- color that node should be.public void setColor(int color)
color
- color that node should be.public boolean parentsColored(int color)
color
- the color of the node.public boolean childrenColored(int color)
color
- the color of the node.public java.lang.String parentsToString()
public java.lang.String childrenToString()
public java.lang.String toString()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the reference object with which to compare.public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Object clone()
clone
in class java.lang.Object