de.hpi.fgis.voidgen.hadoop.closure
Class NodeXOrId

java.lang.Object
  extended by de.hpi.fgis.voidgen.hadoop.closure.NodeXOrId
All Implemented Interfaces:
java.lang.Comparable<NodeXOrId>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<NodeXOrId>

public class NodeXOrId
extends java.lang.Object
implements org.apache.hadoop.io.WritableComparable<NodeXOrId>

Provides a container that contains either a node of a graph or a cluster identifier.

Author:
Johannes Gosda, Hasso Plattner Institute at University of Potsdam, Germany

Field Summary
(package private)  ClusterId id
          The identifier.
(package private)  CloneableText node
          The node.
 
Constructor Summary
NodeXOrId()
          Default constructor.
NodeXOrId(CloneableText node)
          Constructor for creating a node object.
NodeXOrId(ClusterId clusterId)
          Constructor for creating an id object.
 
Method Summary
 NodeXOrId clone()
           
 int compareTo(NodeXOrId obj)
           
 boolean equals(java.lang.Object o)
           
 ClusterId getId()
          Getter.
 CloneableText getNode()
          Getter.
 int hashCode()
           
 boolean isId()
           
 boolean isNode()
           
 void readFields(java.io.DataInput dataInput)
           
 java.lang.String toString()
           
 void write(java.io.DataOutput dataOutput)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id

ClusterId id
The identifier.


node

CloneableText node
The node.

Constructor Detail

NodeXOrId

public NodeXOrId()
Default constructor.


NodeXOrId

public NodeXOrId(ClusterId clusterId)
Constructor for creating an id object.

Parameters:
clusterId - Identifier of a cluster.

NodeXOrId

public NodeXOrId(CloneableText node)
Constructor for creating a node object.

Parameters:
node - The node.
Method Detail

clone

public NodeXOrId clone()
Overrides:
clone in class java.lang.Object

getId

public ClusterId getId()
Getter.

Returns:
the identifier stored in this container.

getNode

public CloneableText getNode()
Getter.

Returns:
the node stored in this container.

isId

public boolean isId()
Returns:
True if the id field is not null.

isNode

public boolean isNode()
Returns:
True if the node field is not null.

readFields

public void readFields(java.io.DataInput dataInput)
                throws java.io.IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
java.io.IOException

write

public void write(java.io.DataOutput dataOutput)
           throws java.io.IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
java.io.IOException

compareTo

public int compareTo(NodeXOrId obj)
Specified by:
compareTo in interface java.lang.Comparable<NodeXOrId>

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

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