|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.nrao.sss.math.NumberInterval
public class NumberInterval
An interval on the number line from one number to another.
Whether or not the endpoints are part of an interval is
determined by its type
.
Version Info:
$Revision: 567 $ |
$Date: 2007-04-26 16:35:46 -0600 (Thu, 26 Apr 2007) $ |
$Author: dharland $ |
Nested Class Summary | |
---|---|
static class |
NumberInterval.IntervalType
Indicates whether or not the endpoints are inside or outside an interval. |
Constructor Summary | |
---|---|
NumberInterval(NumberInterval.IntervalType type,
Number a,
Number b)
Creates a new interval with the given properties. |
Method Summary | |
---|---|
boolean |
contains(Number candidate)
Returns true if this interval contains candidate . |
void |
setInterval(Number a,
Number b)
Sets the endpoints of this interval. |
void |
setType(NumberInterval.IntervalType newType)
Sets the value that determines which endpoints, if either, are in this interval. |
String |
toString()
Returns a string of form [low..high), where a square bracket indicates that the interval is closed on that end and a rounded bracket that it is open. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public NumberInterval(NumberInterval.IntervalType type, Number a, Number b)
type
- determines which endpoints, if either, are part of this
interval.a
- one of the endpoints.b
- the other endpoint.Method Detail |
---|
public void setInterval(Number a, Number b)
a
- one of the endpoints.b
- the other endpoint.public void setType(NumberInterval.IntervalType newType)
newType
- the type of this interval (open, closed, etc.).public boolean contains(Number candidate)
candidate
.
candidate
- a number that might be contained in this interval.
candidate
.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |