com.phoenix_int.aserver.types
Class PHXDouble

java.lang.Object
  extended by com.phoenix_int.aserver.types.PHXSimpleType
      extended by com.phoenix_int.aserver.types.PHXDouble
All Implemented Interfaces:
IPHXFormat, IPHXType, IPHXType2, IPHXUnits

public class PHXDouble
extends PHXSimpleType
implements IPHXFormat

The Phoenix type for doubles. This class adds the following features to the PHXSimpleType:

If the variable has an upper or lower bound and an attempt is made to store an invalid value, then an exception will be thrown.

See Also:
PHXSimpleType

Constructor Summary
PHXDouble()
          initializes value to zero without upper or lower bounds
 
Method Summary
static java.lang.String arrayToString(double[] sa)
           
 void fromString(java.lang.String value)
          converts a String representation to the internal value
 void fromString2(PHXStringBuffer value)
          converts a PHXStringBuffer representation to the internal value
 java.lang.String[] getEnumAliases()
          An interface function for the enumeration array
 java.lang.String getEnumAliasesStr()
          An interface function for the enumeration array
 double[] getEnumValues()
          An interface function for the enumeration array
 java.lang.String getEnumValuesStr()
          Interface function to pass out the enumeration array as a comma separated string
 java.lang.String getFormat()
          Get the format string for the variable
 boolean getHasLowerBound()
          retrieves the hasLowerBound flag
 boolean getHasUpperBound()
          retrieves the hasUpperBound flag
 double getLowerBound()
          retrieves the current lower bound value
 double getUpperBound()
          retrieves the current upper bound value
 double getValue()
          retrieves the current value of the variable
 java.lang.String getValueStr()
          retrieves the string value of this variable as passed into the last call to fromString().
 boolean hasFormat()
          Whether or not the variable has a format
 void setEnumAliases(java.lang.String values)
          takes a comma seperated string of values and fills the enumeration aliases list with values.
 void setEnumAliases(java.lang.String[] values)
          Sets the enumeration aliases list
 void setEnumValues(double[] values)
          Sets the enumeration list of valid values.
 void setEnumValues(java.lang.String values)
          takes a comma seperated string of values and fills the enumeration List with values.
 void setFormat(java.lang.String format)
          Set the format string for the variable
 void setHasLowerBound(boolean value)
          sets the hasLowerBound flag
 void setHasUpperBound(boolean value)
          sets the hasUpperBound flag
 void setIgnoreConversionErrors(boolean ignoreConversionErrors)
          indicates whether the object should accept bad values in the fromString() method without throwning an exception.
 void setLowerBound(double value)
          sets the lower bound.
 void setLowerBound(java.lang.String value)
           
 void setUpperBound(double value)
          sets the upper bound.
 void setUpperBound(java.lang.String value)
           
 void setValue(double v)
          sets the value for the variable
 java.lang.String toString()
          converts the variable to a string
 java.lang.String toString(int width)
          Converts the value to a string with the best possible formatting, e.g.
 PHXStringBuffer toString2()
          converts the variable to a PHXStringBuffer
 
Methods inherited from class com.phoenix_int.aserver.types.PHXSimpleType
addPropertyChangeListener, getDescription, getEnumTokens, getHasChanged, getUnits, removePropertyChangeListener, setDescription, setHasChanged, setUnits
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PHXDouble

public PHXDouble()
initializes value to zero without upper or lower bounds

Method Detail

getValue

public double getValue()
retrieves the current value of the variable

Returns:
the value of the variable

getValueStr

public java.lang.String getValueStr()
retrieves the string value of this variable as passed into the last call to fromString(). This may not be equivalent to the current value of the variable.

Returns:
the string last used to set the variable

setValue

public void setValue(double v)
sets the value for the variable

Parameters:
v - the value

setUpperBound

public void setUpperBound(double value)
sets the upper bound. The hasUpperBound value is set to true

Parameters:
value - the upper bound

setUpperBound

public void setUpperBound(java.lang.String value)

getUpperBound

public double getUpperBound()
retrieves the current upper bound value

Returns:
the upper bound

setLowerBound

public void setLowerBound(double value)
sets the lower bound. The hasLowerBound value is set to true

Parameters:
value - the lower bound

setLowerBound

public void setLowerBound(java.lang.String value)

getLowerBound

public double getLowerBound()
retrieves the current lower bound value

Returns:
the lower bound

setHasUpperBound

public void setHasUpperBound(boolean value)
sets the hasUpperBound flag

Parameters:
value - true or false

getHasUpperBound

public boolean getHasUpperBound()
retrieves the hasUpperBound flag

Returns:
true or false

setHasLowerBound

public void setHasLowerBound(boolean value)
sets the hasLowerBound flag

Parameters:
value - true or false

getHasLowerBound

public boolean getHasLowerBound()
retrieves the hasLowerBound flag

Returns:
true or false

toString2

public PHXStringBuffer toString2()
converts the variable to a PHXStringBuffer

Specified by:
toString2 in interface IPHXType2
Returns:
the PHXStringBuffer representation of the variable

toString

public java.lang.String toString()
converts the variable to a string

Specified by:
toString in interface IPHXType
Overrides:
toString in class java.lang.Object
Returns:
a String representation of the variable

fromString2

public void fromString2(PHXStringBuffer value)
converts a PHXStringBuffer representation to the internal value

Specified by:
fromString2 in interface IPHXType2
Parameters:
value - the value to convert

fromString

public void fromString(java.lang.String value)
converts a String representation to the internal value

Specified by:
fromString in interface IPHXType
Parameters:
value - the value to convert

toString

public java.lang.String toString(int width)
                          throws PHXNumberFormatException
Converts the value to a string with the best possible formatting, e.g. scientific or absolute values based on the width available.

Parameters:
width - the number of characters print to
Returns:
the formatted string value
Throws:
PHXNumberFormatException

setIgnoreConversionErrors

public void setIgnoreConversionErrors(boolean ignoreConversionErrors)
indicates whether the object should accept bad values in the fromString() method without throwning an exception. The raw values is stored in property valueStr regardless.

Parameters:
ignoreConversionErrors - true if errors should be ignored

setEnumValues

public void setEnumValues(java.lang.String values)
takes a comma seperated string of values and fills the enumeration List with values.

Parameters:
values - A comma seperrated string of enumeration values

setEnumValues

public void setEnumValues(double[] values)
Sets the enumeration list of valid values.

Parameters:
values - An array of double values

getEnumValues

public double[] getEnumValues()
An interface function for the enumeration array

Returns:
an array of the possible values of the list

getEnumValuesStr

public java.lang.String getEnumValuesStr()
Interface function to pass out the enumeration array as a comma separated string

Returns:
comma separated string of the possible values of the list

setEnumAliases

public void setEnumAliases(java.lang.String values)
takes a comma seperated string of values and fills the enumeration aliases list with values.

Parameters:
values - A comma seperated string of enumeration aliases

setEnumAliases

public void setEnumAliases(java.lang.String[] values)
Sets the enumeration aliases list

Parameters:
values - An array of strings

getEnumAliases

public java.lang.String[] getEnumAliases()
An interface function for the enumeration array

Returns:
an array of the possible values of the list

getEnumAliasesStr

public java.lang.String getEnumAliasesStr()
An interface function for the enumeration array

Returns:
an comma separated string of the possible values of the list

setFormat

public void setFormat(java.lang.String format)
Set the format string for the variable

Specified by:
setFormat in interface IPHXFormat
Parameters:
format - format string

getFormat

public java.lang.String getFormat()
Get the format string for the variable

Specified by:
getFormat in interface IPHXFormat
Returns:
format string

hasFormat

public boolean hasFormat()
Whether or not the variable has a format

Specified by:
hasFormat in interface IPHXFormat
Returns:
true if variable has a format

arrayToString

public static java.lang.String arrayToString(double[] sa)