edu.uchsc.ccp.iaa
Class Span
java.lang.Object
edu.uchsc.ccp.iaa.Span
- All Implemented Interfaces:
- Comparable
public class Span
- extends Object
- implements Comparable
Constructor Summary |
Span(int start,
int end)
|
Span
public Span(int start,
int end)
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 spansspans2
- 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)