C# Class YAMP.FunctionValue

A function value, i.e. a lambda expression or existing function wrapped as a value that can be used within YAMP.
Inheritance: Value, IFunction
Exibir arquivo Open project: FlorianRappl/YAMP Class Usage Examples

Public Methods

Method Description
AsMemberFunction ( ) : MemberFunction

Tries to cast the function to a member function.

Copy ( ) : Value

Does not clone the function, but just returns the same function again.

Deserialize ( byte content ) : Value

Tries to create a new instance from the given bytes.

FunctionValue ( ) : System

Creates a new (dummy) instance of a FunctionValue.

FunctionValue ( Func f, System.Boolean standardFunctionBehaviour = false ) : System

Creates a new instance of a FunctionValue with a delegate argument.

FunctionValue ( IFunction function ) : System

Creates a new FunctionValue with a given class that contains a perform method, i.e. implements the IFunction interface.

FunctionValue ( String arguments, String body ) : System

Creates a new FunctionValue with data to parse.

Perform ( ParseContext context, Value argument ) : Value

Invokes the given function value.

Serialize ( ) : byte[]

Tries to convert the given instance into bytes.

ToString ( ) : String

Returns a string representation of the function.

Private Methods

Method Description
FunctionValue ( String arguments, Expression body ) : System

Creates a new FunctionValue with a parsed object (lambda expression).

FunctionValue ( String name, String arguments, Expression body ) : System

Creates a new FunctionValue with a parsed named function (function).

SetPerform ( String arguments, Expression body ) : void
SetPerform ( String name, String arguments, Expression body ) : void

Method Details

AsMemberFunction() public method

Tries to cast the function to a member function.
public AsMemberFunction ( ) : MemberFunction
return MemberFunction

Copy() public method

Does not clone the function, but just returns the same function again.
public Copy ( ) : Value
return Value

Deserialize() public method

Tries to create a new instance from the given bytes.
public Deserialize ( byte content ) : Value
content byte The binary content.
return Value

FunctionValue() public method

Creates a new (dummy) instance of a FunctionValue.
public FunctionValue ( ) : System
return System

FunctionValue() public method

Creates a new instance of a FunctionValue with a delegate argument.
public FunctionValue ( Func f, System.Boolean standardFunctionBehaviour = false ) : System
f Func Delegate to be wrapped in a function
standardFunctionBehaviour System.Boolean indicates if the wrapper /// should include the StandardFunction behaviour, i.e. scalar execution /// for ScalarValues and matrix execution for MatrixValues
return System

FunctionValue() public method

Creates a new FunctionValue with a given class that contains a perform method, i.e. implements the IFunction interface.
public FunctionValue ( IFunction function ) : System
function IFunction The instance of the class implementing the IFunction interface.
return System

FunctionValue() public method

Creates a new FunctionValue with data to parse.
public FunctionValue ( String arguments, String body ) : System
arguments String The list of argument identifiers.
body String The string representation of the body.
return System

Perform() public method

Invokes the given function value.
public Perform ( ParseContext context, Value argument ) : Value
context ParseContext The context of the invocation.
argument Value The argument(s) to use for the invocation.
return Value

Serialize() public method

Tries to convert the given instance into bytes.
public Serialize ( ) : byte[]
return byte[]

ToString() public method

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