edu.uchsc.ccp.knowtator
Class Span

java.lang.Object
  extended by edu.uchsc.ccp.knowtator.Span
All Implemented Interfaces:
Comparable<Span>

public class Span
extends Object
implements Comparable<Span>


Constructor Summary
Span(int start, int end)
           
 
Method Summary
 int compareTo(Span span)
           
 boolean contains(int i)
           
 boolean contains(Span span)
           
 boolean crosses(Span span)
           
 boolean equals(Object object)
           
 int getEnd()
           
 int getSize()
           
 int getStart()
           
 boolean greaterThan(Span span)
           
 int hashCode()
           
static boolean intersects(List<Span> spans1, List<Span> spans2)
           
 boolean intersects(Span span)
          we need some junit tests
static boolean isValid(int start, int end)
           
 int length()
           
 boolean lessThan(Span span)
           
static Span merge(Span span1, Span span2)
          This method takes two spans that intersect and returns a Span that "merges" the two spans.
static Span parseSpan(String spanString)
           
static Span shortest(List<Span> spans)
           
static boolean spansMatch(List<Span> spans1, List<Span> spans2)
           
static String substring(String string, Span span)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Span

public Span(int start,
            int end)
     throws InvalidSpanException
Throws:
InvalidSpanException
Method Detail

isValid

public static boolean isValid(int start,
                              int end)

length

public int length()

getStart

public int getStart()

getEnd

public int getEnd()

getSize

public int getSize()
Returns:
the length of the span (end - start)

compareTo

public int compareTo(Span span)
Specified by:
compareTo in interface Comparable<Span>

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object object)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

contains

public boolean contains(Span span)

contains

public boolean contains(int i)

intersects

public boolean intersects(Span span)
we need some junit tests


crosses

public boolean crosses(Span span)

lessThan

public boolean lessThan(Span span)

greaterThan

public boolean greaterThan(Span span)

parseSpan

public static Span parseSpan(String spanString)
                      throws InvalidSpanException
Throws:
InvalidSpanException

intersects

public static boolean intersects(List<Span> spans1,
                                 List<Span> spans2)

spansMatch

public static boolean spansMatch(List<Span> spans1,
                                 List<Span> spans2)

shortest

public static Span shortest(List<Span> spans)

merge

public static Span merge(Span span1,
                         Span span2)
This method takes two spans that intersect and returns a Span that "merges" the two spans. The start of the returned span is the minimum of span1.getStart and span2.getStart. The end of the returned span is the maximum of span1.getEnd and span2.getEnd

Parameters:
span1 -
span2 -
Returns:
null if the two spans do not intersect

substring

public static String substring(String string,
                               Span span)