Jet.Tipster
Class Span

java.lang.Object
  extended byJet.Tipster.Span
All Implemented Interfaces:
java.lang.Comparable

public class Span
extends java.lang.Object
implements java.lang.Comparable

A portion of a document, represented by its starting and ending character positions, and a pointer to the document.


Constructor Summary
Span(int s, int e)
          Creates a span from position s up to position e, with a null document pointer.
 
Method Summary
 int compareTo(java.lang.Object o)
          compares this Span to Object o, which must be a Span.
 Document document()
          Returns the Document associated with a Span.
 int end()
          Returns the end of the span.
 int endNoWS(Document doc)
          Returns the end of the span, after trimming any white space at the end of the span.
 boolean equals(Span s)
          Returns true if the start and end of the spans are both equal.
 void setDocument(Document doc)
          Sets the Document associated with a Span.
 void setEnd(int e)
          sets the end of the span to 's'.
 void setStart(int s)
          sets the start of the span to 's'.
 int start()
          Returns the start of the span.
 java.lang.String toString()
          Returns a printable form of the span, "[start-end]".
 boolean within(Span s)
          Returns true if Span 's' contains the span.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Span

public Span(int s,
            int e)
Creates a span from position s up to position e, with a null document pointer.

Method Detail

start

public int start()
Returns the start of the span.


end

public int end()
Returns the end of the span.


setStart

public void setStart(int s)
sets the start of the span to 's'.


setEnd

public void setEnd(int e)
sets the end of the span to 's'.


endNoWS

public int endNoWS(Document doc)
Returns the end of the span, after trimming any white space at the end of the span.


setDocument

public void setDocument(Document doc)
Sets the Document associated with a Span.


document

public Document document()
Returns the Document associated with a Span.


equals

public boolean equals(Span s)
Returns true if the start and end of the spans are both equal.


within

public boolean within(Span s)
Returns true if Span 's' contains the span.


compareTo

public int compareTo(java.lang.Object o)
compares this Span to Object o, which must be a Span. Returns -1 if the start of this span precedes the start of s, or they have the same start and the end of this span precedes the end of s. Returns +1 if the start of this span follows the start of s, or they have the same start and the end of this span follows the end of s. Otherwise returns 0.

Specified by:
compareTo in interface java.lang.Comparable

toString

public java.lang.String toString()
Returns a printable form of the span, "[start-end]".