prefuse.data.util
Interface Index

All Known Implementing Classes:
TreeIndex

public interface Index

Represents an index over a column of data, allowing quick lookups by data value and providing iterators over sorted ranges of data. For convenience, there are index lookup methods for a variety of data types; which ones to use depend on the data type of the column being indexed and calling a lookup method for an incompatible data type could lead to an exception being thrown.

Author:
jeffrey heer

Field Summary
static int TYPE_AEE
          Composite flag for an ascending, left and right exclusive range.
static int TYPE_AEI
          Composite flag for an ascending, left exclusive, right inclusive range.
static int TYPE_AIE
          Composite flag for an ascending, left inclusive, right exclusive range.
static int TYPE_AII
          Composite flag for an ascending, left and right inclusive range.
static int TYPE_ASCENDING
          Flag for an ascending sort order.
static int TYPE_DEE
          Composite flag for a descending, left and right exclusive range.
static int TYPE_DEI
          Composite flag for a descending, left exclusive, right inclusive range.
static int TYPE_DESCENDING
          Flag for a descending sort order.
static int TYPE_DIE
          Composite flag for a descending, left inclusive, right exclusive range.
static int TYPE_DII
          Composite flag for a descending, left and right inclusive range.
static int TYPE_LEFT_EXCLUSIVE
          Flag for excluding the lowest value of a range.
static int TYPE_LEFT_INCLUSIVE
          Flag for including the lowest value of a range.
static int TYPE_RIGHT_EXCLUSIVE
          Flag for excluding the highest value of a range.
static int TYPE_RIGHT_INCLUSIVE
          Flag for including the highest value of a range.
 
Method Summary
 IntIterator allRows(int type)
          Get an iterator over all rows in the index, in sorted order.
 void dispose()
          Dispose of an index, deregistering all listeners.
 int get(double x)
          Get the first row found with the given data value.
 int get(float x)
          Get the first row found with the given data value.
 int get(int x)
          Get the first row found with the given data value.
 int get(long x)
          Get the first row found with the given data value.
 int get(java.lang.Object x)
          Get the first row found with the given data value.
 java.util.Comparator getComparator()
          Get the comparator used to compare column data values.
 void index()
          Perform an initial indexing of a data column.
 int maximum()
          Get the row (or one of the rows) with the maximum data value.
 int median()
          Get the row (or one of the rows) with the median data value.
 int minimum()
          Get the row (or one of the rows) with the minimum data value.
 IntIterator rows(boolean val)
          Get an iterator over all rows with the given data value.
 IntIterator rows(double val)
          Get an iterator over all rows with the given data value.
 IntIterator rows(double lo, double hi, int type)
          Get an iterator over a sorted range of rows.
 IntIterator rows(float val)
          Get an iterator over all rows with the given data value.
 IntIterator rows(float lo, float hi, int type)
          Get an iterator over a sorted range of rows.
 IntIterator rows(int val)
          Get an iterator over all rows with the given data value.
 IntIterator rows(int lo, int hi, int type)
          Get an iterator over a sorted range of rows.
 IntIterator rows(long val)
          Get an iterator over all rows with the given data value.
 IntIterator rows(long lo, long hi, int type)
          Get an iterator over a sorted range of rows.
 IntIterator rows(java.lang.Object val)
          Get an iterator over all rows with the given data value.
 IntIterator rows(java.lang.Object lo, java.lang.Object hi, int type)
          Get an iterator over a sorted range of rows.
 int size()
          Get the size of this index, the number of data value / row pairs included.
 int uniqueCount()
          Get the number of unique data values in the index.
 

Field Detail

TYPE_ASCENDING

public static final int TYPE_ASCENDING
Flag for an ascending sort order.

See Also:
Constant Field Values

TYPE_DESCENDING

public static final int TYPE_DESCENDING
Flag for a descending sort order.

See Also:
Constant Field Values

TYPE_LEFT_INCLUSIVE

public static final int TYPE_LEFT_INCLUSIVE
Flag for including the lowest value of a range.

See Also:
Constant Field Values

TYPE_LEFT_EXCLUSIVE

public static final int TYPE_LEFT_EXCLUSIVE
Flag for excluding the lowest value of a range.

See Also:
Constant Field Values

TYPE_RIGHT_INCLUSIVE

public static final int TYPE_RIGHT_INCLUSIVE
Flag for including the highest value of a range.

See Also:
Constant Field Values

TYPE_RIGHT_EXCLUSIVE

public static final int TYPE_RIGHT_EXCLUSIVE
Flag for excluding the highest value of a range.

See Also:
Constant Field Values

TYPE_AII

public static final int TYPE_AII
Composite flag for an ascending, left and right inclusive range.

See Also:
Constant Field Values

TYPE_DII

public static final int TYPE_DII
Composite flag for a descending, left and right inclusive range.

See Also:
Constant Field Values

TYPE_AEI

public static final int TYPE_AEI
Composite flag for an ascending, left exclusive, right inclusive range.

See Also:
Constant Field Values

TYPE_DEI

public static final int TYPE_DEI
Composite flag for a descending, left exclusive, right inclusive range.

