de.fu_berlin.ties.classify.feature
Class DefaultFeature

java.lang.Object
  extended by de.fu_berlin.ties.classify.feature.Feature
      extended by de.fu_berlin.ties.classify.feature.DefaultFeature

public class DefaultFeature
extends Feature

Default implementation of the Feature class. Instances of this class are immutable and thus thread-safe.

Version:
$Revision: 1.3 $, $Date: 2004/05/31 19:13:49 $, $Author: siefkes $
Author:
Christian Siefkes

Constructor Summary
DefaultFeature(String rep)
          Creates a new instance, without storing a comment.
DefaultFeature(String rep, String myComment)
          Creates a new instance, setting the strength to 1.0.
DefaultFeature(String rep, String myComment, float myStrength)
          Creates a new instance.
 
Method Summary
 String getRepresentation()
          Returns the representation of this feature, to be used for classification.
 float getStrength()
          Returns a strength value for this feature.
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class de.fu_berlin.ties.classify.feature.Feature
equals, getComment, getFullRepresentation, getFullRepresentation, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultFeature

public DefaultFeature(String rep)
Creates a new instance, without storing a comment.

Parameters:
rep - the representation of this feature; or null to create a comment-only feature

DefaultFeature

public DefaultFeature(String rep,
                      String myComment)
Creates a new instance, setting the strength to 1.0.

Parameters:
rep - the representation of this feature; or null to create a comment-only feature
myComment - a comment on this feature or the features to follow; might be null

DefaultFeature

public DefaultFeature(String rep,
                      String myComment,
                      float myStrength)
Creates a new instance.

Parameters:
rep - the representation of this feature; or null to create a comment-only feature
myComment - a comment on this feature or the features to follow; might be null
myStrength - The strenght of this feature -- higher values might indicate more important or more frequent features
Method Detail

getRepresentation

public String getRepresentation()
Returns the representation of this feature, to be used for classification.

Specified by:
getRepresentation in class Feature
Returns:
the feature representation, or null if this feature contains only a comment

getStrength

public float getStrength()
Returns a strength value for this feature.

This method is non-public because it should only be accessed through FeatureVector.strength(Feature) to allow feature vectors to modify the strenghts of the stored features.

Overrides:
getStrength in class Feature
Returns:
a strength value for this feature

toString

public String toString()
Returns a string representation of this object.

Overrides:
toString in class Feature
Returns:
a textual representation


Copyright © 2003-2004 Christian Siefkes. All Rights Reserved.