JXTA

net.jxta.impl.document
Class LiteXMLElement.charRange

java.lang.Object
  extended by net.jxta.impl.document.LiteXMLElement.charRange
All Implemented Interfaces:
Comparable<LiteXMLElement.charRange>
Enclosing class:
LiteXMLElement

protected static class LiteXMLElement.charRange
extends Object
implements Comparable<LiteXMLElement.charRange>

Defines a range of characters, probably within a string. The range is deemed to be invalid if 'start' is -1. A zero length range is, by convention, described by an 'end' value of 'start' - 1.


Field Summary
 int end
          Contains the end position of this range. one weird thing: if end == start -1, then the item is of zero length beginning at start.
 int start
          Contains the start position of this range.
 
Constructor Summary
LiteXMLElement.charRange()
          Constructor for a null charRange.
LiteXMLElement.charRange(int start, int end)
          Constructor for which the bounds are specified.
 
Method Summary
 int compareTo(LiteXMLElement.charRange someRange)
          
 boolean contains(int someLoc)
          Returns true if the location specified is contained in this range.
 boolean contains(LiteXMLElement.charRange someRange)
          Returns true if the charRange specified by someRange is contained within this range.
 boolean contains(LiteXMLElement.tagRange someRange)
          Returns true if the tagRange specified by someRange is contained within this range.
 boolean equals(Object aRange)
          
 boolean isValid()
          Returns true if the range is both non-null and has a length of greater than or equal to zero.
 int length()
          Returns the length of this range.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

start

public int start
Contains the start position of this range.


end

public int end
Contains the end position of this range. one weird thing: if end == start -1, then the item is of zero length beginning at start.

Constructor Detail

LiteXMLElement.charRange

public LiteXMLElement.charRange()
Constructor for a null charRange.


LiteXMLElement.charRange

public LiteXMLElement.charRange(int start,
                                int end)
Constructor for which the bounds are specified.

Method Detail

equals

public boolean equals(Object aRange)

Overrides:
equals in class Object

compareTo

public int compareTo(LiteXMLElement.charRange someRange)

Specified by:
compareTo in interface Comparable<LiteXMLElement.charRange>

toString

public String toString()

Overrides:
toString in class Object

contains

public boolean contains(LiteXMLElement.charRange someRange)
Returns true if the charRange specified by someRange is contained within this range.

Parameters:
someRange - The range which must be contained within this range.
Returns:
true if the specified range is contained with this range otherwise false.

contains

public boolean contains(LiteXMLElement.tagRange someRange)
Returns true if the tagRange specified by someRange is contained within this range.

Parameters:
someRange - The range which must be contained within this range.
Returns:
true if the specified range is contained with this range otherwise false.

contains

public boolean contains(int someLoc)
Returns true if the location specified is contained in this range.

Parameters:
someLoc - the location which is to be tested.
Returns:
true if the location is in this range, otherwise false.

isValid

public boolean isValid()
Returns true if the range is both non-null and has a length of greater than or equal to zero.

Returns:
true if the range is a valid one, otherwise false.

length

public int length()
Returns the length of this range.

Returns:
The length of the range or -1 if the range is null.

JXSE