annas.graph
Class DefaultArc<N>

java.lang.Object
  extended by annas.graph.DefaultArc<N>
Type Parameters:
N - Node type
All Implemented Interfaces:
ArcInterface<N>

public class DefaultArc<N>
extends java.lang.Object
implements ArcInterface<N>

Default arc with basic implementation of all the methods. This class is ideal for extending.

Author:
Sam Wilson

Constructor Summary
DefaultArc(N tail, N head, WeightedInterface wi)
          Constructor
 
Method Summary
 N getHead()
          Gets the head of the arc
 N getTail()
          Gets the tail of the arc
 java.lang.Double getWeight()
          Get the Weight of the arc by evaluating @see WeightedInterface.evaluate()
 WeightedInterface getWeightedInterface()
          Gets the Weight function
 void setWeight(WeightedInterface wi)
          Sets the Weight function
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultArc

public DefaultArc(N tail,
                  N head,
                  WeightedInterface wi)
Constructor

Parameters:
tail - Tail of the arc
head - Head of the arc
wi - Weight function of the arc
Method Detail

getWeightedInterface

public WeightedInterface getWeightedInterface()
Gets the Weight function

Specified by:
getWeightedInterface in interface ArcInterface<N>
Returns:
WeighteInterface used by the arc

getHead

public N getHead()
Gets the head of the arc

Specified by:
getHead in interface ArcInterface<N>
Returns:
Node at the head of the arc

getTail

public N getTail()
Gets the tail of the arc

Specified by:
getTail in interface ArcInterface<N>
Returns:
Node at the tail of the arc

getWeight

public java.lang.Double getWeight()
Get the Weight of the arc by evaluating @see WeightedInterface.evaluate()

Specified by:
getWeight in interface ArcInterface<N>
Returns:
weight of the arc

setWeight

public void setWeight(WeightedInterface wi)
Sets the Weight function

Specified by:
setWeight in interface ArcInterface<N>
Parameters:
wi - new weight function