edu.uchsc.ccp.knowtator
Class Span
java.lang.Object
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)
|
Span
public Span(int start,
int end)
throws InvalidSpanException
- Throws:
InvalidSpanException
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)