Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## cc.mallet.types
Class IDSorter

    java.lang.Object
      cc.mallet.types.IDSorter

All Implemented Interfaces:
  java.lang.Comparable

    public class IDSorter

extends java.lang.Object
implements java.lang.Comparable

This class is contains a comparator for use in sorting integers that have associated floating point values. One example would be sorting words by probability in a Naive Bayes model. Ties are broken by the ID. ``

         IDSorter[] sortedIDs = new IDSorter[n];
         for (int i=0; i<n; i++) {
           sortedIDs[i] = new IDSorter(i, weights[i]);
         }
         Arrays.sort(sortedIDs);

         for (int i=0; i<10; i++) {

Author:
  David Mimno

Constructor Summary
`IDSorter(int id, double p)`
`IDSorter(int id, int p)`

Method Summary
`int` | `compareTo(java.lang.Object o2)`
`int` | `getID()`
`double` | `getWeight()`
`void` | `set(int id, double p)` Reinitialize an IDSorter

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### IDSorter

    public IDSorter(int id,
                    double p)

### IDSorter

    public IDSorter(int id,
                    int p)

Method Detail

### compareTo

    public final int compareTo(java.lang.Object o2)

  Specified by:
    `compareTo` in interface `java.lang.Comparable`

### getID

    public int getID()

### getWeight

    public double getWeight()

### set

    public void set(int id,
                    double p)

  Reinitialize an IDSorter

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD