Package openbook.domain
Class Range<N extends java.lang.Number>
- java.lang.Object
-
- openbook.domain.Range<N>
-
public class Range<N extends java.lang.Number> extends java.lang.ObjectA simple numeric range. Minimum value is included, maximum value is excluded.- Author:
- Pinaki Poddar
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadjust(N x)Adjusts this range by the given number.booleancontains(java.lang.Number x)Affirms if the given value is within this range.<X extends java.lang.Number>
booleancontains(Range<X> r)Affirms if the given range is within this range.booleanequals(java.lang.Object obj)NgetMaximum()Gets the maximum value.NgetMinimum()Gets the minimum value.inthashCode()java.lang.Class<N>type()
-
-
-
Method Detail
-
type
public java.lang.Class<N> type()
-
contains
public boolean contains(java.lang.Number x)
Affirms if the given value is within this range. Minimum is included, maximum is excluded.- Parameters:
x- a non-null value- Returns:
- true if the given value is greater than or equals to minimum and less than the maximum.
-
contains
public <X extends java.lang.Number> boolean contains(Range<X> r)
Affirms if the given range is within this range. Minimum is included, maximum is excluded.- Parameters:
x- a non-null value- Returns:
- true if the given value is greater than or equals to minimum and less than the maximum.
-
getMinimum
public N getMinimum()
Gets the minimum value.
-
getMaximum
public N getMaximum()
Gets the maximum value.
-
adjust
public boolean adjust(N x)
Adjusts this range by the given number.- Parameters:
x- a non-null value.- Returns:
- if this range is adjusted by this value.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-