C# Class VoltDB.Data.Client.VoltDecimal

Define the Volt-specific decimal(38,12) structure over the standard Java-like implementation of BigDecimal. Full operator support provided. Some methods removed, consistent with the fixed-sclae behavior.
All conversion and mathematical operations maintain the fixed scale at 12 digits -> some operations might lose precision or throw overflow exceptions.
ファイルを表示 Open project: VoltDB/voltdb-client-csharp Class Usage Examples

Public Properties

Property Type Description
MaxValue VoltDB.ThirdParty.Math.BigDecimal
MinValue VoltDB.ThirdParty.Math.BigDecimal
NullValue VoltDB.ThirdParty.Math.BigDecimal

Public Methods

Method Description
Equals ( object o ) : bool

Overrides Equals operator

GetHashCode ( ) : int

Returns a hashcode for the current instance.

IsVoltDBNull ( ) : bool

Returns whether the variable corresponds to a null VoltDB value.

MovePointLeft ( int n ) : VoltDecimal

Moves the decimal point to the left (essentially: divide by 10^n)

MovePointRight ( int n ) : VoltDecimal

Moves the decimal point to the left (essentially: multiply by 10^n)

ToBytes ( ) : byte[]

Returns the bytes for thie BigDecimal instance, for serialization.

ToString ( ) : string

Override ToString operator to provide a string representation of the number.

VoltDecimal ( BigDecimal num ) : System

Creates a new decimal from a generic BigDecimal value.

VoltDecimal ( BigInteger num ) : System

Creates a new decimal from a BigInteger value.

VoltDecimal ( BigInteger num, int scale ) : System

Creates a new decimal from a BigInteger value and optional scale (will be redefined to FixedScale after original initialization).

VoltDecimal ( byte data ) : System

Creates a new instance of the BigDecimal data type, from the deserialization data.

VoltDecimal ( decimal num ) : System

Creates a new decimal from a decimal value.

VoltDecimal ( double num ) : System

Creates a new decimal from a double value.

VoltDecimal ( long num ) : System

Creates a new decimal from a long value.

VoltDecimal ( string num ) : System

Creates a new decimal from a string value.

VoltDecimal ( ulong num ) : System

Creates a new decimal from a ulong value.

operator ( ) : VoltDecimal

Operator definition: binary *

operator ( ) : bool

Operator definition: binary !=

Private Methods

Method Description
IsValidValue ( BigDecimal value ) : bool

Returns whether a given BigDecimal value fits within the restrictions of the VoltDecimal type.

ValidOrThrow ( BigDecimal value ) : void

Checks a value and, in case of validation failure throws an exception.

Method Details

Equals() public method

Overrides Equals operator
public Equals ( object o ) : bool
o object Object to compare this instance with.
return bool

GetHashCode() public method

Returns a hashcode for the current instance.
public GetHashCode ( ) : int
return int

IsVoltDBNull() public method

Returns whether the variable corresponds to a null VoltDB value.
public IsVoltDBNull ( ) : bool
return bool

MovePointLeft() public method

Moves the decimal point to the left (essentially: divide by 10^n)
public MovePointLeft ( int n ) : VoltDecimal
n int Number of digits to shift by.
return VoltDecimal

MovePointRight() public method

Moves the decimal point to the left (essentially: multiply by 10^n)
public MovePointRight ( int n ) : VoltDecimal
n int Number of digits to shift by.
return VoltDecimal

ToBytes() public method

Returns the bytes for thie BigDecimal instance, for serialization.
public ToBytes ( ) : byte[]
return byte[]

ToString() public method

Override ToString operator to provide a string representation of the number.
public ToString ( ) : string
return string

VoltDecimal() public method

Creates a new decimal from a generic BigDecimal value.
public VoltDecimal ( BigDecimal num ) : System
num VoltDB.ThirdParty.Math.BigDecimal Value used for initialization.
return System

VoltDecimal() public method

Creates a new decimal from a BigInteger value.
public VoltDecimal ( BigInteger num ) : System
num VoltDB.ThirdParty.Math.BigInteger Value used for initialization.
return System

VoltDecimal() public method

Creates a new decimal from a BigInteger value and optional scale (will be redefined to FixedScale after original initialization).
public VoltDecimal ( BigInteger num, int scale ) : System
num VoltDB.ThirdParty.Math.BigInteger Value used for initialization.
scale int Scale of the decimal value to create.
return System

VoltDecimal() public method

Creates a new instance of the BigDecimal data type, from the deserialization data.
public VoltDecimal ( byte data ) : System
data byte Binary data as provided by the server's response.
return System

VoltDecimal() public method

Creates a new decimal from a decimal value.
public VoltDecimal ( decimal num ) : System
num decimal Value used for initialization.
return System

VoltDecimal() public method

Creates a new decimal from a double value.
public VoltDecimal ( double num ) : System
num double Value used for initialization.
return System

VoltDecimal() public method

Creates a new decimal from a long value.
public VoltDecimal ( long num ) : System
num long Value used for initialization.
return System

VoltDecimal() public method

Creates a new decimal from a string value.
public VoltDecimal ( string num ) : System
num string Value used for initialization.
return System

VoltDecimal() public method

Creates a new decimal from a ulong value.
public VoltDecimal ( ulong num ) : System
num ulong Value used for initialization.
return System

operator() public static method

Operator definition: binary *
public static operator ( ) : VoltDecimal
return VoltDecimal

operator() public static method

Operator definition: binary !=
public static operator ( ) : bool
return bool

Property Details

MaxValue public_oe static_oe property

MaxValue definition
public static BigDecimal,VoltDB.ThirdParty.Math MaxValue
return VoltDB.ThirdParty.Math.BigDecimal

MinValue public_oe static_oe property

MinValue definition
public static BigDecimal,VoltDB.ThirdParty.Math MinValue
return VoltDB.ThirdParty.Math.BigDecimal

NullValue public_oe static_oe property

NullValue definition
public static BigDecimal,VoltDB.ThirdParty.Math NullValue
return VoltDB.ThirdParty.Math.BigDecimal