All Packages Class Hierarchy This Package Previous Next Index
Class com.apple.alpha.core.Range
java.lang.Object
|
+----com.apple.alpha.core.Range
- public final class Range
- extends Object
This class is used to represent a range. A range has two
attributes, its location (or start) and length (or extent).
-
length
- The length (or extent) of the range.
-
location
- The start of the range.
-
Range(int, int)
- Create a new Range with the given location and length.
-
equals(Object)
- Compare an Object to the receiver.
-
intersectionRange(Range)
- Return a new Range covering the intersection of the receiver and the
given Range.
-
isEqualToRange(Range)
- Compare a Range to the receiver.
-
locationInRange(int)
- Return true if the given location is included in the receiving
Range.
-
maxRange()
- Return the farther location covered by the Range.
-
toString()
- Return a textual representation of the receiver.
-
unionRange(Range)
- Return a new Range covering the union of the receiver and the
given Range.
location
public int location
- The start of the range.
length
public int length
- The length (or extent) of the range.
Range
public Range(int loc,
int len)
- Create a new Range with the given location and length.
- Parameters:
- loc - the location of the new range.
- len - the length of the new range.
maxRange
public int maxRange()
- Return the farther location covered by the Range.
locationInRange
public boolean locationInRange(int loc)
- Return true if the given location is included in the receiving
Range.
- Parameters:
- loc - the location to be tested.
equals
public boolean equals(Object o)
- Compare an Object to the receiver. Return true if the Object is
an instance of the Range class and both objects have the same
location and length.
- Parameters:
- o - the object the receiver is compared against.
- Overrides:
- equals in class Object
isEqualToRange
public boolean isEqualToRange(Range r)
- Compare a Range to the receiver. Return true if both objects have the same
location and length.
- Parameters:
- r - the Range the receiver is compared against.
unionRange
public Range unionRange(Range r)
- Return a new Range covering the union of the receiver and the
given Range.
This new Range covers all indices in and between the receiver
and the given Range. If one range is completely contained in
the other, the returned range is is equal to the larger range.
- Parameters:
- r - the Range used to create the union.
intersectionRange
public Range intersectionRange(Range r)
- Return a new Range covering the intersection of the receiver and the
given Range.
This new Range covers the indices that exist in both ranges. If the returned
range's length field is zero, then the two ranges don't intersect, and the
value of the location field is undefined
- Parameters:
- r - the Range used to create the union.
toString
public String toString()
- Return a textual representation of the receiver. A point with location
7 and length 19 will be represented as the string
"{location = 7; length = 19}".
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index