|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.sdsc.mbt.util.RangeMap
The RangeMap class provides a means to map an integer value (such as an index) that falls in a fixed range (min and max) to application-supplied Objects. This can be used to efficiently associate properties (colors, radii, etc) to a numbered set of objects.
Constructor Summary | |
RangeMap(int min,
int max,
java.lang.Object defaultObject)
Construct a RangeMap object with the specified min, max, and default value. |
Method Summary | |
void |
append(java.lang.Object value)
Append a new value (increasing the range maximum by 1). |
void |
clearAll()
Clear the entire RangeMap by setting everything to the default value. |
void |
clearRange(int start,
int stop)
Clear the specified range by setting it to the default value. |
boolean |
getCollapseOn()
Get flag to enable/disable collapse feature. |
java.lang.Object |
getContiguousValue(int start_index,
int end_index)
Get the value object asocciated with the given start and end indexes. |
int |
getMax()
Get the maximum range index. |
int |
getMin()
Get the minimum range index. |
int[] |
getRange(int rangeIndex)
Get the range currently associated with the given rangeIndex. |
int |
getRangeCount()
Get the number of ranges currently assigned to this map. |
int |
getRangeEnd(int rangeIndex)
Get the endIndex for the given rangeIndex. |
int |
getRangeStart(int rangeIndex)
Get the startIndex for the given rangeIndex. |
java.lang.Object |
getRangeValue(int rangeIndex)
Get the value currently associated with the given rangeIndex. |
java.lang.Object |
getValue(int index)
Get the value object asocciated with the given index. |
void |
remove(int index)
Remove an index (decreasing the range maximum by 1 and causing all subsequent index values to be decreased by 1). |
void |
reset(int min,
int max,
java.lang.Object defaultValue)
Reset the entire RangeMap by setting new max, min and default values, and by clearing all existing ranges. |
void |
setCollapseOn(boolean state)
Set flag to enable/disable collapse feature. |
void |
setDefaultValue(java.lang.Object newDefault)
Set the default value to a new value. |
void |
setRange(int start,
int stop,
java.lang.Object value)
Assign an object value to the specified range. |
void |
setRangeValue(int rangeIndex,
java.lang.Object value)
Set the value currently associated with the given rangeIndex. |
void |
setValue(int index,
java.lang.Object value)
Assign an object value to the specified index. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RangeMap(int min, int max, java.lang.Object defaultObject)
Method Detail |
public int getMin()
public int getMax()
public void setCollapseOn(boolean state)
public boolean getCollapseOn()
public void setRange(int start, int stop, java.lang.Object value)
public void clearRange(int start, int stop)
public void clearAll()
public void reset(int min, int max, java.lang.Object defaultValue)
public void setDefaultValue(java.lang.Object newDefault)
public void setValue(int index, java.lang.Object value)
public java.lang.Object getValue(int index)
public java.lang.Object getContiguousValue(int start_index, int end_index)
This method is useful for efficiently determining if an entire index range maps contiguously (unbroken) to the same value object.
Example, in order to test that a given chain is selected, simply pass the chain's start atom index and end atom index to this method. If the chain is selected, the return value should be a boolean "True" object. If all atoms in the given chain are not all selected, then this method would return null.
public int getRangeCount()
public java.lang.Object getRangeValue(int rangeIndex)
public void setRangeValue(int rangeIndex, java.lang.Object value)
public int[] getRange(int rangeIndex)
public int getRangeStart(int rangeIndex)
public int getRangeEnd(int rangeIndex)
public void append(java.lang.Object value)
public void remove(int index)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |