org.jaitools.numeric
Enum RangeExtendedComparator.Result

java.lang.Object
  extended by java.lang.Enum<RangeExtendedComparator.Result>
      extended by org.jaitools.numeric.RangeExtendedComparator.Result
All Implemented Interfaces:
Serializable, Comparable<RangeExtendedComparator.Result>
Enclosing class:
RangeExtendedComparator<T extends Number & Comparable>

public static enum RangeExtendedComparator.Result
extends Enum<RangeExtendedComparator.Result>

Constants defining the names, notation and descriptions for the 18 different possible interval comparisons as described by:

Brian Hayes (2003) A lucid interval.
American Scientist 91(6):484-488.

Available at: http://www.cs.utep.edu/interval-comp/hayes.pdf

The meaning of each of the four characters in the notation describing the comparison between interval X and interval Y is as follows:
  1. Min X compared to Max Y
  2. Min X compared to Min Y
  3. Max X compared to Max Y
  4. Max X compared to Min Y
So, for instance X <<=> Y means interval X starts below and extends to the maximum of interval Y.


Enum Constant Summary
EEEE
          (Hayes notation ====) Point X is exactly equal to point Y.
EEGG
          (Hayes notation ==>>) Interval X extends from point location Y.
EGEG
          (Hayes notation =>=>) X is a point at maximum of interval Y
EGGG
          (Hayes notation =>>>) Interval X extends from maximum of interval Y
GGGG
          (Hayes notation >>>>) Interval X is entirely greater than interval Y
LEEG
          (Hayes notation <==>) Interval X is exactly equal to finite interval Y.
LEGG
          (Hayes notation <=>>) Interval X starts with and extends beyond interval Y.
LELE
          (Hayes notation <=<=) X is a point at minimum of interval Y
LELG
          (Hayes notation <=<>) Interval X starts with and ends within interval Y
LGEG
          (Hayes notation <>=>) Interval X starts within and extends to maximum of interval Y
LGGG
          (Hayes notation <>>>) Interval X starts within and extends beyond interval Y
LGLG
          (Hayes notation <><>) Interval X is enclosed by interval Y
LLEE
          (Hayes notation <<==) Interval X starts below and has maximum at point location Y.
LLEG
          (Hayes notation <<=>) Interval X starts below and extends to maximum of interval Y Notation: <<=>
LLGG
          (Hayes notation <<>>) Interval X strictly encloses interval Y
LLLE
          (Hayes notation <<<=) Interval X extends to minimum of interval Y
LLLG
          (Hayes notation <<<>) Interval X starts below and extends within interval Y
LLLL
          (Hayes notation <<<<) Interval X is entirely less than interval Y
 
Method Summary
static RangeExtendedComparator.Result get(int[] compFlags)
          Get the Result that matches the given array of comparison flags.
 int getAt(int pos)
          Gets the result element at the given index.
 String getDesc()
          Returns a description for this comparison type.
 String getNotation()
          Gets the notation form of this comparison.
 List<RangeExtendedComparator.Result> match(int op, int pos)
          Partial matching: returns a List of Types that have the given end-point comparison flag at the specified position
 List<RangeExtendedComparator.Result> match(int op, int pos, Collection<RangeExtendedComparator.Result> typesToSearch)
          Partial matching: returns a List of those Types in the provided Collection that have the given end-point comparison flag at the specified position.
static RangeExtendedComparator.Result valueOf(String name)
          Returns the enum constant of this type with the specified name.
