nz.ac.waikato.mcennis.rat.graph.path
Class BasicPath

java.lang.Object
  extended by nz.ac.waikato.mcennis.rat.graph.model.ModelShell
      extended by nz.ac.waikato.mcennis.rat.graph.path.BasicPath
All Implemented Interfaces:
Model, Path

public class BasicPath
extends ModelShell
implements Path

Class for a basic Path implementation


Field Summary
 
Fields inherited from class nz.ac.waikato.mcennis.rat.graph.model.ModelShell
listener
 
Fields inherited from interface nz.ac.waikato.mcennis.rat.graph.path.Path
ADD_ACTOR, SET_PATH, WEAK
 
Constructor Summary
BasicPath()
          Creates a new instance of BasicPath
 
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 class nz.ac.waikato.mcennis.rat.graph.model.ModelShell
addListener, fireChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nz.ac.waikato.mcennis.rat.graph.model.Model
addListener
 

Constructor Detail

BasicPath

public BasicPath()
Creates a new instance of BasicPath

Method Detail

setPath

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

Specified by:
setPath in interface Path
Parameters:
participants - actors in this path in order
cost - total cost (strength) of this path
type - PathSet id of this path

setWeak

public void setWeak(boolean weak)
Description copied from interface: Path
Set that the path traverses the wrong direction on at least one link between actors.

Specified by:
setWeak in interface Path

getPath

public Actor[] getPath()
                throws NotConstructedError
Description copied from interface: Path
Returns the order array of the actors in this object.

Specified by:
getPath in interface Path
Returns:
ordered array of actors
Throws:
NotConstructedError

getStart

public Actor getStart()
               throws NotConstructedError
Description copied from interface: Path
Return the first actor in the path

Specified by:
getStart in interface Path
Returns:
first actor
Throws:
NotConstructedError

getEnd

public Actor getEnd()
             throws NotConstructedError
Description copied from interface: Path
return the last actor in this path

Specified by:
getEnd in interface Path
Returns:
last actor
Throws:
NotConstructedError

getMiddle

public Actor[] getMiddle()
                  throws NotConstructedError
Description copied from interface: Path
return all actors that are neither the start or end actors.

Specified by:
getMiddle in interface Path
Returns:
Throws:
NotConstructedError

getCost

public double getCost()
               throws NotConstructedError
Description copied from interface: Path
return the total cost of this path

Specified by:
getCost in interface Path
Returns:
total cost of the path
Throws:
NotConstructedError

isWeak

public boolean isWeak()
               throws NotConstructedError
Description copied from interface: Path
returns if this path ever traverses a link in the wrong direction.

Specified by:
isWeak in interface Path
Returns:
traverses in the wrong direction on any link in the path.
Throws:
NotConstructedError

contains

public boolean contains(Actor node)
                 throws NotConstructedError
Description copied from interface: Path
returns if the path contains the given actor

Specified by:
contains in interface Path
Parameters:
node - actor to be checked
Returns:
does this actor exist in this path
Throws:
NotConstructedError

getType

public java.lang.String getType()
Description copied from interface: Path
Returns the PathSet id of this path

Specified by:
getType in interface Path
Returns:
PathSet id of this path.

addActor

public Path addActor(Actor a,
                     double cost)
              throws NotConstructedError
Description copied from interface: Path
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.

Specified by:
addActor in interface Path
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

Get Relational Analysis Toolkit at SourceForge.net. Fast, secure and Free Open Source software downloads