|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.decisiondeck.xmcda_oo.structure.OrderedInterval
public class OrderedInterval
An interval on the set of reals, with a preference direction, typically attached to a criterion. The preference direction indicates if an alternative, when evaluated on that criterion, is preferred to an other one if its evaluation is higher (preference direction is to Maximize) or if it is lower (preference direction is to Minimize) than an other one. The interval indicates the set of values that any evaluation may lie into. When considering the criterion as an evaluation function, it is the codomain of the criterion. This object may have a preference direction set, or the interval set (if not set, this is equivalent to the whole set of real numbers with infinite minimum and maximum), or both, or nothing (be empty), and is immutable. The minimum value, when set, is the first value this interval accepts, thus it is minimum inclusive. The same holds for the maximum. With a preference direction and an interval defined, it is possible to query this object for the worst value and the best value supplementary to the minimum and maximum value. The maximum must be greater than or equal to the minimum, regardless of the preference direction of the bound criterion.
This object may also have a step size, that permits it to define a discrete interval, e.g. a subset of the set of integers when using an integer step size and an integer minimum value.
Because this object accepts a minimum value equal to the maximum, this interval may represent a single point.
| Constructor Summary | |
|---|---|
OrderedInterval(Criterion.PreferenceDirection preferenceDirection,
double minimum,
double maximum,
Double stepSize)
|
|
| Method Summary | |
|---|---|
boolean |
equals(Object obj)
|
DiscreteOrderedInterval |
getAsDiscreteInterval()
This interval must have a step size. |
IntegerStepScaleToDel |
getAsIntegerStepScale()
|
double |
getBest()
The preference direction must be set. |
int |
getDirectionAsSign()
The preference direction must be set. |
double |
getMaximum()
Retrieves the maximum value included in this interval, or positive infinity. |
double |
getMinimum()
Retrieves the minimum value included in this interval, or negative infinity. |
Criterion.PreferenceDirection |
getPreferenceDirection()
Retrieves the preference direction associated to this interval. |
Double |
getStepSize()
Retrieves the step size bound to this interval, or null if no step size is defined. |
double |
getWorst()
The preference direction must be set. |
int |
hashCode()
|
boolean |
isInteger()
|
static OrderedInterval |
newDirection(Criterion.PreferenceDirection direction)
Creates a new real interval, with no minimum or maximum bounds, representing the given preference direction. |
static OrderedInterval |
newDiscreteInterval(Criterion.PreferenceDirection direction,
double minimum,
double maximum,
double stepSize)
|
static OrderedInterval |
newInterval(Criterion.PreferenceDirection direction,
double minimum,
double maximum)
|
static OrderedInterval |
newMaximizeDirection()
|
static OrderedInterval |
newMinimizeDirection()
|
static OrderedInterval |
newRealsInterval()
Creates an interval with infinite lower and upper bounds, representing the whole set of real numbers, and without a preference direction. |
static OrderedInterval |
newUnrestrictedInterval(Criterion.PreferenceDirection direction,
double minimum,
double maximum)
Creates an interval with possibly infinite lower and upper bounds. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public OrderedInterval(Criterion.PreferenceDirection preferenceDirection,
double minimum,
double maximum,
Double stepSize)
preferenceDirection - null for not set.minimum - Double.NEGATIVE_INFINITY for not set.maximum - Double.POSITIVE_INFINITY for not set.stepSize - null for not set, or must be greater than zero, in which case minimum must be set.| Method Detail |
|---|
public static OrderedInterval newDirection(Criterion.PreferenceDirection direction)
direction - null for not set.
public double getWorst()
IOrderedIntervalThe preference direction must be set.
Retrieves the minimum value if the preference direction is to maximize, the maximum value if the preference direction is to minimize. If the corresponding bound is not set this method returns a positive or negative infinity.
getWorst in interface IOrderedInterval
public static OrderedInterval newDiscreteInterval(Criterion.PreferenceDirection direction,
double minimum,
double maximum,
double stepSize)
direction - may be null.minimum - a real number, not infinite.maximum - a real number, or positive infinity.stepSize - a real number, not infinite.
public static OrderedInterval newUnrestrictedInterval(Criterion.PreferenceDirection direction,
double minimum,
double maximum)
direction - may be null.minimum - a real number, or negative infinity.maximum - a real number, or positive infinity.
public static OrderedInterval newMaximizeDirection()
public static OrderedInterval newMinimizeDirection()
public boolean isInteger()
public IntegerStepScaleToDel getAsIntegerStepScale()
public Criterion.PreferenceDirection getPreferenceDirection()
IOrderedInterval
getPreferenceDirection in interface IOrderedIntervalnull for not set.public int getDirectionAsSign()
IOrderedIntervalThe preference direction must be set.
Useful for computations depending on the preference direction associated with this interval.
getDirectionAsSign in interface IOrderedIntervalpublic double getMaximum()
IOrderedIntervalIOrderedInterval.getMinimum().
getMaximum in interface IOrderedIntervalDouble.POSITIVE_INFINITY or a real number.public double getMinimum()
IOrderedIntervalIOrderedInterval.getMaximum().
getMinimum in interface IOrderedIntervalDouble.NEGATIVE_INFINITY or a real number.public Double getStepSize()
IOrderedIntervalnull if no step size is defined. If the step size
is defined, the minimum of this interval is a real, thus non-infinite, number.
getStepSize in interface IOrderedIntervalnull for no step size, or a number greater than zero.public double getBest()
IOrderedIntervalThe preference direction must be set.
Retrieves the maximum value if the preference direction is to maximize, the minimum value if the preference direction is to minimize. If the corresponding bound is not set this method returns a positive or negative infinity.
getBest in interface IOrderedInterval
public static OrderedInterval newInterval(Criterion.PreferenceDirection direction,
double minimum,
double maximum)
direction - may be null.minimum - a real number, not infinite.maximum - a real number, not infinite.
public DiscreteOrderedInterval getAsDiscreteInterval()
IOrderedIntervalThis interval must have a step size.
Retrieves a facade permitting easier usage of this interval when it represents a discrete interval.
getAsDiscreteInterval in interface IOrderedIntervalnull.public boolean equals(Object obj)
equals in class Objectpublic String toString()
toString in class Objectpublic int hashCode()
hashCode in class Objectpublic static OrderedInterval newRealsInterval()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||