See Also:
Constant Field Values

TYPE_AIE

public static final int TYPE_AIE
Composite flag for an ascending, left inclusive, right exclusive range.

See Also:
Constant Field Values

TYPE_DIE

public static final int TYPE_DIE
Composite flag for a descending, left inclusive, right exclusive range.

See Also:
Constant Field Values

TYPE_AEE

public static final int TYPE_AEE
Composite flag for an ascending, left and right exclusive range.

See Also:
Constant Field Values

TYPE_DEE

public static final int TYPE_DEE
Composite flag for a descending, left and right exclusive range.

See Also:
Constant Field Values
Method Detail

index

public void index()
Perform an initial indexing of a data column.


dispose

public void dispose()
Dispose of an index, deregistering all listeners.


getComparator

public java.util.Comparator getComparator()
Get the comparator used to compare column data values.

Returns:
the sort comparator

minimum

public int minimum()
Get the row (or one of the rows) with the minimum data value.

Returns:
a row with a minimum data value

maximum

public int maximum()
Get the row (or one of the rows) with the maximum data value.

Returns:
a row with a maximum data value

median

public int median()
Get the row (or one of the rows) with the median data value.

Returns:
a row with a median data value

uniqueCount

public int uniqueCount()
Get the number of unique data values in the index.

Returns:
the number of unique data values

size

public int size()
Get the size of this index, the number of data value / row pairs included.

Returns:
the size of the index

allRows

public IntIterator allRows(int type)
Get an iterator over all rows in the index, in sorted order.

Parameters:
type - the sort type, one of TYPE_ASCENDING or TYPE_DESCENDING.
Returns:
an iterator over all rows in the index

rows

public IntIterator rows(java.lang.Object lo,
                        java.lang.Object hi,
                        int type)
Get an iterator over a sorted range of rows.

Parameters:
lo - the minimum data value
hi - the maximum data value
type - the iteration type, one of the composite flags involving both a sort order, and whether each bound of the range should inclusive or exclusive
Returns:
an iterator over a sorted range of rows

rows

public IntIterator rows(int lo,
                        int hi,
                        int type)
Get an iterator over a sorted range of rows.

Parameters:
lo - the minimum data value
hi - the maximum data value
type - the iteration type, one of the composite flags involving both a sort order, and whether each bound of the range should inclusive or exclusive
Returns:
an iterator over a sorted range of rows

rows

public IntIterator rows(long lo,
                        long hi,
                        int type)
Get an iterator over a sorted range of rows.

Parameters:
lo - the minimum data value
hi - the maximum data value
type - the iteration type, one of the composite flags involving both a sort order, and whether each bound of the range should inclusive or exclusive
Returns:
an iterator over a sorted range of rows

rows

public IntIterator rows(float lo,
                        float hi,
                        int type)
Get an iterator over a sorted range of rows.

Parameters:
lo - the minimum data value
hi - the maximum data value
type - the iteration type, one of the composite flags involving both a sort order, and whether each bound of the range should inclusive or exclusive
Returns:
an iterator over a sorted range of rows

rows

public IntIterator rows(double lo,
                        double hi,
                        int type)
Get an iterator over a sorted range of rows.

Parameters:
lo - the minimum data value
hi - the maximum data value
type - the iteration type, one of the composite flags involving both a sort order, and whether each bound of the range should inclusive or exclusive
Returns:
an iterator over a sorted range of rows

rows

public IntIterator rows(java.lang.Object val)
Get an iterator over all rows with the given data value.

Parameters:
val - the data value
Returns:
an iterator over all rows matching the data value

rows

public IntIterator rows(int val)
Get an iterator over all rows with the given data value.

Parameters:
val - the data value
Returns:
an iterator over all rows matching the data value

rows

public IntIterator rows(long val)
Get an iterator over all rows with the given data value.

Parameters:
val - the data value
Returns:
an iterator over all rows matching the data value

rows

public IntIterator rows(float val)
Get an iterator over all rows with the given data value.

Parameters:
val - the data value
Returns:
an iterator over all rows matching the data value

rows

public IntIterator rows(double val)
Get an iterator over all rows with the given data value.

Parameters:
val - the data value
Returns:
an iterator over all rows matching the data value

rows

public IntIterator rows(boolean val)
Get an iterator over all rows with the given data value.

Parameters:
val - the data value
Returns:
an iterator over all rows matching the data value

get

public int get(java.lang.Object x)
Get the first row found with the given data value.

Parameters:
x - the data value
Returns:
the first row matching the data value

get

public int get(int x)
Get the first row found with the given data value.

Parameters:
x - the data value
Returns:
the first row matching the data value

get

public int get(long x)
Get the first row found with the given data value.

Parameters:
x - the data value
Returns:
the first row matching the data value

get

public int get(float x)
Get the first row found with the given data value.

Parameters:
x - the data value
Returns:
the first row matching the data value

get

public int get(double x)
Get the first row found with the given data value.

Parameters:
x - the data value
Returns:
the first row matching the data value


Copyright ? 2007 Regents of the University of California