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

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

Method Index

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

Constructors

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

Methods

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

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

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

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

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

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.)

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