@Test public void nextCut() throws Exception { ScanningEnvironment env = new ScanningEnvironment(stateSequence, params); FuncCall card = new FuncCall("Cardinality", new ExpressionList(new Variable("a"))); Plus p = new Plus(new IntegerLiteral(-1), new IntegerLiteral(2)); GreaterThanExpression ex = new GreaterThanExpression(card, p); env.addExpression(ex); int i = 0; while (env.nextCut()) { assertTrue(env.getSymbolTable().size() == 1); RQLSymbol s = env.getSymbol("a"); assertTrue(s instanceof RQLSet); RQLSet symbol = (RQLSet)s; assertTrue(symbol.size() == ((i == 0 || i == 2) ? 1 : 2)); i++; } ArrayList<GlobalCut> cuts = env.getEmittedCuts(); System.out.println(cuts.size()); assertTrue(cuts.size() + 2 == SEQ_LEN); }
public synchronized boolean nextCut() { if (stateSequence.hasNext()) { ArrayList<RQLData> changes = stateSequence.getSymbolTableChanges(this.getSymbolTable()); if (changes != null) { updateSymbolTable(this.getSymbolTable(), changes); currentCutHLC = stateSequence.getCurrentHLC(); try { if (this.expression != null) { evaluate(); Expression ex = getExpression(); if (ex.getValue() instanceof LongRQLVariable) { if (((LongRQLVariable) ex.getValue()).getValue() != 0) { emitCut(); } } } else { if (computeExpression != null) { invoke(computeExpression); } emitCut(); } } catch (IllegalExpressionException e) { logger.error("Exception:" + e.getMessage()); addRunTimeException(e); } } while (stack.size() > 1) { stack.pop(); } return true; } return false; }
ScanningEnvironment extends Environment { public synchronized boolean nextCut() { if (stateSequence.hasNext()) { ArrayList<RQLData> changes = stateSequence.getSymbolTableChanges(this.getSymbolTable()); if (changes != null) { updateSymbolTable(this.getSymbolTable(), changes); currentCutHLC = stateSequence.getCurrentHLC(); try { if (this.expression != null) { evaluate(); Expression ex = getExpression(); if (ex.getValue() instanceof LongRQLVariable) { if (((LongRQLVariable) ex.getValue()).getValue() != 0) { emitCut(); } } } else { if (computeExpression != null) { invoke(computeExpression); } emitCut(); } } catch (IllegalExpressionException e) { logger.error("Exception:" + e.getMessage()); addRunTimeException(e); } } while (stack.size() > 1) { stack.pop(); } return true; } return false; } }
ScanningEnvironment extends Environment { public synchronized boolean nextCut() { if (stateSequence.hasNext()) { ArrayList<RQLData> changes = stateSequence.getSymbolTableChanges(this.getSymbolTable()); if (changes != null) { updateSymbolTable(this.getSymbolTable(), changes); currentCutHLC = stateSequence.getCurrentHLC(); try { if (this.expression != null) { evaluate(); Expression ex = getExpression(); if (ex.getValue() instanceof LongRQLVariable) { if (((LongRQLVariable) ex.getValue()).getValue() != 0) { emitCut(); } } } else { if (computeExpression != null) { invoke(computeExpression); } emitCut(); } } catch (IllegalExpressionException e) { logger.error("Exception:" + e.getMessage()); addRunTimeException(e); } } while (stack.size() > 1) { stack.pop(); } return true; } return false; } ScanningEnvironment(RQLStateSequence stateSequence, ArrayList<String> params);  ScanningEnvironment(EnvironmentStack stack, RQLStateSequence stateSequence, ArrayList<String> params); }
ScanningEnvironment extends Environment { public synchronized boolean nextCut() { if (stateSequence.hasNext()) { ArrayList<RQLData> changes = stateSequence.getSymbolTableChanges(this.getSymbolTable()); if (changes != null) { updateSymbolTable(this.getSymbolTable(), changes); currentCutHLC = stateSequence.getCurrentHLC(); try { if (this.expression != null) { evaluate(); Expression ex = getExpression(); if (ex.getValue() instanceof LongRQLVariable) { if (((LongRQLVariable) ex.getValue()).getValue() != 0) { emitCut(); } } } else { if (computeExpression != null) { invoke(computeExpression); } emitCut(); } } catch (IllegalExpressionException e) { logger.error("Exception:" + e.getMessage()); addRunTimeException(e); } } while (stack.size() > 1) { stack.pop(); } return true; } return false; } ScanningEnvironment(RQLStateSequence stateSequence, ArrayList<String> params);  ScanningEnvironment(EnvironmentStack stack, RQLStateSequence stateSequence, ArrayList<String> params); void setComputeExpression(Expression computeExpression); void addExpression(Expression ex); void assignToSymbol(String key, RQLSymbol val); void scan(); synchronized boolean nextCut(); void restrict(Collection<RQLData> changes); void evaluate(); long getCurrentCutHLC(); ArrayList<GlobalCut> getEmittedCuts(); }
ScanningEnvironment extends Environment { public synchronized boolean nextCut() { if (stateSequence.hasNext()) { ArrayList<RQLData> changes = stateSequence.getSymbolTableChanges(this.getSymbolTable()); if (changes != null) { updateSymbolTable(this.getSymbolTable(), changes); currentCutHLC = stateSequence.getCurrentHLC(); try { if (this.expression != null) { evaluate(); Expression ex = getExpression(); if (ex.getValue() instanceof LongRQLVariable) { if (((LongRQLVariable) ex.getValue()).getValue() != 0) { emitCut(); } } } else { if (computeExpression != null) { invoke(computeExpression); } emitCut(); } } catch (IllegalExpressionException e) { logger.error("Exception:" + e.getMessage()); addRunTimeException(e); } } while (stack.size() > 1) { stack.pop(); } return true; } return false; } ScanningEnvironment(RQLStateSequence stateSequence, ArrayList<String> params);  ScanningEnvironment(EnvironmentStack stack, RQLStateSequence stateSequence, ArrayList<String> params); void setComputeExpression(Expression computeExpression); void addExpression(Expression ex); void assignToSymbol(String key, RQLSymbol val); void scan(); synchronized boolean nextCut(); void restrict(Collection<RQLData> changes); void evaluate(); long getCurrentCutHLC(); ArrayList<GlobalCut> getEmittedCuts();  }