edu.stanford.nlp.util
Class Interval<E extends Comparable<E>>

java.lang.Object
  extended by edu.stanford.nlp.util.Pair<E,E>
      extended by edu.stanford.nlp.util.Interval<E>
All Implemented Interfaces:
HasInterval<E>, Serializable, Comparable<Pair<E,E>>

public class Interval<E extends Comparable<E>>
extends Pair<E,E>
implements HasInterval<E>

Represents a interval

Author:
Angel Chang
See Also:
Serialized Form

Nested Class Summary
static class Interval.RelType
           
 
Field Summary
static int INTERVAL_OPEN_BEGIN
           
static int INTERVAL_OPEN_END
           
protected static int REL_FLAGS_AFTER
           
protected static int REL_FLAGS_BEFORE
           
static int REL_FLAGS_EE_AFTER
           
static int REL_FLAGS_EE_BEFORE
           
static int REL_FLAGS_EE_SAME
           
protected static int REL_FLAGS_EE_SHIFT
           
static int REL_FLAGS_EE_UNKNOWN
           
static int REL_FLAGS_ES_AFTER
           
static int REL_FLAGS_ES_BEFORE
           
static int REL_FLAGS_ES_SAME
           
protected static int REL_FLAGS_ES_SHIFT
           
static int REL_FLAGS_ES_UNKNOWN
           
static int REL_FLAGS_INTERVAL_AFTER
           
static int REL_FLAGS_INTERVAL_ALMOST_AFTER
           
static int REL_FLAGS_INTERVAL_ALMOST_BEFORE
           
static int REL_FLAGS_INTERVAL_ALMOST_SAME
           
static int REL_FLAGS_INTERVAL_BEFORE
           
static int REL_FLAGS_INTERVAL_CONTAIN
           
static int REL_FLAGS_INTERVAL_FUZZY
           
static int REL_FLAGS_INTERVAL_INSIDE
           
static int REL_FLAGS_INTERVAL_OVERLAP
           
static int REL_FLAGS_INTERVAL_SAME
           
static int REL_FLAGS_INTERVAL_UNKNOWN
           
protected static int REL_FLAGS_SAME
           
static int REL_FLAGS_SE_AFTER
           
static int REL_FLAGS_SE_BEFORE
           
static int REL_FLAGS_SE_SAME
           
protected static int REL_FLAGS_SE_SHIFT
           
static int REL_FLAGS_SE_UNKNOWN
           
static int REL_FLAGS_SS_AFTER
           
static int REL_FLAGS_SS_BEFORE
           
static int REL_FLAGS_SS_SAME
           
protected static int REL_FLAGS_SS_SHIFT
           
static int REL_FLAGS_SS_UNKNOWN
           
protected static int REL_FLAGS_UNKNOWN
           
 
Fields inherited from class edu.stanford.nlp.util.Pair
first, second
 
Fields inherited from interface edu.stanford.nlp.util.HasInterval
OFFSET_COMPARATOR
 
Constructor Summary
protected Interval(E a, E b, int flags)
           
 
Method Summary
 int addIntervalRelationFlags(int flags, boolean checkFuzzy)
           
static boolean checkFlagExclusiveSet(int flags, int flag, int mask)
           
static boolean checkFlagSet(int flags, int flag)
           
static boolean checkMultipleBitSet(int flags)
           
 boolean contains(E p)
           
 boolean equals(Object o)
           
 Interval expand(Interval<E> other)
           
static int extractRelationSubflags(int flags, int shift)
           
 E getBegin()
           
 E getEnd()
           
 Interval<E> getInterval()
           
 Interval.RelType getRelation(Interval<E> other)
           
 int getRelationFlags(Interval<E> other)
           
 int hashCode()
           
 boolean includesBegin()
           
 boolean includesEnd()
           
 Interval intersect(Interval<E> other)
           
protected static
<E extends Comparable<E>>
E
max(E a, E b)
           
protected static
<E extends Comparable<E>>
E
min(E a, E b)
           
 boolean overlaps(Interval<E> other)
           
