beowulf.model.graph
Class Edge

java.lang.Object
  extended bybeowulf.model.graph.Edge
All Implemented Interfaces:
Serializable

public class Edge
extends Object
implements Serializable

The Edge class is used to represent an Edge inside of a Graph object. This class is meant largely for internal use inside the Graph class, but is occaisionally the returned value from a method call on an instance of a Graph. The Edge class stores both the source and destination Node as well as the 'cost'. The cost can be any Object. The interpretation of the cost is up to the programmer.

Version:
1.0, 06/09/03
Author:
Andy Scukanec (ags at cs dot cornell dot edu)
See Also:
Serialized Form

Field Summary
protected  Object cost
          This is the cost of the edge.
protected  Object destinationValue
          This is the destination node of the edge.
protected  Object sourceValue
          This is the source node of the edge.
 
Constructor Summary
Edge(Object newSourceValue, Object newDestinationValue, Object newCost)
          Constructs a new edge with the listed source and destination nodes as well as the cost.
 
Method Summary
 boolean equals(Object value)
          Returns true if value is non-null, an instance of Edge, and has the same source and destination nodes.
 Object getCost()
          Returns the cost of the edge.
 Object getDestinationValue()
          Returns the value of the destination node of the edge.
 Object getSourceValue()
          Returns the value of the source node of the edge.
 void setCost(Object newCost)
          Sets the cost of the edge.
 String toString()
          Returns a String representation of this edge.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sourceValue

protected Object sourceValue
This is the source node of the edge.


destinationValue

protected Object destinationValue
This is the destination node of the edge.


cost

protected Object cost
This is the cost of the edge.

Constructor Detail

Edge

public Edge(Object newSourceValue,
            Object newDestinationValue,
            Object newCost)
Constructs a new edge with the listed source and destination nodes as well as the cost.

Parameters:
newSourceValue - The value of the source node for the new edge.
newDestinationValue - The value of the destination node for the new edge.
newCost - The cost for the new edge.
Method Detail

getCost

public Object getCost()
Returns the cost of the edge.

Returns:
The cost of the edge.

getSourceValue

public Object getSourceValue()
Returns the value of the source node of the edge.

Returns:
The value of the source node of the edge.

getDestinationValue

public Object getDestinationValue()
Returns the value of the destination node of the edge.

Returns:
The value of the destination node of the edge.

setCost

public void setCost(Object newCost)
Sets the cost of the edge.

Parameters:
newCost - The new cost of the edge.

equals

public boolean equals(Object value)
Returns true if value is non-null, an instance of Edge, and has the same source and destination nodes.

Parameters:
value - The value to be compared to this object.
Returns:
True if the parameter is an equal Edge instance.

toString

public String toString()
Returns a String representation of this edge.

Returns:
A String representation of this edge.