infovis.utils
Class Permutation

java.lang.Object
  extended by infovis.utils.ChangeManager
      extended by infovis.utils.Permutation
All Implemented Interfaces:
IntComparator, RowComparator, Serializable

public class Permutation
extends ChangeManager
implements RowComparator, Serializable

Maintain a permutation of indices.

Maintain two tables called direct and inverse.

The direct table usually is the result of a indirect sort over a column. It contains the index of the rows sorted in a specific order. For example, if a column containing {6, 7, 5} is sorted in ascending order, the direct table will contain {2, 0, 1}.

The inverse table contains the index of a given row. With the previous example, it contains {1, 2, 0} meaning that the index or rows {0,1,2} are {1,2,0}.

Version:
$Revision: 1.23 $
Author:
Jean-Daniel Fekete
See Also:
Serialized Form

Constructor Summary
Permutation()
           
Permutation(int size)
           
Permutation(RowIterator iter)
           
 
Method Summary
 void clear()
           
 int compare(int row1, int row2)
           
 void fillPermutation(int size)
           
 void fillPermutation(int size, RowComparator comp)
           
 void fillPermutation(int size, RowFilter filter)
           
 void fillPermutation(RowIterator iter)
           
 void filter(int row)
           
 void filter(RowComparator comp)
           
 void filter(RowFilter filter)
           
 void filter(RowIterator iter)
           
 int getDirect(int i)
          Returns the row at a specified index.
 int getDirectCount()
           
 int getInverse(int i)
          Return the index of a specified row.
 int getInverseSize()
           
 int getMaxIndex()
           
 int getMinIndex()
           
 void inverse()
           
 boolean isValueUndefined(int row)
          Returns true if the value at the specified row is undefined.
 RowIterator iterator()
           
 void recomputeInverse()
           
 RowIterator reverseIterator()
           
 void shuffle()
           
 void shuffle(int seed)
           
 int size()
          Returns the size of the direct table.
 void sort(RowComparator comp)
           
 
Methods inherited from class infovis.utils.ChangeManager
addChangeListener, disableNotify, enableNotify, getModCount, removeChangeListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cern.colt.function.IntComparator
equals
 

Constructor Detail

Permutation

public Permutation(int size)

Permutation

public Permutation(RowIterator iter)

Permutation

public Permutation()
Method Detail

clear

public void clear()

fillPermutation

public void fillPermutation(int size)

fillPermutation

public void fillPermutation(RowIterator iter)

fillPermutation

public void fillPermutation(int size,
                            RowComparator comp)

fillPermutation

public void fillPermutation(int size,
                            RowFilter filter)

shuffle

public void shuffle(int seed)

shuffle

public void shuffle()

inverse

public void inverse()

getDirect

public int getDirect(int i)
Returns the row at a specified index.

Parameters:
i - the index
Returns:
the row column at a specified index.

getDirectCount

public int getDirectCount()

getInverse

public int getInverse(int i)
Return the index of a specified row.

Parameters:
i - the row
Returns:
the index of a specified row.

recomputeInverse

public void recomputeInverse()

sort

public void sort(RowComparator comp)

filter

public void filter(RowComparator comp)

filter

public void filter(RowFilter filter)

filter

public void filter(int row)

filter

public void filter(RowIterator iter)

size

public int size()
Returns the size of the direct table.

Returns:
the size of the direct table.

getInverseSize

public int getInverseSize()

iterator

public RowIterator iterator()

reverseIterator

public RowIterator reverseIterator()

compare

public int compare(int row1,
                   int row2)
Specified by:
compare in interface IntComparator

isValueUndefined

public boolean isValueUndefined(int row)
Description copied from interface: RowComparator
Returns true if the value at the specified row is undefined.

Specified by:
isValueUndefined in interface RowComparator
Parameters:
row - the row.
Returns:
true if the value at the specified row is undefined.

getMinIndex

public int getMinIndex()

getMaxIndex

public int getMaxIndex()


Copyright © 2005 by Jean-Daniel Fekete and INRIA, France All rights reserved.