org.jcoderz.commons.types.samples
Class TestFixPoint

java.lang.Object
  extended by java.lang.Number
      extended by org.jcoderz.commons.types.samples.TestFixPoint
All Implemented Interfaces:
Serializable, Comparable, FixPointNumber, StrongType

public final class TestFixPoint
extends Number
implements Comparable, FixPointNumber, Serializable

Fix point numeric to represent TestFixPoint.

Permitted values range from -9999999.999 to 9999999.999. It the number of decimal digits supported is 3 and the total number of digits is 10

Instances of this class are immutable.

Author:
generated
See Also:
Serialized Form

Field Summary
static long DECIMAL_SCALE
          The scale (1000).
static int FRACTION_DIGITS
          The number of fraction digits (3).
static Integer FRACTION_DIGITS_AS_INTEGER
          The number of fraction digits as integer (3).
static TestFixPoint MAX_VALUE
          The maximal value of TestFixPoint (9999999.999).
static long MAX_VALUE_SCALED
          The maximal scaled value of TestFixPoint (9999999L).
static long MAX_VALUE_UNSCALED
          The maximal value of TestFixPoint (9999999999L).
static TestFixPoint MIN_VALUE
          The minimal value of TestFixPoint (-9999999.999).
static long MIN_VALUE_SCALED
          The minimal scaled value of TestFixPoint (-9999999L).
static long MIN_VALUE_UNSCALED
          The minimal unscaled value of TestFixPoint (-9999999999L).
static String PREFERED_DATABASE_TYPE
          The preffered database representation of this type.
static int SCALE
          The number of fraction digits (3).
static int TOTAL_DIGITS
          The maximum number of digits (10).
static Integer TOTAL_DIGITS_AS_INTEGER
          The maximum number of digits as Integer (10).
static String TYPE_NAME
          TestFixPoint - the name of this type as String constant.
 
Method Summary
 int compareTo(Object o)
          
 double doubleValue()
          
 boolean equals(Object obj)
          
 float floatValue()
          
static TestFixPoint fromString(String str)
          Creates a TestFixPoint object from the String representation.
 int hashCode()
          
 int intValue()
          
 long longValue()
          
 BigDecimal toBigDecimal()
          Returns the BigDecimal representation of this TestFixPoint.
 String toString()
          Returns the String representation of this TestFixPoint.
 long unscaledLongValue()
          Returns the unscaled long value of this TestFixPoint.
static TestFixPoint valueOf(BigDecimal bd)
          Translates a BigDecimal value into a TestFixPoint.
static TestFixPoint valueOf(long val)
          Translates a long value into a TestFixPoint.
static TestFixPoint valueOf(long unscaledVal, int scale)
          Translates a long with the given scale into a TestFixPoint.
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_NAME

public static final String TYPE_NAME
TestFixPoint - the name of this type as String constant.

See Also:
Constant Field Values

PREFERED_DATABASE_TYPE

public static final String PREFERED_DATABASE_TYPE
The preffered database representation of this type.

See Also:
Constant Field Values

MIN_VALUE_UNSCALED

public static final long MIN_VALUE_UNSCALED
The minimal unscaled value of TestFixPoint (-9999999999L).

See Also:
Constant Field Values

MAX_VALUE_UNSCALED

public static final long MAX_VALUE_UNSCALED
The maximal value of TestFixPoint (9999999999L).

See Also:
Constant Field Values

FRACTION_DIGITS

public static final int FRACTION_DIGITS
The number of fraction digits (3).

See Also:
Constant Field Values

SCALE

public static final int SCALE
The number of fraction digits (3).

See Also:
Constant Field Values

DECIMAL_SCALE

public static final long DECIMAL_SCALE
The scale (1000).

See Also:
Constant Field Values

MIN_VALUE_SCALED

public static final long MIN_VALUE_SCALED
The minimal scaled value of TestFixPoint (-9999999L).

See Also:
Constant Field Values

MAX_VALUE_SCALED

public static final long MAX_VALUE_SCALED
The maximal scaled value of TestFixPoint (9999999L).

See Also:
Constant Field Values

FRACTION_DIGITS_AS_INTEGER

public static final Integer FRACTION_DIGITS_AS_INTEGER
The number of fraction digits as integer (3).


TOTAL_DIGITS

public static final int TOTAL_DIGITS
The maximum number of digits (10).

See Also:
Constant Field Values

TOTAL_DIGITS_AS_INTEGER

public static final Integer TOTAL_DIGITS_AS_INTEGER
The maximum number of digits as Integer (10).


MIN_VALUE

public static final TestFixPoint MIN_VALUE
The minimal value of TestFixPoint (-9999999.999).


MAX_VALUE

public static final TestFixPoint MAX_VALUE
The maximal value of TestFixPoint (9999999.999).

Method Detail

fromString

public static TestFixPoint fromString(String str)
                               throws ArgumentMalformedException
Creates a TestFixPoint object from the String representation.

Parameters:
str - The str representation of the TestFixPoint to be returned.
Returns:
The TestFixPoint object represented by this str.
Throws:
ArgumentMalformedException - If the given String violates the restriction of the TestFixPoint type.

valueOf

public static TestFixPoint valueOf(BigDecimal bd)
Translates a BigDecimal value into a TestFixPoint.

Parameters:
bd - the BigDecimal.
Returns:
a TestFixPoint whose value is equal to bd.
Throws:
ArgumentMalformedException - If the given BigDecimal violates the restriction of the TestFixPoint type.

valueOf

public static TestFixPoint valueOf(long val)
Translates a long value into a TestFixPoint.

Parameters:
val - the long.
Returns:
a TestFixPoint whose value is equal to the given long.
Throws:
ArgumentMalformedException - If the given long violates the restriction of the TestFixPoint type.
See Also:
BigDecimal.valueOf(long)

valueOf

public static TestFixPoint valueOf(long unscaledVal,
                                   int scale)
Translates a long with the given scale into a TestFixPoint.

Parameters:
unscaledVal - the unscaled value.
scale - the scale to be applied.
Returns:
a TestFixPoint whose value is (unscaledVal × 10-scale).
Throws:
ArgumentMalformedException - If the given long and scale violates the restriction of the TestFixPoint type.
See Also:
BigDecimal.valueOf(long, int)

unscaledLongValue

public long unscaledLongValue()
Returns the unscaled long value of this TestFixPoint. The actual value is the returned value / DECIMAL_SCALE.

Specified by:
unscaledLongValue in interface FixPointNumber
Returns:
The unscaled long value of this TestFixPoint.

toString

public String toString()
Returns the String representation of this TestFixPoint. The implementation does not apply any localization rules.

Overrides:
toString in class Object
Returns:
The String representation of this TestFixPoint.
See Also:
BigDecimal.toString()

toBigDecimal

public BigDecimal toBigDecimal()
Returns the BigDecimal representation of this TestFixPoint.

Specified by:
toBigDecimal in interface FixPointNumber
Returns:
The BigDecimal representation of this TestFixPoint.

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

doubleValue

public double doubleValue()

Specified by:
doubleValue in class Number

floatValue

public float floatValue()

Specified by:
floatValue in class Number

intValue

public int intValue()

Specified by:
intValue in class Number

longValue

public long longValue()

Specified by:
longValue in class Number

compareTo

public int compareTo(Object o)

Specified by:
compareTo in interface Comparable


Copyright 2007 The jCoderZ Project.