static
<E extends Comparable<E>>
Interval<E>
toInterval(E a, E b)
           
static
<E extends Comparable<E>>
Interval<E>
toInterval(E a, E b, int flags)
           
protected  int toRelFlags(int comp, int shift)
           
static
<E extends Comparable<E>>
Interval<E>
toValidInterval(E a, E b)
           
static
<E extends Comparable<E>>
Interval<E>
toValidInterval(E a, E b, int flags)
           
 
Methods inherited from class edu.stanford.nlp.util.Pair
compareTo, first, internedStringPair, makePair, readStringPair, save, second, setFirst, setSecond, stringIntern, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

INTERVAL_OPEN_BEGIN

public static int INTERVAL_OPEN_BEGIN

INTERVAL_OPEN_END

public static int INTERVAL_OPEN_END

REL_FLAGS_SAME

protected static final int REL_FLAGS_SAME
See Also:
Constant Field Values

REL_FLAGS_BEFORE

protected static final int REL_FLAGS_BEFORE
See Also:
Constant Field Values

REL_FLAGS_AFTER

protected static final int REL_FLAGS_AFTER
See Also:
Constant Field Values

REL_FLAGS_UNKNOWN

protected static final int REL_FLAGS_UNKNOWN
See Also:
Constant Field Values

REL_FLAGS_SS_SHIFT

protected static final int REL_FLAGS_SS_SHIFT
See Also:
Constant Field Values

REL_FLAGS_SE_SHIFT

protected static final int REL_FLAGS_SE_SHIFT
See Also:
Constant Field Values

REL_FLAGS_ES_SHIFT

protected static final int REL_FLAGS_ES_SHIFT
See Also:
Constant Field Values

REL_FLAGS_EE_SHIFT

protected static final int REL_FLAGS_EE_SHIFT
See Also:
Constant Field Values

REL_FLAGS_SS_SAME

public static final int REL_FLAGS_SS_SAME
See Also:
Constant Field Values

REL_FLAGS_SS_BEFORE

public static final int REL_FLAGS_SS_BEFORE
See Also:
Constant Field Values

REL_FLAGS_SS_AFTER

public static final int REL_FLAGS_SS_AFTER
See Also:
Constant Field Values

REL_FLAGS_SS_UNKNOWN

public static final int REL_FLAGS_SS_UNKNOWN
See Also:
Constant Field Values

REL_FLAGS_SE_SAME

public static final int REL_FLAGS_SE_SAME
See Also:
Constant Field Values

REL_FLAGS_SE_BEFORE

public static final int REL_FLAGS_SE_BEFORE
See Also:
Constant Field Values

REL_FLAGS_SE_AFTER

public static final int REL_FLAGS_SE_AFTER
See Also:
Constant Field Values

REL_FLAGS_SE_UNKNOWN

public static final int REL_FLAGS_SE_UNKNOWN
See Also:
Constant Field Values

REL_FLAGS_ES_SAME

public static final int REL_FLAGS_ES_SAME
See Also:
Constant Field Values

REL_FLAGS_ES_BEFORE

public static final int REL_FLAGS_ES_BEFORE
See Also:
Constant Field Values

REL_FLAGS_ES_AFTER

public static final int REL_FLAGS_ES_AFTER
See Also:
Constant Field Values

REL_FLAGS_ES_UNKNOWN

public static final int REL_FLAGS_ES_UNKNOWN
See Also:
Constant Field Values

REL_FLAGS_EE_SAME

public static final int REL_FLAGS_EE_SAME
See Also:
Constant Field Values

REL_FLAGS_EE_BEFORE

public static final int REL_FLAGS_EE_BEFORE
See Also:
Constant Field Values

REL_FLAGS_EE_AFTER

public static final int REL_FLAGS_EE_AFTER
See Also:
Constant Field Values

REL_FLAGS_EE_UNKNOWN

public static final int REL_FLAGS_EE_UNKNOWN
See Also:
Constant Field Values

