C# Class YAMP.Value

Abstract base value for any value type.
Inheritance: IRegisterElement
Mostra file Open project: FlorianRappl/YAMP Class Usage Examples

Public Properties

Property Type Description
EmptyTypes System.Type[]

Public Methods

Method Description
CastStringToDouble ( String value ) : Double

This represents a save cast from a string to a double.

Copy ( ) : Value

Creates a copy of the given object using reflection. Override for using a more specialized version.

Deserialize ( Byte content ) : Value

Creates a new instance from bytes.

Deserialize ( String name, Byte content ) : Value

Creates a new named instance from the content.

Format ( ParseContext context, Double value ) : String

Formats a given double value with the rules of the context.

RegisterElement ( IElementMapping elementMapping ) : void

Registers the element at a certain point.

Serialize ( ) : Byte[]

Converts the instance to bytes.

ToString ( ) : String

Returns a string representation of the value.

ToString ( ParseContext context ) : String

Returns a string representation of the value.

Protected Methods

Method Description
BuildIndex ( Value arg, Int32 max ) : System.Int32[]

Builds the index from the given value.

GetExponent ( Double value ) : Int32

Gets the exponent (10^n) of a double value.

RegisterDivide ( Type left, Type right, Func divide ) : void

Helper for registering a division operator.

RegisterMember ( Type left, Type right, Func member ) : void

Helper for registering a member operator.

RegisterMinus ( Type left, Type right, Func sub ) : void

Helper for registering a minus operator.

RegisterModulo ( Type left, Type right, Func mod ) : void

Helper for registering a modulo operator.

RegisterMultiply ( Type left, Type right, Func multiply ) : void

Helper for registering a multiplication operator.

RegisterOperators ( ) : void

Registers the operators (if there are any).

RegisterPlus ( Type left, Type right, Func add ) : void

Helper for registering a plus operator.

RegisterPower ( Type left, Type right, Func power ) : void

Helper for registering a power operator.

Private Methods

Method Description
Compose ( ParseContext context, Double value, Int32 decimals, Int32 exponent ) : string
EngineeringFormat ( ParseContext context, Double value, Int32 sign, Int32 U, Int32 L ) : String
ScientificFormat ( ParseContext context, Double value, Int32 sign, Int32 U, Int32 L ) : String
StandardFormat ( ParseContext context, Double v, Int32 sign, Int32 U, Int32 L ) : String
ToSuperScript ( Int32 exp ) : String

Method Details

BuildIndex() protected static method

Builds the index from the given value.
protected static BuildIndex ( Value arg, Int32 max ) : System.Int32[]
arg Value The argument to inspect.
max System.Int32 The maximum number of arguments.
return System.Int32[]

CastStringToDouble() public static method

This represents a save cast from a string to a double.
public static CastStringToDouble ( String value ) : Double
value String The string value.
return Double

Copy() public method

Creates a copy of the given object using reflection. Override for using a more specialized version.
public Copy ( ) : Value
return Value

Deserialize() public abstract method

Creates a new instance from bytes.
public abstract Deserialize ( Byte content ) : Value
content Byte The binary content.
return Value

Deserialize() public static method

Creates a new named instance from the content.
public static Deserialize ( String name, Byte content ) : Value
name String The name of the instance.
content Byte The raw content.
return Value

Format() public static method

Formats a given double value with the rules of the context.
public static Format ( ParseContext context, Double value ) : String
context ParseContext The context with the rules.
value Double The double precision value.
return String

GetExponent() protected method

Gets the exponent (10^n) of a double value.
protected GetExponent ( Double value ) : Int32
value Double The value to get the exponent from.
return System.Int32

RegisterDivide() protected static method

Helper for registering a division operator.
protected static RegisterDivide ( Type left, Type right, Func divide ) : void
left System.Type The type on the left side.
right System.Type The type on the right side.
divide Func The function to execute.
return void

RegisterElement() public method

Registers the element at a certain point.
public RegisterElement ( IElementMapping elementMapping ) : void
elementMapping IElementMapping
return void

RegisterMember() protected static method

Helper for registering a member operator.
protected static RegisterMember ( Type left, Type right, Func member ) : void
left System.Type The type on the left side.
right System.Type The type on the right side.
member Func The function to execute.
return void

RegisterMinus() protected static method

Helper for registering a minus operator.
protected static RegisterMinus ( Type left, Type right, Func sub ) : void
left System.Type The type on the left side.
right System.Type The type on the right side.
sub Func The function to execute.
return void

RegisterModulo() protected static method

Helper for registering a modulo operator.
protected static RegisterModulo ( Type left, Type right, Func mod ) : void
left System.Type The type on the left side.
right System.Type The type on the right side.
mod Func The function to execute.
return void

RegisterMultiply() protected static method

Helper for registering a multiplication operator.
protected static RegisterMultiply ( Type left, Type right, Func multiply ) : void
left System.Type The type on the left side.
right System.Type The type on the right side.
multiply Func The function to execute.
return void

RegisterOperators() protected method

Registers the operators (if there are any).
protected RegisterOperators ( ) : void
return void

RegisterPlus() protected static method

Helper for registering a plus operator.
protected static RegisterPlus ( Type left, Type right, Func add ) : void
left System.Type The type on the left side.
right System.Type The type on the right side.
add Func The function to execute.
return void

RegisterPower() protected static method

Helper for registering a power operator.
protected static RegisterPower ( Type left, Type right, Func power ) : void
left System.Type The type on the left side.
right System.Type The type on the right side.
power Func The function to execute.
return void

Serialize() public abstract method

Converts the instance to bytes.
public abstract Serialize ( ) : Byte[]
return Byte[]

ToString() public method

Returns a string representation of the value.
public ToString ( ) : String
return String

ToString() public method

Returns a string representation of the value.
public ToString ( ParseContext context ) : String
context ParseContext The calling context.
return String

Property Details

EmptyTypes public_oe static_oe property

A little helper for reflection (same as Type.Empty in the full .NET stack).
public static Type[],System EmptyTypes
return System.Type[]