org.carrot2.filter.trc.util
Class ArrayIndexSorter

java.lang.Object
  extended by org.carrot2.filter.trc.util.ArrayIndexSorter
All Implemented Interfaces:
Comparator

public class ArrayIndexSorter
extends Object
implements Comparator

Wrap array of double values offering sorting capabalities for indices


Field Summary
protected  boolean ascending
           
protected  double[] values
           
 
Constructor Summary
ArrayIndexSorter(double[] values)
          Construct primive
 
Method Summary
 int compare(Object o1, Object o2)
           
 boolean equals(Object obj)
           
 int[] getNonZeroIndices()
           
 int[] getSortedNonZeroIndices(boolean ascending)
           
 void sort(int[] indices, boolean ascending)
          Sort indices regarding values in the array.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

values

protected double[] values

ascending

protected boolean ascending
Constructor Detail

ArrayIndexSorter

public ArrayIndexSorter(double[] values)
Construct primive

Parameters:
values -
Method Detail

equals

public boolean equals(Object obj)
Specified by:
equals in interface Comparator
Overrides:
equals in class Object

compare

public int compare(Object o1,
                   Object o2)
Specified by:
compare in interface Comparator

getNonZeroIndices

public int[] getNonZeroIndices()

getSortedNonZeroIndices

public int[] getSortedNonZeroIndices(boolean ascending)

sort

public void sort(int[] indices,
                 boolean ascending)
Sort indices regarding values in the array.

Parameters:
indices - indices to be sorted
ascending - indicate sort order


Copyright (c) Dawid Weiss, Stanislaw Osinski