REL_FLAGS_INTERVAL_SAME

public static final int REL_FLAGS_INTERVAL_SAME
See Also:
Constant Field Values

REL_FLAGS_INTERVAL_BEFORE

public static final int REL_FLAGS_INTERVAL_BEFORE
See Also:
Constant Field Values

REL_FLAGS_INTERVAL_AFTER

public static final int REL_FLAGS_INTERVAL_AFTER
See Also:
Constant Field Values

REL_FLAGS_INTERVAL_OVERLAP

public static final int REL_FLAGS_INTERVAL_OVERLAP
See Also:
Constant Field Values

REL_FLAGS_INTERVAL_INSIDE

public static final int REL_FLAGS_INTERVAL_INSIDE
See Also:
Constant Field Values

REL_FLAGS_INTERVAL_CONTAIN

public static final int REL_FLAGS_INTERVAL_CONTAIN
See Also:
Constant Field Values

REL_FLAGS_INTERVAL_UNKNOWN

public static final int REL_FLAGS_INTERVAL_UNKNOWN
See Also:
Constant Field Values

REL_FLAGS_INTERVAL_ALMOST_SAME

public static final int REL_FLAGS_INTERVAL_ALMOST_SAME
See Also:
Constant Field Values

REL_FLAGS_INTERVAL_ALMOST_BEFORE

public static final int REL_FLAGS_INTERVAL_ALMOST_BEFORE
See Also:
Constant Field Values

REL_FLAGS_INTERVAL_ALMOST_AFTER

public static final int REL_FLAGS_INTERVAL_ALMOST_AFTER
See Also:
Constant Field Values

REL_FLAGS_INTERVAL_FUZZY

public static final int REL_FLAGS_INTERVAL_FUZZY
See Also:
Constant Field Values
Constructor Detail

Interval

protected Interval(E a,
                   E b,
                   int flags)
Method Detail

toInterval

public static <E extends Comparable<E>> Interval<E> toInterval(E a,
                                                               E b)

toInterval

public static <E extends Comparable<E>> Interval<E> toInterval(E a,
                                                               E b,
                                                               int flags)

toValidInterval

public static <E extends Comparable<E>> Interval<E> toValidInterval(E a,
                                                                    E b)

toValidInterval

public static <E extends Comparable<E>> Interval<E> toValidInterval(E a,
                                                                    E b,
                                                                    int flags)

getInterval

public Interval<E> getInterval()
Specified by:
getInterval in interface HasInterval<E extends Comparable<E>>

getBegin

public E getBegin()

getEnd

public E getEnd()

max

protected static <E extends Comparable<E>> E max(E a,
                                                 E b)

min

protected static <E extends Comparable<E>> E min(E a,
                                                 E b)

contains

public boolean contains(E p)

expand

public Interval expand(Interval<E> other)

intersect

public Interval intersect(Interval<E> other)

overlaps

public boolean overlaps(Interval<E> other)

includesBegin

public boolean includesBegin()

includesEnd

public boolean includesEnd()

toRelFlags

protected int toRelFlags(int comp,
                         int shift)

getRelationFlags

public int getRelationFlags(Interval<E> other)

addIntervalRelationFlags

public int addIntervalRelationFlags(int flags,
                                    boolean checkFuzzy)

extractRelationSubflags

public static int extractRelationSubflags(int flags,
                                          int shift)

checkMultipleBitSet

public static boolean checkMultipleBitSet(int flags)

checkFlagSet

public static boolean checkFlagSet(int flags,
                                   int flag)

checkFlagExclusiveSet

public static boolean checkFlagExclusiveSet(int flags,
                                            int flag,
                                            int mask)

getRelation

public Interval.RelType getRelation(Interval<E> other)

equals

public boolean equals(Object o)
Overrides:
equals in class Pair<E extends Comparable<E>,E extends Comparable<E>>

hashCode

public int hashCode()
Overrides:
hashCode in class Pair<E extends Comparable<E>,E extends Comparable<E>>


Stanford NLP Group