© 2006-2007 ETH Zurich

org.ximtec.igesture.algorithm.siger
Class Parser

java.lang.Object
  extended by org.ximtec.igesture.algorithm.siger.Parser

public class Parser
extends Object

Parses the textual description of a gesture class.

Version:
1.0 Dec 2006
Author:
Ueli Kurmann, igesture@uelikurmann.ch, Beat Signer, signer@inf.ethz.ch

Nested Class Summary
static class Parser.BooleanOperators
          Boolean operators.
static class Parser.Operator
          Operators of Siger's description language.
 
Constructor Summary
Parser(String expression)
          Parses a string containing a description.
 
Method Summary
static boolean evaluateComparison(Parser.Operator operator, double left, double right)
          Evaluates a comparison
 boolean evaluateConstraints(Statistics strokeStatistic)
          Evaluates the constraints.
static double evaluateFunction(org.ximtec.igesture.algorithm.siger.Parser.Tokens token, Statistics strokeStatistic)
          Evaluates the given function.
 Pattern getPattern()
          Returns the pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parser

public Parser(String expression)
Parses a string containing a description.

Parameters:
expression - the string to be parsed.
Method Detail

getPattern

public Pattern getPattern()
Returns the pattern.

Returns:
the pattern.

evaluateConstraints

public boolean evaluateConstraints(Statistics strokeStatistic)
Evaluates the constraints.

Parameters:
strokeStatistic - the stroke statistics.
Returns:
true if the constraint is satisfied.

evaluateFunction

public static double evaluateFunction(org.ximtec.igesture.algorithm.siger.Parser.Tokens token,
                                      Statistics strokeStatistic)
Evaluates the given function.

Parameters:
token - the token to be used.
strokeStatistic - the statistics to be used.
Returns:
the function's result.

evaluateComparison

public static boolean evaluateComparison(Parser.Operator operator,
                                         double left,
                                         double right)
Evaluates a comparison

Parameters:
operator - the comparison operator.
left - the value of the left operand.
right - the value of the right operand.
Returns:
true if the condition defined by the operator is true.

© 2006-2007 ETH Zurich

Copyright © 2007-2010 Global Information Systems Group, ETH Zurich. All Rights Reserved.