edu.uchsc.ccp.iaa
Class Span

java.lang.Object
  extended by edu.uchsc.ccp.iaa.Span
All Implemented Interfaces:
Comparable

public class Span
extends Object
implements Comparable


Constructor Summary
Span(int start, int end)
           
 
Method Summary
 int compareTo(Object object)
           
 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 parseSpan(String spanString)
           
static Span shortest(List<Span> spans)
           
static boolean spansMatch(List<Span> spans1, List<Span> spans2)
          This method assumes that the both lists of spans are sorted the same way and that a span in one list at the same index as a span in the other list should be the same.
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)
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(Object object)
Specified by:
compareTo in interface Comparable

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)

intersects

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

spansMatch

public static boolean spansMatch(List<Span> spans1,
                                 List<Span> spans2)
This method assumes that the both lists of spans are sorted the same way and that a span in one list at the same index as a span in the other list should be the same.

Parameters:
spans1 - sorted list of spans
spans2 - sorted list of spans
Returns:
true if the two lists of spans are the same.

shortest

public static Span shortest(List<Span> spans)

substring

public static String substring(String string,
                               Span span)