edu.cmu.minorthird.classify
Class FeatureFactory.CompactInstance

java.lang.Object
  extended by edu.cmu.minorthird.classify.AbstractInstance
      extended by edu.cmu.minorthird.classify.FeatureFactory.CompactInstance
All Implemented Interfaces:
HasSubpopulationId, Instance, Visible, java.io.Serializable
Enclosing class:
FeatureFactory

protected class FeatureFactory.CompactInstance
extends AbstractInstance
implements java.io.Serializable

A compact but immutable implementation of an instance.

Author:
wcohen, ksteppe
See Also:
Serialized Form

Nested Class Summary
 class FeatureFactory.CompactInstance.FeatureArrayIterator
          a looper over a feature array with Feature.Looper type
 class FeatureFactory.CompactInstance.UnionFeatureArrayIterator
          sequential composite of n FeatureArrayLoopers (constructor for 2)
 
Field Summary
 
Fields inherited from class edu.cmu.minorthird.classify.AbstractInstance
source, subpopulationId
 
Constructor Summary
FeatureFactory.CompactInstance(Instance instance)
          Create a compact instance from some other instance
 
Method Summary
 java.util.Iterator<Feature> binaryFeatureIterator()
          Return an iterator over all binary features.
 java.util.Iterator<Feature> featureIterator()
          Return an iterator over all features
 FeatureFactory getFactory()
           
 double getWeight(Feature f)
          Get the weight assigned to a feature in this instance.
 java.util.Iterator<Feature> numericFeatureIterator()
          Return an iterator over all numeric features.
 int numFeatures()
          Return the number of all the features
 java.lang.String toString()
          Debugging view of an instance.
 
Methods inherited from class edu.cmu.minorthird.classify.AbstractInstance
getSource, getSubpopulationId, toGUI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FeatureFactory.CompactInstance

public FeatureFactory.CompactInstance(Instance instance)
Create a compact instance from some other instance

Parameters:
instance - Instance object to generate from
Method Detail

getFactory

public FeatureFactory getFactory()

getWeight

public double getWeight(Feature f)
Description copied from interface: Instance
Get the weight assigned to a feature in this instance.

Specified by:
getWeight in interface Instance

binaryFeatureIterator

public java.util.Iterator<Feature> binaryFeatureIterator()
Description copied from interface: Instance
Return an iterator over all binary features.

Specified by:
binaryFeatureIterator in interface Instance

numericFeatureIterator

public java.util.Iterator<Feature> numericFeatureIterator()
Description copied from interface: Instance
Return an iterator over all numeric features.

Specified by:
numericFeatureIterator in interface Instance

featureIterator

public java.util.Iterator<Feature> featureIterator()
Description copied from interface: Instance
Return an iterator over all features

Specified by:
featureIterator in interface Instance

numFeatures

public int numFeatures()
Description copied from interface: Instance
Return the number of all the features

Specified by:
numFeatures in interface Instance

toString

public java.lang.String toString()
Description copied from class: AbstractInstance
Debugging view of an instance.

Overrides:
toString in class AbstractInstance