netkit.graph
Class AttributeContinuous

java.lang.Object
  extended by netkit.graph.Attribute
      extended by netkit.graph.AttributeContinuous

public final class AttributeContinuous
extends Attribute

This class handles attributes that are of type CONTINUOUS. CONTINUOUS types can have real numerical values and are represented internally as java double types. This class is immutable.

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

Constructor Summary
AttributeContinuous(java.lang.String name)
          The constructor must be provided the name for this attribute.
 
Method Summary
 java.lang.String formatForOutput(double value)
          Formats the supplied value from this attribute as a String for output.
 double parseAndInsert(java.lang.String token)
          Parses the supplied string token for insertion into this attribute and converts the token into a double value; a "?" token results in NaN.
 
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

AttributeContinuous

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

Parameters:
name - a String representing the name of 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; a "?" token 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.NumberFormatException - if the token does not contain a parsable double.

formatForOutput

public java.lang.String formatForOutput(double value)
Description copied from class: Attribute
Formats the supplied value from this attribute as a String for output. Subclasses will supply their own mechanism for conversion.

Specified by:
formatForOutput in class Attribute
Parameters:
value - a double to be converted into an output String.
Returns:
a String representing the supplied value.