dragon.ml.seqmodel.feature
Class BasicFeature

java.lang.Object
  |
  +--dragon.ml.seqmodel.feature.BasicFeature
All Implemented Interfaces:
Feature

public class BasicFeature
extends java.lang.Object
implements Feature

Basic data structure for feature data

Copyright: Copyright (c) 2005

Company: IST, Drexel University

Version:
1.0
Author:
Davis Zhou

Constructor Summary
BasicFeature()
           
BasicFeature(BasicFeature f)
           
BasicFeature(FeatureIdentifier id, int label, double val)
           
BasicFeature(FeatureIdentifier id, int prevLabel, int label, double val)
           
BasicFeature(java.lang.String id, int label, double val)
           
BasicFeature(java.lang.String id, int prevLabel, int label, double val)
           
 
Method Summary
 Feature copy()
          Gets a copy of the current feature
 void copyFrom(BasicFeature f)
           
 FeatureIdentifier getID()
          One can quickly find out the index of the current feature according to its unique identifier
 int getIndex()
          The index of this feature from 0..numFeatures-1.
 int getLabel()
          has to be a label index from 0..numLabels-1
 int getPrevLabel()
          can be -1 if the feature is a state rather than an edge feature
 double getValue()
           
 void setID(FeatureIdentifier id)
          Sets the identitifer
 void setIndex(int index)
          Sets the index of the feature
 void setLabel(int label)
          Sets the label of the current feature
 void setPrevLabel(int prevLabel)
          Sets the label of the starting state of an edge feature if the current feature is an edge feature.
 void setValue(double val)
          Sets the value to the feature
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicFeature

public BasicFeature()

BasicFeature

public BasicFeature(java.lang.String id,
                    int label,
                    double val)

BasicFeature

public BasicFeature(FeatureIdentifier id,
                    int label,
                    double val)

BasicFeature

public BasicFeature(java.lang.String id,
                    int prevLabel,
                    int label,
                    double val)

BasicFeature

public BasicFeature(FeatureIdentifier id,
                    int prevLabel,
                    int label,
                    double val)

BasicFeature

public BasicFeature(BasicFeature f)
Method Detail

copyFrom

public void copyFrom(BasicFeature f)

copy

public Feature copy()
Description copied from interface: Feature
Gets a copy of the current feature

Specified by:
copy in interface Feature
Returns:
the copy the current feature

getIndex

public int getIndex()
Description copied from interface: Feature
The index of this feature from 0..numFeatures-1.

Specified by:
getIndex in interface Feature
Returns:
the index of the feature

setIndex

public void setIndex(int index)
Description copied from interface: Feature
Sets the index of the feature

Specified by:
setIndex in interface Feature
Parameters:
index - the index of the feature

getLabel

public int getLabel()
Description copied from interface: Feature
has to be a label index from 0..numLabels-1

Specified by:
getLabel in interface Feature
Returns:
the label of the feature

setLabel

public void setLabel(int label)
Description copied from interface: Feature
Sets the label of the current feature

Specified by:
setLabel in interface Feature
Parameters:
label - the label of the feature

getPrevLabel

public int getPrevLabel()
Description copied from interface: Feature
can be -1 if the feature is a state rather than an edge feature

Specified by:
getPrevLabel in interface Feature
Returns:
the label of the starting state of an edge feature, otherwise -1

setPrevLabel

public void setPrevLabel(int prevLabel)
Description copied from interface: Feature
Sets the label of the starting state of an edge feature if the current feature is an edge feature.

Specified by:
setPrevLabel in interface Feature
Parameters:
prevLabel - the label of the starting state of an edge feature

getValue

public double getValue()
Specified by:
getValue in interface Feature
Returns:
the value of feature

setValue

public void setValue(double val)
Description copied from interface: Feature
Sets the value to the feature

Specified by:
setValue in interface Feature
Parameters:
val - the value of the feature

toString

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

getID

public FeatureIdentifier getID()
Description copied from interface: Feature
One can quickly find out the index of the current feature according to its unique identifier

Specified by:
getID in interface Feature
Returns:
the feature identifier of the current feature

setID

public void setID(FeatureIdentifier id)
Description copied from interface: Feature
Sets the identitifer

Specified by:
setID in interface Feature
Parameters:
id - the feature identifier