| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ControlProcess |
|
| 0.0;0 |
| 1 | /* | |
| 2 | Copyright (C) 2006 Grid Systems, S.A. | |
| 3 | ||
| 4 | This library is free software; you can redistribute it and/or | |
| 5 | modify it under the terms of the GNU Lesser General Public | |
| 6 | License as published by the Free Software Foundation; either | |
| 7 | version 2.1 of the License, or (at your option) any later version. | |
| 8 | ||
| 9 | This library is distributed in the hope that it will be useful, | |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 | Lesser General Public License for more details. | |
| 13 | ||
| 14 | You should have received a copy of the GNU Lesser General Public | |
| 15 | License along with this library; if not, write to the Free Software | |
| 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
| 17 | */ | |
| 18 | package nextgrid.api.pom; | |
| 19 | ||
| 20 | import java.util.Map; | |
| 21 | ||
| 22 | /** | |
| 23 | * Type description. | |
| 24 | * | |
| 25 | * @author Rodrigo Ruiz | |
| 26 | */ | |
| 27 | public interface ControlProcess extends Process { | |
| 28 | ||
| 29 | //---------------------------------------------------------------------------- | |
| 30 | // Enaction management | |
| 31 | //---------------------------------------------------------------------------- | |
| 32 | ||
| 33 | /** | |
| 34 | * Gets the lazy flag value. | |
| 35 | * <p> | |
| 36 | * This flag allows certqain control over the evaluation recursion level at | |
| 37 | * runtime. | |
| 38 | * | |
| 39 | * @return The flag value | |
| 40 | */ | |
| 41 | boolean isLazy(); | |
| 42 | ||
| 43 | /** | |
| 44 | * Sets the value of the lazy flag. | |
| 45 | * <p> | |
| 46 | * This flag allows certqain control over the evaluation recursion level at | |
| 47 | * runtime. | |
| 48 | * | |
| 49 | * @param lazy The flag value | |
| 50 | */ | |
| 51 | void setLazy(boolean lazy); | |
| 52 | ||
| 53 | /** | |
| 54 | * Gets the memoize flag value. | |
| 55 | * <p> | |
| 56 | * This flag determines if previous children evaluations will be reused for | |
| 57 | * multiple executions. This is the case of loops, for example, in which | |
| 58 | * the contained subworkflow may be reused among iteration steps. | |
| 59 | * | |
| 60 | * @return The flag value | |
| 61 | */ | |
| 62 | boolean isMemoizeActive(); | |
| 63 | ||
| 64 | /** | |
| 65 | * Sets the memoize flag value. | |
| 66 | * <p> | |
| 67 | * This flag determines if previous children evaluations will be reused for | |
| 68 | * multiple executions. This is the case of loops, for example, in which | |
| 69 | * the contained subworkflow may be reused among iteration steps. | |
| 70 | * | |
| 71 | * @param memoize The flag value | |
| 72 | */ | |
| 73 | void setMemoizeActive(boolean memoize); | |
| 74 | ||
| 75 | //---------------------------------------------------------------------------- | |
| 76 | // Child process list management | |
| 77 | //---------------------------------------------------------------------------- | |
| 78 | ||
| 79 | /** | |
| 80 | * Gets the processes in the children list. | |
| 81 | * | |
| 82 | * @return An array of child processes | |
| 83 | */ | |
| 84 | Process[] getChildren(); | |
| 85 | ||
| 86 | /** | |
| 87 | * Gets a child process by its index. | |
| 88 | * | |
| 89 | * @param index The child process position | |
| 90 | * @return The process | |
| 91 | */ | |
| 92 | Process getChildren(int index); | |
| 93 | ||
| 94 | /** | |
| 95 | * Gets the number of child processes. | |
| 96 | * | |
| 97 | * @return the number of child processes | |
| 98 | */ | |
| 99 | int getChildCount(); | |
| 100 | ||
| 101 | /** | |
| 102 | * Sets the size of the children list to a maximum of <tt>count</tt> items. | |
| 103 | * <p> | |
| 104 | * It correctly removes all items from position <tt>count</tt> to the end | |
| 105 | * of the list. If the list is already smaller than <tt>count</tt>, it does | |
| 106 | * nothing. | |
| 107 | * | |
| 108 | * @param count The max number of elements to maintain in the children list | |
| 109 | */ | |
| 110 | void trim(int count); | |
| 111 | ||
| 112 | /** | |
| 113 | * Sets the list of child processes for this process instance. | |
| 114 | * | |
| 115 | * @param children An array of processes | |
| 116 | */ | |
| 117 | void setChildren(Process... children); | |
| 118 | ||
| 119 | /** | |
| 120 | * Sets a child process. | |
| 121 | * | |
| 122 | * @param index The position in the list | |
| 123 | * @param child The process to set | |
| 124 | * @throws UnsupportedOperationException | |
| 125 | * If the process does not support children | |
| 126 | */ | |
| 127 | void setChildren(int index, Process child); | |
| 128 | ||
| 129 | /** | |
| 130 | * Inserts the specified element at the specified position in this list. | |
| 131 | * Shifts the element currently at that position (if any) and any subsequent | |
| 132 | * elements to the right (adds one to their indices).<p> | |
| 133 | * | |
| 134 | * @param index | |
| 135 | * index at which the specified element is to be inserted. | |
| 136 | * | |
| 137 | * @param child | |
| 138 | * element to be inserted. | |
| 139 | * | |
| 140 | * @throws UnsupportedOperationException | |
| 141 | * if the <tt>add</tt> method is not supported by this list. | |
| 142 | * | |
| 143 | * @throws ClassCastException | |
| 144 | * if the class of the specified element prevents it from being added | |
| 145 | * to this list. | |
| 146 | * | |
| 147 | * @throws IllegalArgumentException | |
| 148 | * if some aspect of the specified element prevents it from being | |
| 149 | * added to this list. | |
| 150 | * | |
| 151 | * @throws IndexOutOfBoundsException | |
| 152 | * index is out of range (<tt>index < 0 || index > size()</tt>). | |
| 153 | */ | |
| 154 | void addChildren(int index, Process child); | |
| 155 | ||
| 156 | /** | |
| 157 | * Adds a set of processes to the child list. | |
| 158 | * | |
| 159 | * @param processes The processes to add | |
| 160 | */ | |
| 161 | void addChildren(Process... processes); | |
| 162 | ||
| 163 | /** | |
| 164 | * Removes the element at the specified position in this list. | |
| 165 | * Shifts any subsequent elements to the left (subtracts one from their | |
| 166 | * indices). Returns the element that was removed from the list. | |
| 167 | * | |
| 168 | * @param index | |
| 169 | * the index of the element to remove | |
| 170 | * | |
| 171 | * @return the element previously at the specified position | |
| 172 | * | |
| 173 | * @throws UnsupportedOperationException | |
| 174 | * if the <tt>remove</tt> method is not supported by this list. | |
| 175 | * | |
| 176 | * @throws IndexOutOfBoundsException | |
| 177 | * if the specified index is out of range (<tt>index < 0 || | |
| 178 | * index >= size()</tt>). | |
| 179 | */ | |
| 180 | Process removeChild(int index); | |
| 181 | ||
| 182 | /** | |
| 183 | * Removes a process instance from the children list. | |
| 184 | * | |
| 185 | * @param child The process to remove | |
| 186 | * @return <tt>true</tt> if it is removed | |
| 187 | */ | |
| 188 | boolean removeChild(Process child); | |
| 189 | ||
| 190 | /** | |
| 191 | * Gets a reference used by this process as a local variable. | |
| 192 | * <p> | |
| 193 | * Control processes can contain a set of "local variables", which are | |
| 194 | * references not directly used by this process, but by its children. | |
| 195 | * <p> | |
| 196 | * Iterative constructs may use this collection for resetting their values | |
| 197 | * in each loop iteration. | |
| 198 | * | |
| 199 | * @param name Variable name | |
| 200 | * @return Reference to the variable | |
| 201 | */ | |
| 202 | Reference<?> getLocalVar(String name); | |
| 203 | ||
| 204 | /** | |
| 205 | * Sets a reference used by this process as a local variable. | |
| 206 | * | |
| 207 | * @param name Variable name | |
| 208 | * @param value Reference to the variable value | |
| 209 | */ | |
| 210 | void setLocalVar(String name, Reference<?> value); | |
| 211 | ||
| 212 | /** | |
| 213 | * Gets the collection of all local variables defined in the scope of this | |
| 214 | * process instance. | |
| 215 | * | |
| 216 | * @return A collection containing all local variables in this instance | |
| 217 | */ | |
| 218 | Map<String, Reference<?>> getLocalVars(); | |
| 219 | } |