ComparableExt<Field>
public class IntervalField extends CompoundField
Both boundaries must be of the same type. And right one shouldn't be less than left one, but it is checked only when creating new interval and on request later. Once assigned type of simple fields cannot be changed in the future, but of course you are able to change their values.
Constructor | Description |
---|---|
IntervalField(SimpleField defaultField) |
Creates new interval and stores given field as both boundaries.
|
IntervalField(SimpleField left,
SimpleField right) |
Makes new interval with given boundaries.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
checkConstraints() |
Checks if simple fields' type and order is correct.
|
java.lang.Integer |
compareTo(Field object) |
Compares other field to this field.
|
void |
copy(Field field) |
It makes a copy of class variables.
|
Field |
duplicate() |
Makes a new instance of a field.
|
java.lang.Class<? extends SimpleField> |
getInnerType() |
Gives a type of fields which are held inside the interval.
|
SimpleField |
getLeft() |
Reads the left boundary.
|
void |
getLeft(SimpleField left) |
Stores the left value in given field.
|
SimpleField |
getRight() |
Reads the right boundary.
|
void |
getRight(SimpleField right) |
Stores the right value in given field.
|
boolean |
isSimilarTo(Field field) |
Tests if given field's type is similar to this one.
|
int |
isUnknown() |
Tests if interval value is determined.
|
void |
setUnknown() |
Makes interval value unknown.
|
java.lang.String |
toString() |
Returns a
String which represents value of this field. |
isGenerated, setGenerated
public IntervalField(SimpleField left, SimpleField right)
left
- simple field stored as left boundaryright
- simple field stored as right boundaryConsistencyException
- when left is not less than right boundaryInvalidTypeException
- when simple fields' type is different (not similar)java.lang.NullPointerException
- if simple field is nullpublic IntervalField(SimpleField defaultField)
defaultField
- field for both boundariesjava.lang.NullPointerException
- when simple field is nullpublic boolean checkConstraints()
true
.checkConstraints
in class CompoundField
false
when both boundaries are known, but not in ordertrue
if interval contains proper values of simple fieldspublic SimpleField getLeft()
public SimpleField getRight()
public void getLeft(SimpleField left)
left
- field's reference to copy value toInvalidTypeException
- when given field has wrong type and unable to make a copyjava.lang.NullPointerException
- if given field is nullField.copy(Field)
public void getRight(SimpleField right)
right
- field's reference to copy value toInvalidTypeException
- when given field has wrong type and unable to make a copyjava.lang.NullPointerException
- if given field is nullField.copy(Field)
public void copy(Field field)
copy
in class Field
field
- object which is interval with simple fields of the same typeInvalidTypeException
- when field is not IntervalField
or if simple fields cannot be copiedjava.lang.NullPointerException
- if given field is nullpublic Field duplicate()
Field
public java.lang.Class<? extends SimpleField> getInnerType()
public boolean isSimilarTo(Field field)
isSimilarTo
in class Field
field
- compared intervaltrue
if both fields are intervals with similar simple fieldsjava.lang.NullPointerException
- when given field is nullpublic java.lang.String toString()
String
which represents value of this field.
If interval is known, the result is set of boundaries separated by comma
and enclosed in brackets. In particular only one boundary may be known
and the other unknown.toString
in class java.lang.Object
public int isUnknown()
public void setUnknown()
setUnknown
in class Field
public java.lang.Integer compareTo(Field object)
object
- other field to compare with