Modifier and Type | Field and Description |
---|---|
static String |
PROPERTY_COMPARATOR |
static String |
PROPERTY_SORTED |
static String |
PROPERTY_VALUES |
PROPERTY_MAX, PROPERTY_MIN
Constructor and Description |
---|
CategoryRange() |
CategoryRange(CategoryRange<T> categoryRange)
Create a new CategoryRange by copying an existing one.
|
CategoryRange(Set<T> values)
Create a CategoryRange from a set of values.
|
CategoryRange(T... values)
Create a CategoryRange from the supplied values
|
Modifier and Type | Method and Description |
---|---|
CategoryRange<T> |
add(Category<T> c)
Adds a category to the range.
|
void |
adjust(T lower,
T upper)
Not supported for Category Ranges
|
boolean |
contains(Category<T> value)
Determines whether the category range contains the specified category value
|
boolean |
contains(T x)
Determines whether the category range contains the supplied possible value
|
Range<T> |
copy() |
Range<T> |
createIntermediate(Range<T> target,
double position)
Creates an intermediate range between this range and a target range.
|
boolean |
equals(Object obj) |
Category<T> |
getCategory(int position)
Returns the category with the supplied position value.
|
List<Category<T>> |
getCategoryValues()
Returns a list of the category values in this range
|
Comparator<T> |
getComparator()
Returns the comparator that, if set, will be used to sort the values in the range
|
List<T> |
getPossibleValues() |
int |
hashCode() |
boolean |
isSorted()
Returns a value to indicate whether the categories of the range are sorted
|
Iterator<Category<T>> |
iterator()
Returns an iterator for the category values
|
T |
lower() |
double |
maximum()
This may be the numeric representation of upper() or it may be rounded up.
|
double |
minimum()
This may be the numeric representation of lower() or it may be rounded down.
|
int |
position(T value) |
void |
reset()
Reset the maximum and minimum.
|
void |
setComparator(Comparator<T> comparator)
Specify the comparator that will be used to sort the values in the range.
|
void |
setMaximum(double value) |
void |
setMinimum(double value) |
void |
setSorted(boolean sorted)
Specify whether the categories of the range should be sorted.
|
double |
size()
Returns the size of the range, as given by the maximum minus the minimum.
|
String |
toString() |
T |
upper() |
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener
public static final String PROPERTY_VALUES
public static final String PROPERTY_COMPARATOR
public static final String PROPERTY_SORTED
public CategoryRange()
public CategoryRange(T... values)
values
- the values.public CategoryRange(Set<T> values)
upper()
and a lower()
value.values
- - the set of possible valuespublic CategoryRange(CategoryRange<T> categoryRange)
categoryRange
- the category range instance to copypublic Category<T> getCategory(int position)
position
- the position of a category along an axispublic CategoryRange<T> add(Category<T> c)
Adds a category to the range. Note that after adding categories, you will need to call reset() if you want the minimum and maximum numeric values of the range to be recomputed.
This method fires a property change event, but to avoid cloning a list for efficiency, the old value is always null
c
- the category to addpublic void setSorted(boolean sorted)
true
but do not explicitly
set a comparator for the sort ordering, then the natural ordering of the
objects (using java.util.Comparable) will be used. If the objects do not
implement Comparable, then a string comparator is constructed based on the
toString() method of the object.sorted
- whether the categories of the range should be sortedpublic boolean isSorted()
public Comparator<T> getComparator()
public void setComparator(Comparator<T> comparator)
comparator
- the comparator to be used to sort the values in the rangepublic Range<T> copy()
copy
in class AbstractRange<T>
public T lower()
public T upper()
public double maximum()
Range
maximum
in interface Range<T>
Range.maximum()
public double minimum()
Range
minimum
in interface Range<T>
Range.minimum()
public void reset()
public void setMinimum(double value)
public void setMaximum(double value)
public double size()
size
in interface Range<T>
Range.size()
public int position(T value)
public boolean contains(T x)
public boolean contains(Category<T> value)
value
- the category value.public List<Category<T>> getCategoryValues()
public Range<T> createIntermediate(Range<T> target, double position)
createIntermediate
in class AbstractRange<T>
target
- the target range of the morphposition
- a value between 0 and 1 indicating the position of the morph