rafa.math
Class Segment

java.lang.Object
  extended by rafa.math.Segment

public class Segment
extends java.lang.Object

A segment, be it open or closed.

Author:
rafa

Field Summary
protected  java.lang.Number end
           
protected  java.lang.Number length
           
protected  java.lang.Number start
           
 
Constructor Summary
Segment(java.lang.Number a, java.lang.Number b)
          Constructor of a segment.
 
Method Summary
 java.lang.Number getEnd()
           
 java.lang.Number getLength()
           
 java.lang.Number getStart()
           
 void setEnd(java.lang.Number end)
          Sets an end point of the segment, maintaining the existing start point.
 void setStart(java.lang.Number start)
          Sets an end point of the segment, maintaining the existing end point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

start

protected java.lang.Number start

end

protected java.lang.Number end

length

protected java.lang.Number length
Constructor Detail

Segment

public Segment(java.lang.Number a,
               java.lang.Number b)
Constructor of a segment. Either parameter - but not both - can be null to create an open segment.

Parameters:
a - an end point of the segment
b - another end point of the segment
Method Detail

getLength

public java.lang.Number getLength()
Returns:

getStart

public java.lang.Number getStart()
Returns:

setStart

public void setStart(java.lang.Number start)
Sets an end point of the segment, maintaining the existing end point.

Parameters:
start - a new end point. If higher than the existing end point, start and end are swapped.

getEnd

public java.lang.Number getEnd()
Returns:

setEnd

public void setEnd(java.lang.Number end)
Sets an end point of the segment, maintaining the existing start point.

Parameters:
end - a new end point. If lesser than the existing start point, start and end are swapped.


Copyright © 2008-2009. All Rights Reserved.