nrc.fuzzy
Class Interval
java.lang.Object
|
+--nrc.fuzzy.Interval
- All Implemented Interfaces:
- java.io.Serializable
- public class Interval
- extends java.lang.Object
- implements java.io.Serializable
The Interval
class is used to represent an interval of
the real number line. It consists of the low value of the interval, the high
value of the interval and a flag for each of these two endpoints that
indicates whether the endpoint is closed (includes the endpoint) or open
(does not include the endpoint). Often we will see an interval represented as:
[5, 10] - all values from 5 to 10 including 5 and 10
(5, 10] - all values from 5 to 10 excluding 5 and including 10
[5, 10) - all values from 5 to 10 including 5 and excluding 10
(5, 10) - all values from 5 to 10 excluding 5 and 10
We use intervals to represent the support and the alpha-cut of a FuzzyValue.
- See Also:
FuzzyValue
,
Serialized Form
Field Summary |
protected double |
highX
|
protected double |
lowX
|
protected java.text.NumberFormat |
nf
|
protected boolean |
openFlagHigh
|
protected boolean |
openFlagLow
|
protected static int |
toStringPrecision
A constant which represents the default precision of the
toString method of Interval. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
lowX
protected double lowX
openFlagLow
protected boolean openFlagLow
highX
protected double highX
openFlagHigh
protected boolean openFlagHigh
toStringPrecision
protected static int toStringPrecision
- A constant which represents the default precision of the
toString
method of Interval.
This precision can be changed using the setToStringPrecision
method.
nf
protected java.text.NumberFormat nf
setLowX
public void setLowX(double lowX)
getLowX
public double getLowX()
setLowOpenFlag
public void setLowOpenFlag(boolean flag)
getLowOpenFlag
public boolean getLowOpenFlag()
setHighX
public void setHighX(double highX)
getHighX
public double getHighX()
setHighOpenFlag
public void setHighOpenFlag(boolean flag)
getHighOpenFlag
public boolean getHighOpenFlag()
setToStringPrecision
public static void setToStringPrecision(int numDecimalPlaces)
- Sets the precision, in terms of the number of decimal places that will
be printed for each double value, of the
toString
method.
- Parameters:
numDecimalPlaces
- the desired number of decimal places for each
double value printed by the toString
method
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object