|
WebObjects 5.2.3 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webobjects.foundation.NSRange com.webobjects.foundation.NSMutableRange
An NSMutableRange is an object representing a range that can be changed. A range is a measurement of a segment of something linear, such as a byte stream. The two primary values an NSMutableRange can be changed, its location and its length. The methods of NSMutableRange also enables you to alter an NSMutableRange based on its union or intersection with another NSRange object.
The main purpose for NSMutableRange is to provide a way for methods to return range values in an "out" parameter. A client creates and passes in one or more NSMutableRanges to a method and gets back changed objects when the method returns. NSMutableRanges are also useful for performance reasons; instead of creating multiple NSRanges in a loop, just one NSMutableRange can be created and reuseed.
The NSMutableRange methods that provide the basis for all NSMutableRange's other methods are described below. That is, all other methods are implemented in terms of these four. If you create a subclass of NSMutableRange, you need only ensure that these base methods work properly. Having done so, you can be sure that all your subclass's inherited methods operate properly.
Method | Description |
location | Returns the starting location of the receiver. Inherited from NSRange. |
length | Returns the length of the receiver from its starting location. Inherited from NSRange. |
setLength | Sets the length of the receiver. |
setLocation | Sets the starting location of the receiver. |
setLength(int newLength)
,
setLocation(int newLocation)
,
NSRange
,
NSRange.location()
,
NSRange.length()
,
Serialized FormField Summary |
Fields inherited from class com.webobjects.foundation.NSRange |
ZeroRange |
Constructor Summary | |
NSMutableRange()
Creates and returns an empty NSMutableRange. |
|
NSMutableRange(int location,
int length)
Creates a new NSMutableRange with the range elements of location
and length . |
|
NSMutableRange(NSRange range)
Creates a new NSMutableRange with the location and length values of range . |
Method Summary | |
Object |
clone()
Simply returns this NSRange. |
void |
intersectRange(NSRange otherRange)
Changes the receiver to the range resulting from the intersection of otherRange and the receiver before the operation. |
void |
setLength(int length)
Sets the length of the receiver to length . |
void |
setLocation(int location)
Sets the starting location of the receiver to location . |
void |
unionRange(NSRange otherRange)
Changes the receiver to the range resulting from the union of otherRange and the receiver before the operation. |
Methods inherited from class com.webobjects.foundation.NSRange |
containsLocation, equals, fromString, hashCode, intersectsRange, isEmpty, isEqualToRange, isSubrangeOfRange, length, location, locationInRange, maxRange, rangeByIntersectingRange, rangeByUnioningRange, subtractRange, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public NSMutableRange()
public NSMutableRange(int location, int length)
location
and length
.
location
- location of the changeable rangelength
- length of the changeable range
IllegalArgumentException
- when any of the inputs
are negativepublic NSMutableRange(NSRange range)
range
.
This constructor is used in cloning the receiver.
range
- name of the array of rangeMethod Detail |
public Object clone()
NSRange
clone
in class NSRange
public void intersectRange(NSRange otherRange)
otherRange
and the receiver before the operation.
Sets the receiver to an empty range if they do not intersect.
otherRange
- the common range of the current and the receiver rangesunionRange(NSRange aRange)
public void setLength(int length)
length
.
Throws an IllegalArgumentException if length
is a
negative value.
length
- the input length
IllegalArgumentException
- if the input is negativesetLocation(int location)
public void setLocation(int location)
location
.
location
- Location of the receiver.
IllegalArgumentException
- if
location
is a negative
valuesetLength(int length)
public void unionRange(NSRange otherRange)
otherRange
and the receiver before the operation.
This is the lowest starting location and the highest ending location
of the two NSRanges.
otherRange
- sum of the ranges of the current and the receiver rangeintersectRange(NSRange aRange)
|
Last updated Thu Oct 21 15:04:16 PDT 2004. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |