netkit.graph
Class AttributeExpandableCategorical

java.lang.Object
  extended by netkit.graph.Attribute
      extended by netkit.graph.AttributeCategorical
          extended by netkit.graph.AttributeExpandableCategorical
Direct Known Subclasses:
AttributeKey

public class AttributeExpandableCategorical
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 mutable during the lifetime of this container in that more tokens can be added. However existing tokens cannot be changed or removed.

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

Field Summary
 
Fields inherited from class netkit.graph.AttributeCategorical
tokenSet
 
Constructor Summary
  AttributeExpandableCategorical(java.lang.String name)
          The constructor must be provided the name of this attribute.
protected AttributeExpandableCategorical(java.lang.String name, ExpandableTokenSet tokenSet)
          The constructor must be provided the name of this attribute and an ExpandableTokenSet to keep track of tokens.
 
Method Summary
 void addToken(java.lang.String token)
          Adds the supplied token parameter to the set of valid tokens for this attribute.
 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

AttributeExpandableCategorical

protected AttributeExpandableCategorical(java.lang.String name,
                                         ExpandableTokenSet tokenSet)
The constructor must be provided the name of this attribute and an ExpandableTokenSet to keep track of tokens.

Parameters:
name - a String representing the name of this attribute.
tokenSet - an ExpandableTokenSet representing the valid tokens of this attribute.

AttributeExpandableCategorical

public AttributeExpandableCategorical(java.lang.String name)
The constructor must be provided the name of this attribute.

Parameters:
name - a String representing the name of this attribute.
Method Detail

addToken

public void addToken(java.lang.String token)
Adds the supplied token parameter to the set of valid tokens for this attribute.

Parameters:
token - a String to add to the list of valid tokens.
Throws:
java.lang.RuntimeException - if the token token already exists in the set.

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.