nz.ac.waikato.mcennis.rat.graph.path
Interface Path

All Superinterfaces:
Model
All Known Implementing Classes:
BasicPath

public interface Path
extends Model

Class for describing a path in a graph


Field Summary
static int ADD_ACTOR
           
static int SET_PATH
           
static int WEAK
           
 
Method Summary
 Path addActor(Actor a, double cost)
          Create a new path that contains all the contents of this path plus an additional link to the given actor with the additional cost given.
 boolean contains(Actor node)
          returns if the path contains the given actor
 double getCost()
          return the total cost of this path
 Actor getEnd()
          return the last actor in this path
 Actor[] getMiddle()
          return all actors that are neither the start or end actors.
 Actor[] getPath()
          Returns the order array of the actors in this object.
 Actor getStart()
          Return the first actor in the path
 java.lang.String getType()
          Returns the PathSet id of this path
 boolean isWeak()
          returns if this path ever traverses a link in the wrong direction.
 void setPath(Actor[] participants, double cost, java.lang.String type)
          Create a path that goes through the following actors in order with a total cost and given id representing this PathSet id.
 void setWeak(boolean weak)
          Set that the path traverses the wrong direction on at least one link between actors.
 
Methods inherited from interface nz.ac.waikato.mcennis.rat.graph.model.Model
addListener
 

Field Detail

WEAK

static final int WEAK
See Also:
Constant Field Values

ADD_ACTOR

static final int ADD_ACTOR
See Also:
Constant Field Values

SET_PATH

static final int SET_PATH
See Also:
Constant Field Values
Method Detail

setPath

void setPath(Actor[] participants,
             double cost,
             java.lang.String type)
Create a path that goes through the following actors in order with a total cost and given id representing this PathSet id.

Parameters:
participants - actors in this path in order
cost - total cost (strength) of this path
type - PathSet id of this path

getPath

Actor[] getPath()
                throws NotConstructedError
Returns the order array of the actors in this object.

Returns:
ordered array of actors
Throws:
NotConstructedError

getStart

Actor getStart()
               throws NotConstructedError
Return the first actor in the path

Returns:
first actor
Throws:
NotConstructedError

getEnd

Actor getEnd()
             throws NotConstructedError
return the last actor in this path

Returns:
last actor
Throws:
NotConstructedError

getMiddle

Actor[] getMiddle()
                  throws NotConstructedError
return all actors that are neither the start or end actors.

Returns:
Throws:
NotConstructedError

getCost

double getCost()
               throws NotConstructedError
return the total cost of this path

Returns:
total cost of the path
Throws:
NotConstructedError

isWeak

boolean isWeak()
               throws NotConstructedError
returns if this path ever traverses a link in the wrong direction.

Returns:
traverses in the wrong direction on any link in the path.
Throws:
NotConstructedError

setWeak

void setWeak(boolean weak)
Set that the path traverses the wrong direction on at least one link between actors.

Parameters:
weak -

contains

boolean contains(Actor node)
                 throws NotConstructedError
returns if the path contains the given actor

Parameters:
node - actor to be checked
Returns:
does this actor exist in this path
Throws:
NotConstructedError

getType

java.lang.String getType()
                         throws NotConstructedError
Returns the PathSet id of this path

Returns:
PathSet id of this path.
Throws:
NotConstructedError

addActor

Path addActor(Actor a,
              double cost)
              throws NotConstructedError
Create a new path that contains all the contents of this path plus an additional link to the given actor with the additional cost given. It is the callers responsibility to not add an actor already present.

Parameters:
a - actor to be added
cost - cost to be added to the path cost
Returns:
new path including a deep copy of the original with the new path added.
Throws:
NotConstructedError