com.devexperts.qd.kit
Class DecimalField

java.lang.Object
  extended by com.devexperts.qd.kit.AbstractDataField
      extended by com.devexperts.qd.kit.AbstractDataIntField
          extended by com.devexperts.qd.kit.CompactIntField
              extended by com.devexperts.qd.kit.DecimalField
All Implemented Interfaces:
DataField, DataIntField

public class DecimalField
extends CompactIntField

The DecimalField represents a decimal field with compact serialized form. See Decimal for description of internal representation. It can be used for fields which are usually represented with floating point values, such as prices, amounts, etc.


Constructor Summary
DecimalField(int index, java.lang.String name)
           
DecimalField(int index, java.lang.String name, SerialFieldType serialType)
           
 
Method Summary
 int parseString(java.lang.String value)
          Parses string representation of specified field value.
 double toDouble(int value)
          Converts raw QD int-value to meaningful double value, or to Double.NaN if inapplicable.
 int toInt(double value)
          Converts meaningful double value to raw QD int-value, or to 0 if inapplicable.
 java.lang.String toString(int value)
          Returns string representation of specified field value.
 
Methods inherited from class com.devexperts.qd.kit.CompactIntField
readInt, readInt, writeInt, writeInt
 
Methods inherited from class com.devexperts.qd.kit.AbstractDataIntField
equals
 
Methods inherited from class com.devexperts.qd.kit.AbstractDataField
getIndex, getLocalName, getName, getRecord, getSerialType, setRecord, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.devexperts.qd.DataField
getIndex, getLocalName, getName, getRecord, getSerialType
 

Constructor Detail

DecimalField

public DecimalField(int index,
                    java.lang.String name)

DecimalField

public DecimalField(int index,
                    java.lang.String name,
                    SerialFieldType serialType)
Method Detail

toString

public java.lang.String toString(int value)
Description copied from class: AbstractDataIntField
Returns string representation of specified field value. This method is used for debugging purposes. This implementation returns Integer.toString(value).

Specified by:
toString in interface DataIntField
Overrides:
toString in class AbstractDataIntField

parseString

public int parseString(java.lang.String value)
Description copied from class: AbstractDataIntField
Parses string representation of specified field value. This method is used for debugging purposes. This implementation returns Integer.parseInt(value).

Specified by:
parseString in interface DataIntField
Overrides:
parseString in class AbstractDataIntField

toDouble

public double toDouble(int value)
Description copied from class: AbstractDataIntField
Converts raw QD int-value to meaningful double value, or to Double.NaN if inapplicable.

Specified by:
toDouble in interface DataIntField
Overrides:
toDouble in class AbstractDataIntField

toInt

public int toInt(double value)
Description copied from class: AbstractDataIntField
Converts meaningful double value to raw QD int-value, or to 0 if inapplicable.

Specified by:
toInt in interface DataIntField
Overrides:
toInt in class AbstractDataIntField