org.rubato.rubettes.builtin
Class ArithCompiler

java.lang.Object
  extended by org.rubato.rubettes.builtin.ArithCompiler

public class ArithCompiler
extends java.lang.Object

Parses an expression of real arithmetic including boolean expressions.

Author:
Gérard Milmeister

Constructor Summary
ArithCompiler()
          Creates a compiler.
ArithCompiler(java.lang.String expressionString)
          Creates a compiler with the given string as input.
ArithCompiler(java.lang.String expressionString, boolean isResultReal)
          Creates a compiler with the given string as input.
 
Method Summary
 java.lang.String getError()
          Returns the error if any.
 ArithVM getVM()
          Returns the virtual machine with the code compiled from the expression.
 boolean hasError()
          Returns true iff the compilation failed.
 boolean parse()
          Parses the expression string, assuming there are no arguments.
 boolean parse(int nrArgs)
          Parses the expression string, assuming there are nArgs arguments.
 void setExpression(java.lang.String s)
          Sets the expression string for the compiler.
 void setExpression(java.lang.String s, boolean isResultReal)
          Sets the expression string for the compiler.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArithCompiler

public ArithCompiler(java.lang.String expressionString)
Creates a compiler with the given string as input. The result type of the expression is real.


ArithCompiler

public ArithCompiler(java.lang.String expressionString,
                     boolean isResultReal)
Creates a compiler with the given string as input. The boolean parameter indicates whether the result type is real or boolean.


ArithCompiler

public ArithCompiler()
Creates a compiler.

Method Detail

setExpression

public void setExpression(java.lang.String s)
Sets the expression string for the compiler. The result type is real.


setExpression

public void setExpression(java.lang.String s,
                          boolean isResultReal)
Sets the expression string for the compiler. The boolean parameter indicates whether the result type is real or boolean.


getVM

public ArithVM getVM()
Returns the virtual machine with the code compiled from the expression.


parse

public boolean parse()
Parses the expression string, assuming there are no arguments.


parse

public boolean parse(int nrArgs)
Parses the expression string, assuming there are nArgs arguments.


getError

public java.lang.String getError()
Returns the error if any.


hasError

public boolean hasError()
Returns true iff the compilation failed.