static RangeExtendedComparator.Result[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

LLLL

public static final RangeExtendedComparator.Result LLLL
(Hayes notation <<<<) Interval X is entirely less than interval Y


LLLE

public static final RangeExtendedComparator.Result LLLE
(Hayes notation <<<=) Interval X extends to minimum of interval Y


LLLG

public static final RangeExtendedComparator.Result LLLG
(Hayes notation <<<>) Interval X starts below and extends within interval Y


LLEG

public static final RangeExtendedComparator.Result LLEG
(Hayes notation <<=>) Interval X starts below and extends to maximum of interval Y Notation: <<=>


LEGG

public static final RangeExtendedComparator.Result LEGG
(Hayes notation <=>>) Interval X starts with and extends beyond interval Y.


LLEE

public static final RangeExtendedComparator.Result LLEE
(Hayes notation <<==) Interval X starts below and has maximum at point location Y.


EEGG

public static final RangeExtendedComparator.Result EEGG
(Hayes notation ==>>) Interval X extends from point location Y.


LEEG

public static final RangeExtendedComparator.Result LEEG
(Hayes notation <==>) Interval X is exactly equal to finite interval Y.


EEEE

public static final RangeExtendedComparator.Result EEEE
(Hayes notation ====) Point X is exactly equal to point Y.
Notation: ====


LLGG

public static final RangeExtendedComparator.Result LLGG
(Hayes notation <<>>) Interval X strictly encloses interval Y


LGLG

public static final RangeExtendedComparator.Result LGLG
(Hayes notation <><>) Interval X is enclosed by interval Y


LGGG

public static final RangeExtendedComparator.Result LGGG
(Hayes notation <>>>) Interval X starts within and extends beyond interval Y


LGEG

public static final RangeExtendedComparator.Result LGEG
(Hayes notation <>=>) Interval X starts within and extends to maximum of interval Y


LELG

public static final RangeExtendedComparator.Result LELG
(Hayes notation <=<>) Interval X starts with and ends within interval Y


EGEG

public static final RangeExtendedComparator.Result EGEG
(Hayes notation =>=>) X is a point at maximum of interval Y


LELE

public static final RangeExtendedComparator.Result LELE
(Hayes notation <=<=) X is a point at minimum of interval Y


EGGG

public static final RangeExtendedComparator.Result EGGG
(Hayes notation =>>>) Interval X extends from maximum of interval Y


GGGG

public static final RangeExtendedComparator.Result GGGG
(Hayes notation >>>>) Interval X is entirely greater than interval Y

Method Detail

values

public static RangeExtendedComparator.Result[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (RangeExtendedComparator.Result c : RangeExtendedComparator.Result.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static RangeExtendedComparator.Result valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getNotation

public String getNotation()
Gets the notation form of this comparison. For example, for Result.LLEG the notation form is "<<=>".

Returns:
the Hayes notation

getDesc

public String getDesc()
Returns a description for this comparison type. The description is worded so that it makes grammatical sense when placed between two Range object names. For example...

 Range<Integer> r1 = ...
 Range<Integer> r2 = ...
 RangeComparator.Result comp = r1.compareTo(r2);
 System.out.println(String.format("Range r1 %s Range r2", comp.getDesc()));
 

Returns:
the description

getAt

public int getAt(int pos)
Gets the result element at the given index. The index can be specified as an int from 0 to 3 or one of the constants: RangeComparator#MAX_MAX, RangeComparator#MAX_MIN, RangeComparator#MIN_MAX, RangeComparator#MIN_MIN.

Parameters:
pos - index of the element to retrieve
Returns:
one of RangeComparator#LT, RangeComparator#GT, or RangeComparator#EQ

match

public List<RangeExtendedComparator.Result> match(int op,
                                                  int pos)
Partial matching: returns a List of Types that have the given end-point comparison flag at the specified position

Parameters:
op - one of the RangeComparator constants: LT, EQ, GT
pos - flag position 0-3
Returns:
the List of matching Types (may be empty)
See Also:
match(int, int, java.util.Collection)

match

public List<RangeExtendedComparator.Result> match(int op,
                                                  int pos,
                                                  Collection<RangeExtendedComparator.Result> typesToSearch)
Partial matching: returns a List of those Types in the provided Collection that have the given end-point comparison flag at the specified position. Repeated calls of this method can be used for incremental matching; for example...

 // first call uses two-arg method to select from all Types that have
 // the given flag at pos 0 (Types with names L***)
 List<Result> types = match(RangeComparator.LT, 0);

 // now winnow down to those Types that match LL*G
 types = match(RangeComparator.LT, 1, types);
 types = match(RangeComparator.GT, 3, types);

 for (Result t : types) {
     System.out.println(t.toString() + ": " + t.getDesc());
 }
 

Parameters:
op - one of the RangeComparator constants: LT, EQ, GT
pos - flag position 0-3
typesToSearch -
Returns:
the List of matching Types (may be empty)

get

public static RangeExtendedComparator.Result get(int[] compFlags)
Get the Result that matches the given array of comparison flags.

Parameters:
compFlags -
Returns:
the Result that matches the given array of comparison flags or null if there is no match


Copyright © 2009-2013. All Rights Reserved.