com.sun.labs.minion.classification
Class ContingencyFeatureCluster

java.lang.Object
  extended by com.sun.labs.minion.classification.ContingencyFeatureCluster
All Implemented Interfaces:
FeatureCluster, java.lang.Comparable<FeatureCluster>, java.lang.Iterable<Feature>

public class ContingencyFeatureCluster
extends java.lang.Object
implements FeatureCluster

A cluster of contingency features


Field Summary
protected  java.util.List<Feature> contents
          A set to hold the contents of this cluster
protected  ContingencyFeature counter
          A counter for adding up the a,b,c,d values and calculating the final weight
protected  java.util.Set<java.lang.Integer> docIDs
           
protected static java.lang.String logTag
           
protected  java.lang.String name
          The name of this cluster
protected  java.util.Map<java.lang.Integer,Feature> quickIDMap
           
protected  java.util.Map<java.lang.String,Feature> quickNameMap
           
 
Fields inherited from interface com.sun.labs.minion.classification.FeatureCluster
weightComparator
 
Constructor Summary
ContingencyFeatureCluster()
           
ContingencyFeatureCluster(java.lang.String name)
           
 
Method Summary
 void add(Feature f)
          Add another feature to this cluster, incrementing the counts associated with it.
 int compareTo(FeatureCluster fc)
          Compares to feature clusters on the basis of their names
 FeatureCluster copy()
          Create a new feature cluster that is a copy of the given feature cluster.
 Feature get(int id)
          Gets the feature with the given id out of this cluster.
 Feature get(java.lang.String name)
          Gets the feature with the given name out of this cluster.
 java.util.SortedSet<Feature> getContents()
          Gets the contents of the feature cluster.
 ContingencyFeature getCounter()
           
 java.lang.String getHumanReadableName()
          Gets a human-readable (for example, non-stemmed) name for this cluster.
 java.lang.String getName()
          Gets the name of this feature cluster.
 float getWeight()
          Gets the weight of this feature cluster.
protected  void innerAdd(Feature f)
           
 java.util.Iterator<Feature> iterator()
          Gets an iterator for the contents of this cluster.
 void merge(FeatureCluster other)
          Merge another feature cluster into this one, preventing duplicates.
 void setName(java.lang.String name)
          Sets the name of this feature cluster.
 void setWeight(float w)
          Sets the weight of this feature cluster.
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

contents

protected java.util.List<Feature> contents
A set to hold the contents of this cluster


name

protected java.lang.String name
The name of this cluster


logTag

protected static java.lang.String logTag

counter

protected ContingencyFeature counter
A counter for adding up the a,b,c,d values and calculating the final weight


quickIDMap

protected java.util.Map<java.lang.Integer,Feature> quickIDMap

quickNameMap

protected java.util.Map<java.lang.String,Feature> quickNameMap

docIDs

protected java.util.Set<java.lang.Integer> docIDs
Constructor Detail

ContingencyFeatureCluster

public ContingencyFeatureCluster()

ContingencyFeatureCluster

public ContingencyFeatureCluster(java.lang.String name)
Method Detail

copy

public FeatureCluster copy()
Create a new feature cluster that is a copy of the given feature cluster.

Specified by:
copy in interface FeatureCluster

add

public void add(Feature f)
Add another feature to this cluster, incrementing the counts associated with it.

Specified by:
add in interface FeatureCluster
Parameters:
f - the feature to add

innerAdd

protected void innerAdd(Feature f)

merge

public void merge(FeatureCluster other)
Description copied from interface: FeatureCluster
Merge another feature cluster into this one, preventing duplicates.

Specified by:
merge in interface FeatureCluster
Parameters:
other - the other cluster

getContents

public java.util.SortedSet<Feature> getContents()
Gets the contents of the feature cluster.

Specified by:
getContents in interface FeatureCluster
Returns:
the features in the cluster

get

public Feature get(java.lang.String name)
Description copied from interface: FeatureCluster
Gets the feature with the given name out of this cluster.

Specified by:
get in interface FeatureCluster
Parameters:
name - the feature name
Returns:
the feature with the given name

get

public Feature get(int id)
Description copied from interface: FeatureCluster
Gets the feature with the given id out of this cluster. This method assumes that only one feature will have the given id.

Specified by:
get in interface FeatureCluster
Parameters:
id - the feature id
Returns:
the feature with the given id

iterator

public java.util.Iterator<Feature> iterator()
Gets an iterator for the contents of this cluster.

Specified by:
iterator in interface FeatureCluster
Specified by:
iterator in interface java.lang.Iterable<Feature>
Returns:
an iterator for the contents of this cluster.

compareTo

public int compareTo(FeatureCluster fc)
Compares to feature clusters on the basis of their names

Specified by:
compareTo in interface java.lang.Comparable<FeatureCluster>

getName

public java.lang.String getName()
Gets the name of this feature cluster.

Specified by:
getName in interface FeatureCluster
Returns:
the name of the cluster

getHumanReadableName

public java.lang.String getHumanReadableName()
Description copied from interface: FeatureCluster
Gets a human-readable (for example, non-stemmed) name for this cluster.

Specified by:
getHumanReadableName in interface FeatureCluster

setName

public void setName(java.lang.String name)
Sets the name of this feature cluster.

Specified by:
setName in interface FeatureCluster
Parameters:
name - the new name

getWeight

public float getWeight()
Gets the weight of this feature cluster.

Specified by:
getWeight in interface FeatureCluster
Returns:
the weight

getCounter

public ContingencyFeature getCounter()

setWeight

public void setWeight(float w)
Sets the weight of this feature cluster.

Specified by:
setWeight in interface FeatureCluster
Parameters:
w - the new weight

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

size

public int size()
Specified by:
size in interface FeatureCluster