View Javadoc

1   package cz.cuni.amis.pogamut.shady;
2   
3   import cz.cuni.amis.pogamut.sposh.executor.IWorkExecutor;
4   
5   /**
6    * Every node has multiple elemnts, binary tree has two, our if-then tree
7    * structure has a variable ammount. This class represents one of possible
8    * choices in the tree engine can select.
9    *
10   * @author Honza
11   */
12  public class NodeElement {
13  
14      private final IQuery priority;
15      private final IQuery trigger;
16      private final NodeCall call;
17  
18      /**
19       * Create new node element.
20       * @param priority query that is used to determine priority of this element
21       * @param trigger trigger to determine if this node can be selected
22       * @param call what to call if the element has the highest priority in
23       *        the node and trigger is not zero.
24       */
25      NodeElement(IQuery priority, IQuery trigger, NodeCall call) {
26          this.priority = priority;
27          this.trigger = trigger;
28          this.call = call;
29      }
30  
31      /**
32       * Get query that can be used to determine priority of this element.
33       * @return the priority query
34       */
35      public IQuery getPriority() {
36          return priority;
37      }
38  
39      /**
40       * Get query that can be used to determine if this element is eligible
41       * for execution (i.e. if procondition for using call are fulfilles).
42       * That alone is not sufficient, priority of this element must be highest
43       * in the node.
44       *
45       * @return the trigger query.
46       */
47      public IQuery getTrigger() {
48          return trigger;
49      }
50  
51      /**
52       * Get node call, that is either another node or action executed
53       * by {@link IWorkExecutor}.
54       *
55       * @return the call
56       */
57      public NodeCall getCall() {
58          return call;
59      }
60  
61  
62  }