@Override protected void executeOnStarted() throws CoreException { if(this.applyConditionAtBegin == true) { this.whileExecution(); } else { this.repeatUntilExecution(false); } } }
private void whileExecution() throws CoreException { Boolean cond = (Boolean) this.condition.evaluate(this.getNode().getExecution() .getParentScope()); if (cond != null && cond == true) { final List<Node> childs = this.node.getChildNodes(); if ((childs != null) && (childs.size() > 0)) { getNode().getExecution().setNextExecutableElements(this, childs.get(0)); } } else { this.log.finest("end while behaviour on node: " + this.node.getName()); this.state = State.ACTIVITY_ENDED; } }
final LoopBehaviour loopBehaviour = new LoopBehaviourImpl(); loopBehaviour.setCondition(condition); loopBehaviour.setApplyConditionAtBegin(applyConditionAtBegin);
private void whileExecution() throws CoreException { Boolean cond = (Boolean) this.condition.evaluate(this.getNode().getExecution() .getParentScope()); if (cond != null && cond == true) { final List<Node> childs = this.node.getChildNodes(); if ((childs != null) && (childs.size() > 0)) { getNode().getExecution().setNextExecutableElements(this, childs.get(0)); } } else { this.log.finest("end while behaviour on node: " + this.node.getName()); this.state = State.ACTIVITY_ENDED; } }
@Override protected void executeOnStarted() throws CoreException { if(this.applyConditionAtBegin == true) { this.whileExecution(); } else { this.repeatUntilExecution(false); } } }
private void repeatUntilExecution(boolean first) throws CoreException { boolean ok = true; if(!first) { Boolean cond = (Boolean) this.condition.evaluate(this.getNode().getExecution().getParentScope()); if (cond == null || cond == false) { this.log.finest("end repeat until behaviour on node: " + this.node.getName()); this.state = State.ACTIVITY_ENDED; ok = false; } } if(ok) { final List<Node> childs = this.node.getChildNodes(); if ((childs != null) && (childs.size() > 0)) { getNode().getExecution().setNextExecutableElements(this, childs.get(0)); } } }
@Override protected void executeOnInactive() throws CoreException { this.state = State.ACTIVITY_STARTED; if(this.applyConditionAtBegin == true) { this.log.finest("start while behaviour on node: " + this.node.getName()); this.whileExecution(); } else { this.log.finest("start repeat until behaviour on node: " + this.node.getName()); this.repeatUntilExecution(true); } }
private void repeatUntilExecution(boolean first) throws CoreException { boolean ok = true; if(!first) { Boolean cond = (Boolean) this.condition.evaluate(this.getNode().getExecution().getParentScope()); if (cond == null || cond == false) { this.log.finest("end repeat until behaviour on node: " + this.node.getName()); this.state = State.ACTIVITY_ENDED; ok = false; } } if(ok) { final List<Node> childs = this.node.getChildNodes(); if ((childs != null) && (childs.size() > 0)) { getNode().getExecution().setNextExecutableElements(this, childs.get(0)); } } }
@Override protected void executeOnInactive() throws CoreException { this.state = State.ACTIVITY_STARTED; if(this.applyConditionAtBegin == true) { this.log.finest("start while behaviour on node: " + this.node.getName()); this.whileExecution(); } else { this.log.finest("start repeat until behaviour on node: " + this.node.getName()); this.repeatUntilExecution(true); } }