netkit.graph
Class AttributeFixedCategorical

java.lang.Object
  extended by netkit.graph.Attribute
      extended by netkit.graph.AttributeCategorical
          extended by netkit.graph.AttributeFixedCategorical

public final class AttributeFixedCategorical
extends AttributeCategorical

This class handles attributes that are of type CATEGORICAL. CATEGORICAL types can have values from a set of tokens specified by the tokenSet. The set of valid tokens is fixed at the time this container is created. This class is immutable.

Author:
Kaveh R. Ghazi
See Also:
Attributes, FixedTokenSet, SchemaReader

Field Summary
 
Fields inherited from class netkit.graph.AttributeCategorical
tokenSet
 
Constructor Summary
AttributeFixedCategorical(java.lang.String name, FixedTokenSet tokenSet)
          The constructor must be provided the name of this attribute and the set of valid categorical token values.
 
Method Summary
 double parseAndInsert(java.lang.String token)
          Parses the supplied string token for insertion into this attribute and converts the token into a double value; if the token is "?", that results in NaN.
 
Methods inherited from class netkit.graph.AttributeCategorical
formatForOutput, getToken, getTokens, getValue, size
 
Methods inherited from class netkit.graph.Attribute
getName, getType, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttributeFixedCategorical

public AttributeFixedCategorical(java.lang.String name,
                                 FixedTokenSet tokenSet)
The constructor must be provided the name of this attribute and the set of valid categorical token values.

Parameters:
name - a String representing the name of this attribute.
tokenSet - a set representing the valid categorical token values for this attribute.
Method Detail

parseAndInsert

public double parseAndInsert(java.lang.String token)
Parses the supplied string token for insertion into this attribute and converts the token into a double value; if the token is "?", that results in NaN.

Specified by:
parseAndInsert in class Attribute
Parameters:
token - the string value to parse.
Returns:
the token converted into an double.
Throws:
java.lang.RuntimeException - if the token is not already in the set of valid tokens.