|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pivot.wtk.Span
public final class Span
Class representing a range of integer values. The range includes all values in the interval [start, end]. Values may be negative, and the value of start may be less than or equal to the value of end.
Field Summary | |
---|---|
int |
end
|
static String |
END_KEY
|
int |
start
|
static String |
START_KEY
|
Constructor Summary | |
---|---|
Span(Dictionary<String,?> span)
|
|
Span(int index)
|
|
Span(int start,
int end)
|
|
Span(Span span)
|
Method Summary | |
---|---|
boolean |
contains(Span span)
Determines whether this span contains another span. |
static Span |
decode(String value)
|
boolean |
equals(Object o)
|
long |
getLength()
Returns the length of the span. |
int |
hashCode()
|
Span |
intersect(Span span)
Calculates the intersection of this span and another span. |
boolean |
intersects(Span span)
Determines whether this span intersects with another span. |
Span |
normalize()
Returns a normalized equivalent of the span in which start is guaranteed to be less than end. |
Span |
offset(int offset)
Returns a new Span with both values offset by the given value. |
String |
toString()
|
Span |
union(Span span)
Calculates the union of this span and another span. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final int start
public final int end
public static final String START_KEY
public static final String END_KEY
Constructor Detail |
---|
public Span(int index)
public Span(int start, int end)
public Span(Span span)
public Span(Dictionary<String,?> span)
Method Detail |
---|
public long getLength()
public boolean contains(Span span)
span
- The span to test for containment.
public boolean intersects(Span span)
span
- The span to test for intersection.
public Span intersect(Span span)
span
- The span to intersect with this span.
public Span union(Span span)
span
- The span to union with this span.
public Span normalize()
public Span offset(int offset)
Span
with both values offset by the given value.
This is useful while moving through a TextPane
document
for instance, where you have to subtract off the starting offset for
child nodes.
offset
- The positive or negative amount by which to "move" this
span (both start and end).
Span
with updated values.public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public static Span decode(String value)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |