Android Programming Press on the image to return to the main documentation page.

MFParser

Written by Manfred Fuchs - \u00c2\u00a9 2014 - http://www.vulpessoft.de

List of types:

MF_MathParser

MF_MathParser


This is an 'Activity Object', it cannot be declared under Sub Process_Globals.

Events:

Calc(name As String, values() As Double) As Double

Members:


  Copyright As String

  CreateUserFunction (funcName As String, paramCount As Int, eventName As String) As Boolean

  Parse (formula As String) As Double

  VariableClear

  VariableExist (name As String) As Boolean

  VariableGet (name As String) As Double

  VariableRemove (name As String)

  VariableSet (name As String, value As Double)

  Version As String

Members description:

Copyright As String
Returns the MFParser copyright string.

Example:
Sub Globals
Dim MF_MathParser As MF_MathParser
End Sub

Sub Activity_Create(FirstTime As Boolean)
Dim copyright As String
copyright = MF_MathParser.Copyright
End Sub
CreateUserFunction (funcName As String, paramCount As Int, eventName As String) As Boolean
Create user defined function. The function raises an event on call.
The function name will be forwarded to the event. Therefore you can create a sub for each function or one sub and then select by function name in event.

Example:
Sub Globals
Dim MF_MathParser As MF_MathParser
End Sub

Sub Activity_Create(FirstTime As Boolean)
MF_MathParser.CreateUserFunction("test", 2, "TestEvent")
Dim result As Double
result = MF_MathParser.Parse("test(5,7)")
End Sub

Sub TestEvent_Calc(name As String, values() As Double) As Double
Dim result As Double = 0.0
For Each v In Values
result = result + v
Next
return result
End Sub
Parse (formula As String) As Double
Parses the given formula and returns the result.
Multiple formulas can be used, separated with ";".
If a formula begins with "variable=", this variable will be set with the result.
Additionally a variable "result" with the result value of the last formula will be set.

Example:
Sub Globals
Dim MF_MathParser As MF_MathParser
End Sub

Sub Activity_Create(FirstTime As Boolean)
Dim result As Double
result = MF_MathParser.Parse("x=7;12*(x-2)/5")
End Sub
VariableClear
Remove all variables.

Example:
Sub Globals
Dim MF_MathParser As MF_MathParser
End Sub

Sub Activity_Create(FirstTime As Boolean)
MF_MathParser.VariableClear
End Sub
VariableExist (name As String) As Boolean
Check if variable exist.

Example:
Sub Globals
Dim MF_MathParser As MF_MathParser
End Sub

Sub Activity_Create(FirstTime As Boolean)
Dim result As Boolean
result = MF_MathParser.VariableExist("x")
End Sub
VariableGet (name As String) As Double
Get value from variable.

Example:
Sub Globals
Dim MF_MathParser As MF_MathParser
End Sub

Sub Activity_Create(FirstTime As Boolean)
Dim result As Double
result = MF_MathParser.VariableGet("x")
End Sub
VariableRemove (name As String)
Remove variable.

Example:
Sub Globals
Dim MF_MathParser As MF_MathParser
End Sub

Sub Activity_Create(FirstTime As Boolean)
MF_MathParser.VariableRemove("x")
End Sub
VariableSet (name As String, value As Double)
Set variable with value.

Example:
Sub Globals
Dim MF_MathParser As MF_MathParser
End Sub

Sub Activity_Create(FirstTime As Boolean)
Dim result As Double
MF_MathParser.VariableSet("x", 12)
result = MF_MathParser.Parse("x*(7-2)/5")
End Sub
Version As String
Returns the MFParser version.

Example:
Sub Globals
Dim MF_MathParser As MF_MathParser
End Sub

Sub Activity_Create(FirstTime As Boolean)
Dim version As String
version = MF_MathParser.Version
End Sub

Top