net.sourceforge.sasi
Class SASIInterpreter

java.lang.Object
  extended bynet.sourceforge.sasi.SASIInterpreter

public class SASIInterpreter
extends java.lang.Object

This class provides methods for parsing and evaluting aicc_script expressions used in SCORM 1.2

 HashMap hm = new HashMap();
 hm.put("s1", "passed");
 hm.put("s2", "failed");
 
 **OO style**
 SASIInterpreter sasi = new SASIInterpreter("s1&s2"); 
 sasi.create();
 sasi.interpret(hm);
 
 ***static style***
 SASIEval se = SASIInterpreter.create("s1&s2");
 SASIInterpreter.interpret(se, hm);
 

Version:
$Id$
Author:
Alexander Merz

Constructor Summary
SASIInterpreter(java.lang.String expr)
          Constructor
 
Method Summary
 void create()
          parses the expression
static SASIEval create(java.lang.String expr)
          parses an expression
 boolean interpret(java.util.HashMap hm)
          evalutes an expression using the provided sco states
static boolean interpret(SASIEval expr, java.util.HashMap hm)
          evalutes an expression using the provided sco states
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SASIInterpreter

public SASIInterpreter(java.lang.String expr)
Constructor

Parameters:
expr - the expression to interprete
Method Detail

create

public static SASIEval create(java.lang.String expr)
                       throws java.lang.Exception
parses an expression

Parameters:
expr - the expression to parse
Returns:
the expression tree
Throws:
java.lang.Exception

create

public void create()
            throws java.lang.Exception
parses the expression

Throws:
java.lang.Exception

interpret

public static boolean interpret(SASIEval expr,
                                java.util.HashMap hm)
evalutes an expression using the provided sco states

Parameters:
expr - the expression tree
hm - the HashMap containing the sco states
Returns:
true or false depending on the sco states

interpret

public boolean interpret(java.util.HashMap hm)
evalutes an expression using the provided sco states

Parameters:
hm - the HashMap containing the sco states
Returns:
true or false depending on the sco states