1 package cz.cuni.amis.pogamut.sposh.engine; 2 3 /** 4 * Result of ElementExecutor s. Only FOLLOW requires specification of nextElement. 5 * @author Honza 6 */ 7 public final class FireResult { 8 public enum Type { 9 /** 10 * The element is finished and result is success. 11 */ 12 FULFILLED, 13 /** 14 * The element is finished and it failed. 15 */ 16 FAILED, 17 /** 18 * Element wasn't yet finished. 19 */ 20 CONTINUE, 21 /** 22 * Some child element is supposed to be evaluated. 23 */ 24 FOLLOW, 25 /** 26 * Well, not many will use this I suppose, but move up in the stack, 27 * something like return from function. This is the only type that 28 * causes the sposh logic controller to stop iterating. If {@link PoshEngine#evaluatePlan(cz.cuni.amis.pogamut.sposh.executor.IWorkExecutor) 29 * } returns any other value, the sposh logic controller will call 30 * another round of {@link PoshEngine#evaluatePlan(cz.cuni.amis.pogamut.sposh.executor.IWorkExecutor)} 31 */ 32 SURFACE, 33 /** 34 * E.g. surface (pop element on the stack), but also indicates that execution should continue. 35 */ 36 SURFACE_CONTINUE, 37 } 38 39 private Type type; 40 private StackElement nextElement; 41 42 protected FireResult(Type type) { 43 this(type, null); 44 } 45 46 protected FireResult(Type type, StackElement nextElement) { 47 this.type = type; 48 this.nextElement = nextElement; 49 } 50 51 /** 52 * @return the continueExecution 53 */ 54 public Type getType() { 55 return type; 56 } 57 58 /** 59 * @return the nextElement 60 */ 61 public StackElement getNextElement() { 62 assert (nextElement != null) : "NextElement is null, type of FireResult should be such, that we never ask for it (is "+ getType() +")"; 63 return nextElement; 64 } 65 }