|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdata.Interval
public class Interval
Interval
This class represents a real interval, comprised of two real bounds. Each of the bound can be open or closed. The values of the bounds aredouble
s. To represent singletons, we use the use the
representation [5,5]
, i.e. the two bounds must be equals
and included.
Copyright(c) 2005 Université Laval, LSFM research group.
Field Summary | |
---|---|
static Interval |
EMPTY_INTERVAL
Constant representing an empty interval. |
static Interval |
R
Represents the valid set of numbers. |
Constructor Summary | |
---|---|
Interval(boolean isLowerBoundIncluded,
double lowerBound,
double upperBound,
boolean isUpperBoundIncluded)
Constructor with parameters. |
|
Interval(Interval i)
Copy constructor. |
|
Interval(java.lang.String s)
Build a new interval from a string. |
Method Summary | |
---|---|
Interval |
closure()
Returns a closure of the current interval. |
boolean |
equals(java.lang.Object o)
Determines if the object is an interval equals to this one. |
double |
getLowerBound()
Returns the real number representing the lower bound. |
double |
getNb()
Returns the value of nb : 0 : no transition point to this interval 1 : at least one transition has this interval as domain 2 : at least one transition has this interval as image 3 : at least one transition has this interval both as domain and image |
double |
getUpperBound()
Returns the real number representing the upper bound. |
int |
hashCode()
Returning an integer representing this interval |
static Interval |
intersectionOf(Interval i,
Interval j)
Compute the intersection of two intervals. |
boolean |
intersectsWith(Interval i)
Determines if the current interval intersects with i. |
boolean |
isDiscrete()
An interval is discrete should both of its bound be equals and included. |
boolean |
isIn(double v)
Determines if the value v is indeed included in the interval. |
boolean |
isIncluded(Interval smaller)
Determines if the smaller interval is included into this one. |
boolean |
isLowerBoundIncluded()
Returns true should the lower bound be included |
boolean |
isUpperBoundIncluded()
Returns true should the upper bound be included |
void |
setIsLowerBoundIncluded(boolean isLowerBoundIncluded)
Change the inclusion status of the lower bound. |
void |
setIsUpperBoundIncluded(boolean isUpperBoundIncluded)
Change the inclusion status of the upper bound. |
void |
setLowerBound(double lowerBound)
Change the value of the lower bound. |
void |
setNb(int n)
Change the value of nb : 0 : no transition point to this interval 1 : at least one transition has this interval as domain 2 : at least one transition has this interval as image 3 : at least one transition has this interval both as domain and image |
void |
setUpperBound(double upperBound)
Change the value of the upper bound. |
java.lang.String |
toString()
Converting the current interval to string |
static Interval |
unionOf(Interval i,
Interval j)
Compute the union of two intervals, should these intersect. |
boolean |
verifierInvariants()
Verifies the interval's integrity |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Interval EMPTY_INTERVAL
public static final Interval R
Constructor Detail |
---|
public Interval(boolean isLowerBoundIncluded, double lowerBound, double upperBound, boolean isUpperBoundIncluded)
isLowerBoundIncluded
- true should the lower bound be includedlowerBound
- value of the lower boundupperBound
- value of the upper boundisUpperBoundIncluded
- true should the upper bound be includedpublic Interval(Interval i)
i
- the interval to copy.public Interval(java.lang.String s) throws DataParserException
{5}
: for a singleton, for example, this one represents [5,5] [5,10)
: for an interval with an included lower bound is 5,
and the non included upper bound is 10.
s
- the string representing the interval.
DataParserException
- should the string represent no valid interval.Method Detail |
---|
public boolean isLowerBoundIncluded()
true
should the lower bound be included
true
if the lower bound is includedpublic boolean isUpperBoundIncluded()
true
should the upper bound be included
true
if the upper bound is includedpublic double getLowerBound()
public double getUpperBound()
public double getNb()
public void setUpperBound(double upperBound)
upperBound
- the new value of the upper bound.public void setLowerBound(double lowerBound)
lowerBound
- the new value of the lower bound.public void setIsUpperBoundIncluded(boolean isUpperBoundIncluded)
isUpperBoundIncluded
- true
should the upper bound be included now.public void setIsLowerBoundIncluded(boolean isLowerBoundIncluded)
isLowerBoundIncluded
- true
should the lower bound be included now.public void setNb(int n)
n
- one of these 4 numberspublic boolean isIn(double v)
v
- the value to check
true
should v be part of the intervalpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the object to verify
true
should the object be an interval equivalent to this oneInterval(String)
public boolean isIncluded(Interval smaller)
smaller
- the smaller interval to determine the inclusion value.
true
if the smaller interval is included into this one.public boolean isDiscrete()
true
should both bounds be equals and included.public boolean intersectsWith(Interval i)
i
- An interval that might intersect.
true
if the current interval intersects with i.public static Interval intersectionOf(Interval i, Interval j)
i
- the first intervalj
- the second interval
public Interval closure()
public static Interval unionOf(Interval i, Interval j)
i
- the first intervals.j
- Interval
public java.lang.String toString()
toString
in class java.lang.Object
public boolean verifierInvariants()
public int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |