|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcsheets.ext.assertion.Assertion
public abstract class Assertion
Abstract class representing an assertion. This class contains the common data and functionality for assertion (USAssertion and SGAssertion).
| Nested Class Summary | |
|---|---|
static class |
Assertion.ComparisonResult
The possible results when two assertions are compared. |
static class |
Assertion.Result
Enumeration indicating the result of a validation of a value. |
| Field Summary | |
|---|---|
protected MultiInterval |
intervals
Represents the intervals of allowed values for this assertion. |
protected boolean |
isInteger
Indicates wether only integer values are allowed |
| Constructor Summary | |
|---|---|
Assertion()
|
|
| Method Summary | |
|---|---|
boolean |
allowsIntegersOnly()
Checks if this assertion allows only integer values. |
boolean |
equals(Object o)
|
Iterator<Interval> |
getIntervalIterator()
Returns an iterator over the intervals representing all allowed values in this assertion. |
MultiInterval |
getMultiInterval()
Returns the MultiInterval specifying the valid values for this assertion. |
String |
toString()
|
Assertion.Result |
validate(double value)
Checks if the current assertion holds for the given value |
Assertion.Result |
validate(Value value)
Checks if the current assertion holds for the given value. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected MultiInterval intervals
protected boolean isInteger
| Constructor Detail |
|---|
public Assertion()
| Method Detail |
|---|
public Iterator<Interval> getIntervalIterator()
public MultiInterval getMultiInterval()
public boolean allowsIntegersOnly()
true if this assertion will validate only integer values
successfully, and false otherwise.public Assertion.Result validate(Value value)
value - An arbritrary object. The value the assertion will be verified
against will be retrieved from the object using its toString() method.
Result.NO_DATA if value is null or
value.toString() returns an empty string.
Result.NAN if the string returned by value.toString()
does not represent a number parsable by Double.parseDouble().
Result.OK if assertion holds for the value.
Result.FAILED if the assertion failed for the value, unless
one of the reasons above.
public Assertion.Result validate(double value)
Result.OK if the assertion holds for the value,
Result.NAN if value == Double.NaN
Result.FAILED otherwise.
public boolean equals(Object o)
equals in class Objectpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||