ps3.graph
Class WeightedNode

java.lang.Object
  extended by ps3.graph.WeightedNode
All Implemented Interfaces:
Comparable<WeightedNode>

public class WeightedNode
extends Object
implements Comparable<WeightedNode>

A WeightedNode class is a simple record type which contains a name and a cost


Field Summary
 int cost
           
 String name
           
 
Constructor Summary
WeightedNode(String name, int cost)
          Constructs a new WeightedNode.
 
Method Summary
 int compareTo(WeightedNode o)
          WeightedNodes are ordered lexicographically by their name.
 int cost()
           
 boolean equals(Object o)
           
 int hashCode()
           
 String name()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

public final String name

cost

public final int cost
Constructor Detail

WeightedNode

public WeightedNode(String name,
                    int cost)
Constructs a new WeightedNode.

Effects:
constructs a new WeightedNode with the name name and the cost cost.
Method Detail

name

public String name()
Returns:
this.name

cost

public int cost()
Returns:
this.cost

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(WeightedNode o)
WeightedNodes are ordered lexicographically by their name. When two nodes share a name, their ordering is determined by the numeric ordering of their costs.

Specified by:
compareTo in interface Comparable<WeightedNode>