|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.wotonomy.foundation.NSRange
public class NSRange
A pure java implementation of NSRange. An NSRange represents a range of numbers having a starting location and spanning a length.
Field Summary | |
---|---|
protected int |
len
|
protected int |
loc
|
static NSRange |
ZeroRange
An empty range. |
Constructor Summary | |
---|---|
NSRange()
Default constructor produces an empty range. |
|
NSRange(int location,
int length)
Produces a range with the specified location and length. |
|
NSRange(NSRange aRange)
Produces a range that has the same location and length as the specified range. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Returns a copy of this range. |
boolean |
equals(java.lang.Object anObject)
Returns whether the specified object is equal to this range. |
static NSRange |
fromString(java.lang.String aString)
Parses a range from a string of the form "{x,y}" where x is the location and y is the length. |
int |
hashCode()
Returns a hashCode. |
boolean |
intersectsRange(NSRange aRange)
Returns whether the specified range overlaps at any point with this range. |
boolean |
isEmpty()
Returns whether this is an empty range, therefore whether the length is zero. |
boolean |
isEqualToRange(NSRange aRange)
Returns whether the specified range is equal to this range. |
boolean |
isSubrangeOfRange(NSRange aRange)
Returns whether this range is completely contained within the specified range. |
int |
length()
Returns the length of this range. |
int |
location()
Returns the location of this range. |
boolean |
locationInRange(int location)
Returns whether the specified location is contained within this range. |
int |
maxRange()
Returns the maximum extent of the range. |
NSRange |
rangeByIntersectingRange(NSRange aRange)
Returns the intersection of this range and the specified range, if any. |
NSRange |
rangeByUnioningRange(NSRange aRange)
Returns the union of this range and the specified range, if any. |
void |
subtractRange(NSRange aRange,
NSMutableRange firstResult,
NSMutableRange secondResult)
Eliminates any intersections between this range and the specified range. |
java.lang.String |
toString()
Returns a string representation of this range. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final NSRange ZeroRange
protected int loc
protected int len
Constructor Detail |
---|
public NSRange()
public NSRange(int location, int length)
public NSRange(NSRange aRange)
Method Detail |
---|
public int location()
public int length()
public int maxRange()
public boolean isEmpty()
public boolean locationInRange(int location)
public boolean isEqualToRange(NSRange aRange)
public boolean equals(java.lang.Object anObject)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public NSRange rangeByUnioningRange(NSRange aRange)
public NSRange rangeByIntersectingRange(NSRange aRange)
public boolean intersectsRange(NSRange aRange)
public boolean isSubrangeOfRange(NSRange aRange)
public void subtractRange(NSRange aRange, NSMutableRange firstResult, NSMutableRange secondResult)
public java.lang.Object clone()
clone
in class java.lang.Object
public static NSRange fromString(java.lang.String aString)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |