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.Object
A 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 boolean
adjust(N x)
Adjusts this range by the given number.boolean
contains(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.boolean
equals(java.lang.Object obj)
N
getMaximum()
Gets the maximum value.N
getMinimum()
Gets the minimum value.int
hashCode()
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:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-