public ConditionalContext2( ConditionalContext2 parent, IEntity branch, Direction direction, String when) { if (branch.getEntityType() != EntityType.BRANCH) { throw new IllegalArgumentException(); } this.branch = branch; this.direction = direction; this.parent = parent; this.when = when; this.pendings.add(branch); }
public void executeElse(Collection<IEntity> pendingsToAdd) { if (this.hasElse) { throw new IllegalStateException(); } this.hasElse = true; // Log.println("pend=" + pendings); if (pendings.size() == 0) { throw new IllegalStateException(); } final Iterator<IEntity> it = pendings.iterator(); final IEntity toRemove = it.next(); if (toRemove.getEntityType() != EntityType.BRANCH) { throw new IllegalStateException(); } it.remove(); this.pendings.addAll(pendingsToAdd); }