graph
Class Node

java.lang.Object
  extended bygraph.Node
All Implemented Interfaces:
java.lang.Comparable

public class Node
extends java.lang.Object
implements java.lang.Comparable


Field Summary
protected  Graph graph
           
protected  java.util.ArrayList in
           
protected  java.util.ArrayList out
           
protected  java.util.Map properties
           
 
Constructor Summary
Node(Graph graph, java.lang.String label)
          Initializes a new Node belonging to graph given as argument with given label
 
Method Summary
 Edge addEdge(Node dst)
          Adds an edge starting from the node and ending to node given as argument
protected  void addInEdge(Edge e)
           
protected  void addOutEdge(Edge e)
           
 int compareTo(java.lang.Object n)
           
 java.lang.String get(java.lang.String property)
          Returns the value for the given property of the node
 java.util.ArrayList getAdj()
          Returns an ArrayList of the Nodes adjanced to the node.
 double getDouble(java.lang.String property)
          Returns the value for the given property of the node
 java.util.ArrayList getEdges()
           
 java.util.ArrayList getInEdges()
          Returns an ArrayList of edges that end to this node.
 int getInt(java.lang.String property)
          Returns the value for the given property of the node
 java.util.ArrayList getNext()
          Returns an ArrayList of all the nodes to which there exists an edge starting at the node Use this method with directed graphs
 java.util.ArrayList getOutEdges()
          Returns an ArrayList of edges that start from this node.
 java.util.ArrayList getPrev()
          Returns an ArrayList of all the nodes from which there exists an edge ending at the node Use this method with directed graphs
 java.lang.String label()
          Returns label of the node
 void set(java.lang.String property, java.lang.String value)
          Sets the given property of the node to given value
 void setDouble(java.lang.String property, double value)
          Sets the given property of the node to given value
 void setInt(java.lang.String property, int value)
          Sets the given property of the node to given value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

properties

protected java.util.Map properties

graph

protected Graph graph

out

protected java.util.ArrayList out

in

protected java.util.ArrayList in
Constructor Detail

Node

public Node(Graph graph,
            java.lang.String label)
Initializes a new Node belonging to graph given as argument with given label

Parameters:
graph - Graph the node belongs to
label - the label of the node
Method Detail

addOutEdge

protected void addOutEdge(Edge e)

addInEdge

protected void addInEdge(Edge e)

label

public java.lang.String label()
Returns label of the node

Returns:
a String containing the label

compareTo

public int compareTo(java.lang.Object n)
Specified by:
compareTo in interface java.lang.Comparable

getAdj

public java.util.ArrayList getAdj()
Returns an ArrayList of the Nodes adjanced to the node. Use this method with undirected graphs.

Returns:
an ArrayList of the Nodes adjanced to the node

getEdges

public java.util.ArrayList getEdges()

getNext

public java.util.ArrayList getNext()
Returns an ArrayList of all the nodes to which there exists an edge starting at the node Use this method with directed graphs

Returns:
an ArrayList of the nodes succeeding the node

getOutEdges

public java.util.ArrayList getOutEdges()
Returns an ArrayList of edges that start from this node. Use this method with directed graphs

Returns:
an ArrayList containing out-edges

getPrev

public java.util.ArrayList getPrev()
Returns an ArrayList of all the nodes from which there exists an edge ending at the node Use this method with directed graphs

Returns:
an ArrayList of the nodes preceding the node

getInEdges

public java.util.ArrayList getInEdges()
Returns an ArrayList of edges that end to this node. Use this method with directed graphs

Returns:
an ArrayList containing in-edges

addEdge

public Edge addEdge(Node dst)
Adds an edge starting from the node and ending to node given as argument

Parameters:
dst - the destination node of the edge
Returns:
the newly created edge

set

public void set(java.lang.String property,
                java.lang.String value)
Sets the given property of the node to given value

Parameters:
property - a String containing property for which the value is set
value - a String containing the new value for the property

setInt

public void setInt(java.lang.String property,
                   int value)
Sets the given property of the node to given value

Parameters:
property - a String containing property for which the value is set
value - an integer containing the new value for the property

setDouble

public void setDouble(java.lang.String property,
                      double value)
Sets the given property of the node to given value

Parameters:
property - a String containing property for which the value is set
value - an double containing the new value for the property

get

public java.lang.String get(java.lang.String property)
Returns the value for the given property of the node

Parameters:
property - a String containing the requested property
Returns:
a String containing the current value of the property, or null, if the property does not exist

getInt

public int getInt(java.lang.String property)
Returns the value for the given property of the node

Parameters:
property - a String containing the requested property
Returns:
an integer containing the current value of the property, or -1, if the property does not exist

getDouble

public double getDouble(java.lang.String property)
Returns the value for the given property of the node

Parameters:
property - a String containing the requested property
Returns:
a double containing the current value of the property, or -1, if the property does not exist