Venice 0.751beta

nz.org.venice.parser
Class AnalyserGuard

java.lang.Object
  extended bynz.org.venice.parser.AnalyserGuard

public class AnalyserGuard
extends java.lang.Object

This class keeps track of the running time of expressions which can forever The check is done per date

Author:
Mark Hummel

Field Summary
static int maxRunTime
           
static int maxStackDepth
           
 
Method Summary
 boolean evaluationTimeElapsed(Expression expression, org.safehaus.uuid.UUID expressionID, Symbol symbol, int day)
          Return true if the given expression evaluation exceeds the limit.
 void finishFunction(Expression expression, org.safehaus.uuid.UUID expressionID, Symbol symbol, int day)
          Record that a function call has completed.
 void finishLoop(Expression expression, org.safehaus.uuid.UUID expressionID, Symbol symbol, int day)
          Record that a loop has completed.
static AnalyserGuard getInstance()
           
protected  void setMaxStackDepth(int depth)
           
protected  void setRuntimeLimit(int secs)
           
 boolean stackDepthLimitExceeded(Expression expression, org.safehaus.uuid.UUID expressionID, Symbol symbol, int day)
          Return true if the function call depth exceeds the limit. .
 void startFunction(Expression expression, org.safehaus.uuid.UUID expressionID, Symbol symbol, int day)
          Record that a function is being called.
 void startLoop(Expression expression, org.safehaus.uuid.UUID expressionID, Symbol symbol, int day)
          Record that a loop has begun evaluation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxRunTime

public static int maxRunTime

maxStackDepth

public static int maxStackDepth
Method Detail

getInstance

public static AnalyserGuard getInstance()

evaluationTimeElapsed

public boolean evaluationTimeElapsed(Expression expression,
                                     org.safehaus.uuid.UUID expressionID,
                                     Symbol symbol,
                                     int day)
Return true if the given expression evaluation exceeds the limit.

Parameters:
expression - The expression being evaluated
expressionID - Identifier for the expression
symbol - The symbol on which the rule is being evaluated
day - Integer offset of the quote bundle. Included so the limit exceeded doesn't trigger if some progress is being made.

stackDepthLimitExceeded

public boolean stackDepthLimitExceeded(Expression expression,
                                       org.safehaus.uuid.UUID expressionID,
                                       Symbol symbol,
                                       int day)
Return true if the function call depth exceeds the limit. .

Parameters:
expression - The expression being evaluated
expressionID - Identifier for the expression
symbol - The symbol on which the rule is being evaluated
day - Integer offset of the quote bundle. Included so the limit exceeded doesn't trigger if some progress is being made.

startLoop

public void startLoop(Expression expression,
                      org.safehaus.uuid.UUID expressionID,
                      Symbol symbol,
                      int day)
Record that a loop has begun evaluation.

Parameters:
expression - The expression being evaluated
expressionID - Identifier for the expression
symbol - The symbol on which the rule is being evaluated
day - Integer offset of the quote bundle. Included so the limit exceeded doesn't trigger if some progress is being made.

finishLoop

public void finishLoop(Expression expression,
                       org.safehaus.uuid.UUID expressionID,
                       Symbol symbol,
                       int day)
Record that a loop has completed.

Parameters:
expression - The expression being evaluated
expressionID - Identifier for the expression
symbol - The symbol on which the rule is being evaluated
day - Integer offset of the quote bundle. Included so the limit exceeded doesn't trigger if some progress is being made.

startFunction

public void startFunction(Expression expression,
                          org.safehaus.uuid.UUID expressionID,
                          Symbol symbol,
                          int day)
Record that a function is being called.

Parameters:
expression - The expression being evaluated
expressionID - Identifier for the expression
symbol - The symbol on which the rule is being evaluated
day - Integer offset of the quote bundle. Included so the limit exceeded doesn't trigger if some progress is being made.

finishFunction

public void finishFunction(Expression expression,
                           org.safehaus.uuid.UUID expressionID,
                           Symbol symbol,
                           int day)
Record that a function call has completed.

Parameters:
expression - The expression being evaluated
expressionID - Identifier for the expression
symbol - The symbol on which the rule is being evaluated
day - Integer offset of the quote bundle. Included so the limit exceeded doesn't trigger if some progress is being made.

setRuntimeLimit

protected void setRuntimeLimit(int secs)

setMaxStackDepth

protected void setMaxStackDepth(int depth)

Venice 0.751beta