Class Range
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Range

public class netscape.application.Range
    extends java.lang.Object
    implements netscape.util.Codable
{
    /* Fields
     */
    public int index;
    public int length;

    /* Constructors
     */
    public Range();
    public Range(int, int);
    public Range(Range);

    /* Methods
     */
    public static Range nullRange();
    public static Range rangeFromIndices(int, int);
    public static Range rangeFromIntersection(Range, Range);
    public static Range rangeFromUnion(Range, Range);

    public boolean contains(int);
    public void decode(Decoder);
    public void describeClassInfo(ClassInfo);
    public void encode(Encoder);
    public boolean equals(Object);
    public void finishDecoding();
    public int index();
    public void intersectWith(Range);
    public void intersectWith(int, int);
    public boolean intersects(Range);
    public boolean intersects(int, int);
    public boolean isEmpty();
    public boolean isNullRange();
    public int lastIndex();
    public int length();
    public String toString();
    public void unionWith(Range);
    public void unionWith(int, int);
}
Object subclass representing a range of indexed data. A Range consists of an index location and a length.

Fields

index

  public int index
The Range's first index.

length

  public int length
The Range's length.

Constructors

Range

  public Range()
Constructs a Range with value Range.nullRange().

Range

  public Range(int index,
               int length)
Constructs a Range with index index and length length.

Range

  public Range(Range templateRange)
Constructs a Range with the same index and length as templateRange.

Methods

nullRange

  public static Range nullRange()

rangeFromIntersection

  public static Range rangeFromIntersection(Range range1,
                                            Range range2)
Returns the intersection of range1 and range2.

rangeFromUnion

  public static Range rangeFromUnion(Range range1,
                                     Range range2)
Returns the union of range1 and range2.

rangeFromIndices

  public static Range rangeFromIndices(int index1,
                                       int index2)
Returns a Range containing index1 and index2.

index

  public int index()
Returns the Range's first index.

length

  public int length()
Returns the Range's length.

lastIndex

  public int lastIndex()
Returns the last index included in the Range.

equals

  public boolean equals(Object anObject)
Returns true if the Range equals anObject.
Overrides:
equals in class Object

unionWith

  public void unionWith(Range aRange)
Computes the union of the Range and aRange. Stores the result in the receiver. If the Range and aRange do not intersect, the union consists of the range from the minimum index to the maximum index.

unionWith

  public void unionWith(int anIndex,
                        int aLength)
Computes the union of the Range and the range defined by anIndex and aLength. Stores the result in the receiver. If the ranges do not intersect, the union consists of the range from the minimum index to the maximum index.

intersectWith

  public void intersectWith(Range aRange)
Computes the intersection of the Range and aRange. Stores the result in the receiver. The result is Range.nullRange() if the ranges do not intersect.

intersectWith

  public void intersectWith(int anIndex,
                            int aLength)
Computes the intersection of the Range and the range defined by anIndex and aLength. Stores the result in the receiver. The result is Range.nullRange() if the ranges do not intersect.

toString

  public String toString()
Returns the Range's String representation.
Overrides:
toString in class Object

intersects

  public boolean intersects(Range aRange)
Returns true if the receiver intersects aRange.

intersects

  public boolean intersects(int anIndex,
                            int aLength)
Returns true if the receiver intersects the range defined by anIndex and aLength.

isNullRange

  public boolean isNullRange()
Returns true if the receiver equals Range.nullRange().

isEmpty

  public boolean isEmpty()
Returns true the range has a length of zero.

contains

  public boolean contains(int anIndex)
Returns true if the Range includes anIndex.

describeClassInfo

  public void describeClassInfo(ClassInfo info)
Describes the Range class' coding information.
See Also:
describeClassInfo

encode

  public void encode(Encoder encoder) throws CodingException
Encodes the Range.
See Also:
encode

decode

  public void decode(Decoder decoder) throws CodingException
Decodes the Range.
See Also:
decode

finishDecoding

  public void finishDecoding() throws CodingException
Finishes the Range decoding.
See Also:
finishDecoding

All Packages  Class Hierarchy  This Package  Previous  Next  Index