com.sun.labs.minion.classification
Class SimpleFeatureCluster

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

public class SimpleFeatureCluster
extends java.lang.Object
implements FeatureCluster

A feature cluster containing a single term and a weight assigned by a standard term weighting funciton.


Field Summary
 
Fields inherited from interface com.sun.labs.minion.classification.FeatureCluster
weightComparator
 
Constructor Summary
SimpleFeatureCluster()
           
SimpleFeatureCluster(java.lang.String name, float weight)
          Creates a SimpleFeatureCluster
SimpleFeatureCluster(WeightedFeature f)
           
 
Method Summary
 void add(Feature f)
          Adds a feature to this feature cluster
 void addWeight(float weight)
           
 void combine(WeightedFeature wf)
           
 int compareTo(FeatureCluster fc)
           
 void computeWeight(WeightingFunction f, WeightingComponents wc)
           
 FeatureCluster copy()
          Return a copy of this 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 getContents()
          Returns a set of features that are the contents of this cluster
 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 associated with this feature cluster
 java.util.Iterator 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 weight)
          Sets the weight associated with 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
 

Constructor Detail

SimpleFeatureCluster

public SimpleFeatureCluster()

SimpleFeatureCluster

public SimpleFeatureCluster(java.lang.String name,
                            float weight)
Creates a SimpleFeatureCluster


SimpleFeatureCluster

public SimpleFeatureCluster(WeightedFeature f)
Method Detail

getName

public java.lang.String getName()
Description copied from interface: FeatureCluster
Gets the name of this feature cluster.

Specified by:
getName in interface FeatureCluster
Returns:
the name

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)
Description copied from interface: FeatureCluster
Sets the name of this feature cluster.

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

getContents

public java.util.SortedSet getContents()
Description copied from interface: FeatureCluster
Returns a set of features that are the contents of this cluster

Specified by:
getContents in interface FeatureCluster

getWeight

public float getWeight()
Description copied from interface: FeatureCluster
Gets the weight associated with this feature cluster

Specified by:
getWeight in interface FeatureCluster

combine

public void combine(WeightedFeature wf)

setWeight

public void setWeight(float weight)
Description copied from interface: FeatureCluster
Sets the weight associated with this feature cluster

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

addWeight

public void addWeight(float weight)

computeWeight

public void computeWeight(WeightingFunction f,
                          WeightingComponents wc)

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 iterator()
Description copied from interface: FeatureCluster
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.

add

public void add(Feature f)
Description copied from interface: FeatureCluster
Adds a feature to this feature cluster

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

copy

public FeatureCluster copy()
Description copied from interface: FeatureCluster
Return a copy of this feature cluster

Specified by:
copy in interface FeatureCluster

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

size

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

compareTo

public int compareTo(FeatureCluster fc)
Specified by:
compareTo in interface java.lang.Comparable<FeatureCluster>

toString

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