All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class busrider.Segment

java.lang.Object
   |
   +----busrider.Indexed
           |
           +----busrider.Segment

public class Segment
extends Indexed
This immutable class represents a segment. The segment connects two junctions (called the "A" junction and the "B" junction), has a length, and is part of a route.


Constructor Index

 o Segment(MutableSegment, BoardBuilder)
constructs an object like the MutableSegment parameter.

Method Index

 o equals(Object)
compares for content-equality.
 o getAjunc()
returns the segment's "A" junction.
 o getBjunc()
returns the segment's "B" junction.
 o getLength()
returns the segment's length.
 o getOther(Junction)
given one of the two endpoint junctions, returns the other.
 o getRoute()
returns the segment's route.
 o toString()
returns a string representation.

Constructors

 o Segment
 public Segment(MutableSegment ms,
                BoardBuilder bb)
constructs an object like the MutableSegment parameter.

Methods

 o equals
 public boolean equals(Object ob)
compares for content-equality.

Overrides:
equals in class Indexed
 o getAjunc
 public Junction getAjunc()
returns the segment's "A" junction.

 o getBjunc
 public Junction getBjunc()
returns the segment's "B" junction.

 o getLength
 public int getLength()
returns the segment's length.

 o getRoute
 public Route getRoute()
returns the segment's route.

 o getOther
 public Junction getOther(Junction junc)
given one of the two endpoint junctions, returns the other. Otherwise, returns null. (One can also use this to test whether the Segment abuts a particular Junction.)

 o toString
 public String toString()
returns a string representation. It shows A-junction-name, B-junction-name, route-name, and length.

Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index