|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.range.AbstractRange<T> com.jidesoft.range.CategoryRange<T>
public class CategoryRange<T>
Note that this class is iterable so you can use it in an advanced for.. loop
Field Summary | |
---|---|
static String |
PROPERTY_COMPARATOR
|
static String |
PROPERTY_SORTED
|
static String |
PROPERTY_VALUES
|
Fields inherited from interface com.jidesoft.range.Range |
---|
PROPERTY_MAX, PROPERTY_MIN |
Constructor Summary | |
---|---|
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 |
Method Summary | |
---|---|
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()
|
Methods inherited from class com.jidesoft.range.AbstractRange |
---|
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String PROPERTY_VALUES
public static final String PROPERTY_COMPARATOR
public static final String PROPERTY_SORTED
Constructor Detail |
---|
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 copyMethod Detail |
---|
public List<T> getPossibleValues()
public Category<T> getCategory(int position)
position
- the position of a category along an axis
public 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 add
public 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()
lower
in interface Range<T>
public T upper()
upper
in interface Range<T>
public void adjust(T lower, T upper)
adjust
in interface Range<T>
lower
- the new smallest value of the rangeupper
- the new largest value of the rangepublic 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)
contains
in interface Range<T>
public boolean contains(Category<T> value)
value
- the category value.
public Iterator<Category<T>> iterator()
iterator
in interface Iterable<Category<T>>
public List<Category<T>> getCategoryValues()
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
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
public String toString()
toString
in class Object
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |