de.fu_berlin.ties.context
Class GlobalFeature

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

public class GlobalFeature
extends Feature

An immutable representation of a feature that can be used for classification.

Version:
$Revision: 1.7 $, $Date: 2006/10/21 16:04:03 $, $Author: siefkes $
Author:
Christian Siefkes

Field Summary
static String SEP
          Separator string between axis and element names, used if neither or them is empty.
 
Constructor Summary
GlobalFeature(String myComment)
          Creates a new instance that contains only a comment.
GlobalFeature(String axisPrefix, LocalFeature local)
          Creates a new instance that combines a local feature with an axis prefix.
 
Method Summary
 String getComment()
          Returns the comment attached to this feature, if any.
 LocalFeature getLocalFeature()
          Returns the local feature wrapped by this global feature.
 String getRepresentation()
          Returns the representation of this feature, to be used for classification.
static void globalize(String axisName, Iterator<LocalFeature> localIter, LinkedList<Feature> globalFeatures, boolean addAtEnd)
          Converts a series of LocalFeatures into global features, adding the created global features to a linked list.
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class de.fu_berlin.ties.classify.feature.Feature
compactRepresentation, equals, getFullRepresentation, getFullRepresentation, getUserData, hashCode, setUserData
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SEP

public static final String SEP
Separator string between axis and element names, used if neither or them is empty.

See Also:
Constant Field Values
Constructor Detail

GlobalFeature

public GlobalFeature(String axisPrefix,
                     LocalFeature local)
Creates a new instance that combines a local feature with an axis prefix.

Parameters:
axisPrefix - the axis prefix wrapped by this feature
local - the local feature wrapped by this global feature

GlobalFeature

public GlobalFeature(String myComment)
Creates a new instance that contains only a comment.

Parameters:
myComment - a comment on the features to follow, ignored for classification
Method Detail

globalize

public static void globalize(String axisName,
                             Iterator<LocalFeature> localIter,
                             LinkedList<Feature> globalFeatures,
                             boolean addAtEnd)
                      throws ClassCastException
Converts a series of LocalFeatures into global features, adding the created global features to a linked list.

Parameters:
axisName - the name of the global axis
localIter - an iterator over the local features to globalize
globalFeatures - the created global features are added to this linked list
addAtEnd - whether to add the created features at the end of at the beginning of the linked list
Throws:
ClassCastException - if the iterator refers to objects that aren't LocalFeature

getComment

public String getComment()
Returns the comment attached to this feature, if any.

Overrides:
getComment in class Feature
Returns:
the comment, or null is no comment was stored

getLocalFeature

public LocalFeature getLocalFeature()
Returns the local feature wrapped by this global feature.

Returns:
the local feature; or nullif this features doesn't wrap a local feature (but only a comment)

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

toString

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

Overrides:
toString in class Feature
Returns:
a textual representation


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