|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.cmu.sun.folds.IndexRange
public class IndexRange
This represents a range of indexes. The range can have a size of 0, which means that it is empty. The range also return the type of overlap and distance that exists between index ranges. Note, the IndexRange object is mutable.
| Nested Class Summary | |
|---|---|
static class |
IndexRange.Overlap
An overlap describes the type and distance of overlap between two ranges. |
| Field Summary | |
|---|---|
protected int |
position
Position of the start of the range. |
protected int |
size
The size of the range, in number of items. |
| Constructor Summary | |
|---|---|
IndexRange(IndexRange range)
|
|
IndexRange(int position,
int size)
Create a new IndexRange |
|
| Method Summary | |
|---|---|
boolean |
encompassesIndex(int p)
|
int |
getEnd()
|
IndexRange.Overlap |
getOverlap(IndexRange r)
Get the overlap between this range and another. |
static IndexRange.Overlap |
getOverlap(IndexRange r1,
IndexRange r2)
Determines the overlap between two ranges. |
int |
getStart()
|
void |
merge(IndexRange ir)
Merges this range with the other range this function takes the lowest start, and the highest end, and sets this index range to encompas both |
int |
position()
position is the place where this range starts. |
void |
setPosition(int position)
Set the position for this range |
void |
setSize(int size)
set the size for this range. |
int |
size()
|
java.lang.String |
toString()
For debugging only. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int position
protected int size
| Constructor Detail |
|---|
public IndexRange(int position,
int size)
position - position of the start of the rangesize - size of the range in number of itemspublic IndexRange(IndexRange range)
| Method Detail |
|---|
public void merge(IndexRange ir)
ir - index range to merge with.public int size()
public int position()
public int getStart()
public int getEnd()
public static IndexRange.Overlap getOverlap(IndexRange r1,
IndexRange r2)
r1 - One range to use.r2 - Another range to use.
public IndexRange.Overlap getOverlap(IndexRange r)
r - a range to compare with this range.
public boolean encompassesIndex(int p)
p - index to check
public java.lang.String toString()
toString in class java.lang.Objectpublic void setPosition(int position)
position - new position.public void setSize(int size)
size - new size.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||