public class Partition extends Data
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
mID
The partition id of the partition.
|
private int |
mIndex
The index associated with the partition.
|
private GraphNode |
mLastAddedNode
A pointer to the last added node to the partition.
|
private java.lang.String |
mName
The name of the partition.
|
private java.util.List |
mNodeList
The list of
GraphNode |
private java.util.Set |
mNodeSet
The set of node id's in the partition.
|
private java.util.Map |
mParentsMap
A map containing a node and it's parents ids in the partition.
|
Constructor and Description |
---|
Partition()
The default constructor.
|
Partition(java.util.List nodeList,
java.lang.String id)
The overloaded constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addNode(GraphNode node)
Adds a node to the partition.
|
void |
addParents(java.lang.String node,
java.util.List parents)
Ends up assigning the parents to a particular node.
|
java.lang.Object |
clone()
Returns a copy of the object
|
void |
constructPartition()
It while looking at the node list constructs the relations between
the jobs in the partition, that can be gotten through
getRelationsInPartition().
|
java.lang.String |
getID()
It returns the unique id that is associated with the partition.
|
int |
getIndex()
It returns the index to number of the partition.
|
java.lang.String |
getName()
It returns the name of the partition.
|
java.util.Set |
getNodeIDs()
It returns the set of the job ids making up the partition.
|
java.util.List<GraphNode> |
getNodes()
Returns a list of nodes making up the partition.
|
java.util.List<java.lang.String> |
getParents(java.lang.String id)
Returns a list of id's of parents for a node in the partition.
|
java.util.Map |
getRelations()
A function to return the child-parent relations for the jobs making up the
partition.
|
java.util.List |
getRootNodes()
Returns the root nodes in the partition.
|
GraphNode |
lastAddedNode()
Returns the last added node to the partition.
|
void |
setID(java.lang.String id)
It sets the id of the partition.
|
void |
setIndex(int index)
It sets the index associated with this partition to the value passed.
|
void |
setName(java.lang.String name)
It sets the partition name to the value passed.
|
int |
size()
Returns the number of nodes in the partition.
|
java.lang.String |
toString()
Returns a String version of the object.
|
java.lang.String |
toXML()
Returns the xml description of the object.
|
void |
toXML(java.io.Writer writer)
Returns the xml description of the object.
|
private void |
writeAttribute(java.io.Writer writer,
java.lang.String key,
java.lang.String value)
Writes an attribute to the stream.
|
setToString, vectorToString
private java.util.Set mNodeSet
private java.util.Map mParentsMap
private java.util.List mNodeList
GraphNode objects corresponding to the nodes
making the partiition.
private java.lang.String mID
private int mIndex
private java.lang.String mName
private GraphNode mLastAddedNode
public Partition()
public Partition(java.util.List nodeList, java.lang.String id)
nodeList
- list of GraphNode
objects.id
- the partition id of the partition.public void addNode(GraphNode node)
node
- the GraphNode
object corresponding to the job
that is to be added.public GraphNode lastAddedNode()
public java.util.List<GraphNode> getNodes()
GraphNode
objects.public java.util.List getRootNodes()
GraphNode
objects that are the root.public void constructPartition()
public void setName(java.lang.String name)
name
- the name to which the partition name needs to be set to.public java.lang.String getName()
public void setIndex(int index)
index
- the index value.public int getIndex()
public java.lang.String getID()
public void setID(java.lang.String id)
id
- the id of the partition.public int size()
public java.util.List<java.lang.String> getParents(java.lang.String id)
id
- the node for which parents are requiredpublic java.lang.String toString()
public void toXML(java.io.Writer writer) throws java.io.IOException
writer
- is a Writer opened and ready for writing. This can also
be a StringWriter for efficient output.java.io.IOException
- if something fishy happens to the stream.public java.lang.String toXML() throws java.io.IOException
java.io.IOException
- if something fishy happens to the stream.private void writeAttribute(java.io.Writer writer, java.lang.String key, java.lang.String value) throws java.io.IOException
writer
- key
- value
- java.io.IOException
- if something fishy happens to the stream.public java.util.Set getNodeIDs()
public void addParents(java.lang.String node, java.util.List parents)
node
- the id of the node for which you want to add the parents.parents
- list of id's of the parents of the nodes.public java.util.Map getRelations()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException