|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.util.Range<T>
public class Range<T extends Comparable<? super T>>
provides a generic wrapper for lower- and upperbounds for a comparable object. Range objects are immutable. As a specialty, instances of this class can also be used in the com.antelmann.sql package to provide more sophisticated query support.
ConnectionHelper.addWhereClause(Appendable, java.util.List, java.util.Map),
SQLMapFilter,
Serialized Form| Field Summary |
|---|
| Fields inherited from interface com.antelmann.sql.SQLConstraint |
|---|
IS_NULL, NOT_NULL |
| Fields inherited from interface com.antelmann.util.Filter |
|---|
EXCLUDE_ALL_FILTER, INCLUDE_ALL_FILTER |
| Constructor Summary | |
|---|---|
Range()
a range with effectively no restrictions; any given object would be within the range |
|
Range(Comparable<? super T> lowerBound,
Comparable<? super T> upperBound)
both bounds are considered inclusive within the range. |
|
Range(Comparable<? super T> lowerBound,
Comparable<? super T> upperBound,
boolean inclusive)
if either or both (lower- and upperBound) are non-null, they represent a limit that is either inclusive or not depending on the given boolean. |
|
| Method Summary | ||
|---|---|---|
boolean |
accept(T entry)
returns true only if the given entry is accepted by this filter |
|
Range<Date> |
asRange(LifeCycleObject lco)
|
|
|
convert(Converter<T,N> c)
|
|
|
convert(PatternExtractor<T,N> pe)
|
|
boolean |
equals(Object obj)
|
|
T |
getBegin()
|
|
T |
getEnd()
|
|
Comparable<? super T> |
getLowerBound()
|
|
T |
getLowerEnd()
provides an unsafe cast to the type at hand (assuming that the bounds represent the same) |
|
Comparable<? super T> |
getUpperBound()
|
|
T |
getUpperEnd()
provides an unsafe cast to the type at hand (assuming that the bounds represent the same) |
|
int |
hashCode()
|
|
boolean |
includes(Range<T> range)
|
|
Range<T> |
intersection(Range<T> range)
a non-null value is returned only if the given ranges do overlap |
|
boolean |
isClosedRange()
a range is 'closed' if both, begin and end, are non-null |
|
boolean |
isEmpty()
a range is 'empty' if no bound is set |
|
boolean |
isInclusive()
|
|
boolean |
isInRange(T obj)
|
|
boolean |
isInRangeUnchecked(Object obj)
convenience method for unchecked calls |
|
boolean |
isOpenRange()
a range is 'open' if it is not closed |
|
boolean |
isReal()
a range is 'real' if there is anything it could include, so it is either an open range or a range where the lowerBound is actually 'less' (or equal if the range is inclusive) than the upperBound |
|
boolean |
isTyped(Class<? super T> type)
returns true only if the embedded comparators - if given - are indeed instances of the type, so that the methods that assume this wouldn't fail |
|
boolean |
overlapsWith(Range<T> range)
requires that both ranges are real and that the bounds are instances of T |
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Range()
public Range(Comparable<? super T> lowerBound,
Comparable<? super T> upperBound)
public Range(Comparable<? super T> lowerBound,
Comparable<? super T> upperBound,
boolean inclusive)
| Method Detail |
|---|
public String toString()
toString in class Objectpublic Comparable<? super T> getLowerBound()
public Comparable<? super T> getUpperBound()
public T getLowerEnd()
public T getUpperEnd()
public T getBegin()
getLowerEnd()public T getEnd()
getUpperEnd()public boolean isOpenRange()
public boolean isClosedRange()
public boolean isEmpty()
public boolean isReal()
public boolean isInclusive()
public boolean isTyped(Class<? super T> type)
getBegin(),
getEnd(),
getLowerEnd(),
getUpperEnd()public int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic boolean includes(Range<T> range)
public Range<T> intersection(Range<T> range)
throws InconsistentContentException
InconsistentContentExceptionoverlapsWith(Range)
public boolean overlapsWith(Range<T> range)
throws InconsistentContentException
InconsistentContentExceptionisTyped(Class)public boolean isInRange(T obj)
public boolean accept(T entry)
Filter
accept in interface Filter<T extends Comparable<? super T>>public <N extends Comparable<? super N>> Range<N> convert(Converter<T,N> c)
public <N extends Comparable<? super N>> Range<N> convert(PatternExtractor<T,N> pe)
public boolean isInRangeUnchecked(Object obj)
throws ClassCastException
ClassCastExceptionpublic Range<Date> asRange(LifeCycleObject lco)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||