[927] | 1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany |
---|
| 2 | // |
---|
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
---|
| 4 | // you may not use this file except in compliance with the License. |
---|
| 5 | // You may obtain a copy of the License at |
---|
| 6 | // |
---|
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 8 | // |
---|
| 9 | // Unless required by applicable law or agreed to in writing, software |
---|
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 12 | // See the License for the specific language governing permissions and |
---|
| 13 | // limitations under the License. |
---|
| 14 | |
---|
[922] | 15 | package de.ugoe.cs.autoquest.tasktrees.treeimpl; |
---|
[445] | 16 | |
---|
| 17 | import static org.junit.Assert.assertEquals; |
---|
| 18 | import static org.junit.Assert.assertNotNull; |
---|
| 19 | import static org.junit.Assert.assertNull; |
---|
| 20 | |
---|
| 21 | import java.util.HashMap; |
---|
| 22 | import java.util.Map; |
---|
| 23 | |
---|
| 24 | import org.junit.Test; |
---|
| 25 | |
---|
[922] | 26 | import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; |
---|
| 27 | import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; |
---|
| 28 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; |
---|
| 29 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; |
---|
| 30 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree; |
---|
| 31 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeBuilder; |
---|
| 32 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; |
---|
| 33 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeFactory; |
---|
| 34 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeInfo; |
---|
| 35 | import de.ugoe.cs.autoquest.tasktrees.treeimpl.NodeInfo; |
---|
| 36 | import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeBuilder; |
---|
| 37 | import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNodeFactory; |
---|
| 38 | import de.ugoe.cs.autoquest.test.DummyGUIElement; |
---|
| 39 | import de.ugoe.cs.autoquest.test.DummyInteraction; |
---|
[445] | 40 | |
---|
| 41 | /** |
---|
| 42 | * TODO comment |
---|
| 43 | * |
---|
| 44 | * @version $Revision: $ $Date: 02.04.2012$ |
---|
| 45 | * @author 2012, last modified by $Author: patrick$ |
---|
| 46 | */ |
---|
[557] | 47 | public class TaskTreeImplTest { |
---|
[445] | 48 | |
---|
[557] | 49 | /** */ |
---|
| 50 | private static final int MAX_TREE_DEPTH = 15; |
---|
| 51 | |
---|
| 52 | /** */ |
---|
| 53 | private ITaskTreeBuilder taskTreeBuilder = new TaskTreeBuilder(); |
---|
| 54 | |
---|
| 55 | /** */ |
---|
| 56 | private ITaskTreeNodeFactory taskTreeNodeFactory = new TaskTreeNodeFactory(); |
---|
| 57 | |
---|
| 58 | /** |
---|
| 59 | * @throws Exception |
---|
| 60 | * |
---|
| 61 | */ |
---|
| 62 | @Test |
---|
| 63 | public void testRandomTrees() throws Exception { |
---|
| 64 | int noOfTrees = 10; |
---|
| 65 | int noOfMaxChildren = 8; |
---|
| 66 | int maxDepth = MAX_TREE_DEPTH; |
---|
| 67 | |
---|
| 68 | for (int i = 0; i < noOfTrees; i++) { |
---|
| 69 | System.err.println("iteration " + (i + 1) + ":"); |
---|
| 70 | System.err.println(" creating tree"); |
---|
| 71 | Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos = |
---|
| 72 | new HashMap<ITaskTreeNode, ITaskTreeNodeInfo>(); |
---|
| 73 | ITaskTreeNode rootNode = createTree(noOfMaxChildren, maxDepth, treeInfos); |
---|
| 74 | System.err.println(" creating task tree"); |
---|
| 75 | ITaskTree taskTree = taskTreeNodeFactory.createTaskTree(rootNode); |
---|
| 76 | |
---|
| 77 | System.err.println(" validating task tree"); |
---|
| 78 | assertEquals(rootNode, taskTree.getRoot()); |
---|
| 79 | assertMapsEqual(treeInfos, taskTree.getTaskMap()); |
---|
| 80 | } |
---|
[445] | 81 | } |
---|
| 82 | |
---|
[557] | 83 | /** |
---|
| 84 | * TODO: comment |
---|
| 85 | * |
---|
| 86 | * @param treeInfos |
---|
| 87 | * @param taskMap |
---|
| 88 | */ |
---|
| 89 | private void assertMapsEqual(Map<ITaskTreeNode, ITaskTreeNodeInfo> map1, |
---|
| 90 | Map<ITaskTreeNode, ITaskTreeNodeInfo> map2) |
---|
[445] | 91 | { |
---|
[557] | 92 | try { |
---|
| 93 | if (map1 == null) { |
---|
| 94 | assertNull(map2); |
---|
| 95 | return; |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | assertEquals(map1.size(), map2.size()); |
---|
| 99 | |
---|
| 100 | for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : map1.entrySet()) { |
---|
| 101 | ITaskTreeNodeInfo value2 = map2.get(entry.getKey()); |
---|
| 102 | assertNotNull(value2); |
---|
| 103 | assertEquals(entry.getValue().getTask(), value2.getTask()); |
---|
| 104 | assertEquals(entry.getValue().getNoOfOccurencesInTree(), |
---|
| 105 | value2.getNoOfOccurencesInTree()); |
---|
| 106 | } |
---|
| 107 | } |
---|
| 108 | catch (AssertionError e) { |
---|
| 109 | dumpMap(map1); |
---|
| 110 | dumpMap(map2); |
---|
| 111 | throw e; |
---|
| 112 | } |
---|
[445] | 113 | } |
---|
[557] | 114 | |
---|
| 115 | /** |
---|
| 116 | * TODO: comment |
---|
| 117 | * |
---|
| 118 | * @param map2 |
---|
| 119 | */ |
---|
| 120 | private void dumpMap(Map<ITaskTreeNode, ITaskTreeNodeInfo> map) { |
---|
| 121 | System.err.println(); |
---|
| 122 | |
---|
| 123 | if (map == null) { |
---|
| 124 | System.err.println("map is null"); |
---|
| 125 | } |
---|
| 126 | else { |
---|
| 127 | System.err.println("map:"); |
---|
| 128 | for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : map.entrySet()) { |
---|
| 129 | System.err.print(" "); |
---|
| 130 | System.err.print(entry.getKey()); |
---|
| 131 | for (int i = entry.getKey().toString().length(); i < 49; i++) { |
---|
| 132 | System.err.print(" "); |
---|
| 133 | } |
---|
| 134 | System.err.print(" : "); |
---|
| 135 | System.err.println(entry.getValue()); |
---|
| 136 | } |
---|
| 137 | } |
---|
| 138 | |
---|
| 139 | System.err.println(); |
---|
[445] | 140 | } |
---|
| 141 | |
---|
[557] | 142 | /** |
---|
| 143 | * TODO: comment |
---|
| 144 | * |
---|
| 145 | * @param noOfMaxChildren |
---|
| 146 | * @param maxDepth |
---|
| 147 | * @param treeInfos |
---|
| 148 | * @return |
---|
| 149 | */ |
---|
| 150 | private ITaskTreeNode createTree(int maxNoOfChildren, |
---|
| 151 | int maxDepth, |
---|
| 152 | Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos) |
---|
| 153 | throws Exception |
---|
[445] | 154 | { |
---|
[557] | 155 | /* |
---|
| 156 | * for (int i = 0; i < (MAX_TREE_DEPTH + 1 - maxDepth); i++) { System.err.print(" "); } |
---|
| 157 | */ |
---|
| 158 | |
---|
| 159 | ITaskTreeNode tree; |
---|
| 160 | |
---|
| 161 | // integrating the maximum depth here assures, that either something between 0 and 8 will |
---|
| 162 | // be the type, or if the max depth decreases near 0 only event tasks will be created |
---|
| 163 | // to finish the tree creation |
---|
| 164 | int type = (int) (Math.random() * (Math.min(8, maxDepth))); |
---|
| 165 | |
---|
| 166 | switch (type) |
---|
[445] | 167 | { |
---|
[557] | 168 | case 0: { |
---|
| 169 | // System.err.print("creating new event task "); |
---|
| 170 | tree = createNewEventTask(treeInfos); |
---|
| 171 | break; |
---|
| 172 | } |
---|
| 173 | case 1: { |
---|
| 174 | // System.err.print("reusing event task "); |
---|
| 175 | tree = reuseEventTask(treeInfos); |
---|
| 176 | break; |
---|
| 177 | } |
---|
| 178 | case 2: { |
---|
| 179 | // System.err.println("creating new sequence {"); |
---|
| 180 | tree = createNewSequence(maxNoOfChildren, maxDepth, treeInfos); |
---|
| 181 | break; |
---|
| 182 | } |
---|
| 183 | case 3: { |
---|
| 184 | // System.err.println("reusing sequence {"); |
---|
| 185 | tree = reuseSequence(maxNoOfChildren, maxDepth, treeInfos); |
---|
| 186 | break; |
---|
| 187 | } |
---|
| 188 | case 4: { |
---|
| 189 | // System.err.println("creating new selection {"); |
---|
| 190 | tree = createNewSelection(maxNoOfChildren, maxDepth, treeInfos); |
---|
| 191 | break; |
---|
| 192 | } |
---|
| 193 | case 5: { |
---|
| 194 | // System.err.println("reusing selection {"); |
---|
| 195 | tree = reuseSelection(maxNoOfChildren, maxDepth, treeInfos); |
---|
| 196 | break; |
---|
| 197 | } |
---|
| 198 | case 6: { |
---|
| 199 | // System.err.println("creating new iteration {"); |
---|
| 200 | tree = createNewIteration(maxNoOfChildren, maxDepth, treeInfos); |
---|
| 201 | break; |
---|
| 202 | } |
---|
| 203 | case 7: { |
---|
| 204 | // System.err.println("reusing iteration {"); |
---|
| 205 | tree = reuseIteration(maxNoOfChildren, maxDepth, treeInfos); |
---|
| 206 | break; |
---|
| 207 | } |
---|
| 208 | default: { |
---|
| 209 | // System.err.print("creating new event task per default "); |
---|
| 210 | tree = createNewEventTask(treeInfos); |
---|
| 211 | } |
---|
[445] | 212 | } |
---|
[557] | 213 | |
---|
| 214 | /* |
---|
| 215 | * if (!(tree instanceof InteractionTask)) { for (int i = 0; i < (MAX_TREE_DEPTH + 1 - |
---|
| 216 | * maxDepth); i++) { System.err.print(" "); } |
---|
| 217 | * |
---|
| 218 | * System.err.print("} "); } |
---|
| 219 | * |
---|
| 220 | * System.err.println(tree); |
---|
| 221 | */ |
---|
| 222 | |
---|
| 223 | return tree; |
---|
[445] | 224 | } |
---|
| 225 | |
---|
[557] | 226 | /** |
---|
| 227 | * TODO: comment |
---|
| 228 | * |
---|
| 229 | * @param treeInfos |
---|
| 230 | * @return |
---|
| 231 | */ |
---|
| 232 | private IEventTask createNewEventTask(Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos) |
---|
| 233 | throws Exception |
---|
[445] | 234 | { |
---|
[557] | 235 | Thread.sleep(2); |
---|
| 236 | long id = System.currentTimeMillis(); |
---|
| 237 | IEventTask task = |
---|
| 238 | taskTreeNodeFactory.createNewEventTask(new DummyInteraction("interaction" + id, 1), |
---|
| 239 | new DummyGUIElement("elem" + id)); |
---|
| 240 | |
---|
| 241 | treeInfos.put(task, new NodeInfo(task)); |
---|
| 242 | |
---|
| 243 | return task; |
---|
[445] | 244 | } |
---|
[557] | 245 | |
---|
| 246 | /** |
---|
| 247 | * TODO: comment |
---|
| 248 | * |
---|
| 249 | * @param treeInfos |
---|
| 250 | * @return |
---|
| 251 | */ |
---|
| 252 | private IEventTask reuseEventTask(Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos) |
---|
| 253 | throws Exception |
---|
[445] | 254 | { |
---|
[557] | 255 | int noOfEventTasks = 0; |
---|
[445] | 256 | |
---|
[557] | 257 | for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : treeInfos.entrySet()) { |
---|
| 258 | if (entry.getKey() instanceof IEventTask) { |
---|
| 259 | noOfEventTasks++; |
---|
| 260 | } |
---|
| 261 | } |
---|
[445] | 262 | |
---|
[557] | 263 | if (noOfEventTasks > 0) { |
---|
| 264 | noOfEventTasks = (int) (Math.random() * noOfEventTasks); |
---|
| 265 | |
---|
| 266 | for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : treeInfos.entrySet()) { |
---|
| 267 | if (entry.getKey() instanceof IEventTask) { |
---|
| 268 | if (--noOfEventTasks <= 0) { |
---|
| 269 | return (IEventTask) entry.getKey(); |
---|
| 270 | } |
---|
| 271 | } |
---|
| 272 | } |
---|
| 273 | } |
---|
| 274 | else { |
---|
| 275 | return createNewEventTask(treeInfos); |
---|
| 276 | } |
---|
| 277 | |
---|
| 278 | throw new RuntimeException("this is an implementation error"); |
---|
[445] | 279 | } |
---|
[557] | 280 | |
---|
| 281 | /** |
---|
| 282 | * TODO: comment |
---|
| 283 | * |
---|
| 284 | * @param treeInfos |
---|
| 285 | * @return |
---|
| 286 | */ |
---|
| 287 | private ISequence createNewSequence(int maxNoOfChildren, |
---|
| 288 | int maxDepth, |
---|
| 289 | Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos) |
---|
| 290 | throws Exception |
---|
[445] | 291 | { |
---|
[557] | 292 | ISequence sequence = taskTreeNodeFactory.createNewSequence(); |
---|
| 293 | |
---|
| 294 | int noOfChildren = (int) (Math.random() * maxNoOfChildren); |
---|
| 295 | |
---|
| 296 | for (int i = 0; i < noOfChildren; i++) { |
---|
| 297 | ITaskTreeNode child = createTree(maxNoOfChildren, maxDepth - 1, treeInfos); |
---|
| 298 | |
---|
| 299 | // through first removing an existing parent it is assured, that a parent is recorded |
---|
| 300 | // only once. This is needed, because parent may be reused in a tree as well, but we |
---|
| 301 | // always |
---|
| 302 | // iterate the whole tree |
---|
| 303 | ((NodeInfo) treeInfos.get(child)).removeParent(sequence); |
---|
| 304 | ((NodeInfo) treeInfos.get(child)).addParent(sequence); |
---|
| 305 | taskTreeBuilder.addChild(sequence, child); |
---|
[445] | 306 | } |
---|
[557] | 307 | |
---|
| 308 | treeInfos.put(sequence, new NodeInfo(sequence)); |
---|
| 309 | return sequence; |
---|
[445] | 310 | } |
---|
[557] | 311 | |
---|
| 312 | /** |
---|
| 313 | * TODO: comment |
---|
| 314 | * |
---|
| 315 | * @param treeInfos |
---|
| 316 | * @return |
---|
| 317 | */ |
---|
| 318 | private ISequence reuseSequence(int maxNoOfChildren, |
---|
| 319 | int maxDepth, |
---|
| 320 | Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos) |
---|
| 321 | throws Exception |
---|
[445] | 322 | { |
---|
[557] | 323 | int noOfSequences = 0; |
---|
| 324 | |
---|
| 325 | for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : treeInfos.entrySet()) { |
---|
| 326 | if (entry.getKey() instanceof ISequence) { |
---|
| 327 | noOfSequences++; |
---|
| 328 | } |
---|
| 329 | } |
---|
| 330 | |
---|
| 331 | if (noOfSequences > 0) { |
---|
| 332 | noOfSequences = (int) (Math.random() * noOfSequences); |
---|
| 333 | |
---|
| 334 | for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : treeInfos.entrySet()) { |
---|
| 335 | if (entry.getKey() instanceof ISequence) { |
---|
| 336 | if (--noOfSequences <= 0) { |
---|
| 337 | return (ISequence) entry.getKey(); |
---|
| 338 | } |
---|
| 339 | } |
---|
| 340 | } |
---|
| 341 | } |
---|
| 342 | else { |
---|
| 343 | return createNewSequence(maxNoOfChildren, maxDepth, treeInfos); |
---|
| 344 | } |
---|
| 345 | |
---|
| 346 | throw new RuntimeException("this is an implementation error"); |
---|
[445] | 347 | } |
---|
| 348 | |
---|
[557] | 349 | /** |
---|
| 350 | * TODO: comment |
---|
| 351 | * |
---|
| 352 | * @param treeInfos |
---|
| 353 | * @return |
---|
| 354 | */ |
---|
| 355 | private ISelection createNewSelection(int maxNoOfChildren, |
---|
| 356 | int maxDepth, |
---|
| 357 | Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos) |
---|
| 358 | throws Exception |
---|
[445] | 359 | { |
---|
[557] | 360 | ISelection selection = taskTreeNodeFactory.createNewSelection(); |
---|
[445] | 361 | |
---|
[557] | 362 | int noOfChildren = (int) (Math.random() * maxNoOfChildren); |
---|
| 363 | |
---|
| 364 | for (int i = 0; i < noOfChildren; i++) { |
---|
| 365 | ITaskTreeNode child = createTree(maxNoOfChildren, maxDepth - 1, treeInfos); |
---|
| 366 | |
---|
| 367 | // through first removing an existing parent it is assured, that a parent is recorded |
---|
| 368 | // only once. This is needed, because parent may be reused in a tree as well, but we |
---|
| 369 | // always |
---|
| 370 | // iterate the whole tree |
---|
| 371 | ((NodeInfo) treeInfos.get(child)).removeParent(selection); |
---|
| 372 | ((NodeInfo) treeInfos.get(child)).addParent(selection); |
---|
| 373 | taskTreeBuilder.addChild(selection, child); |
---|
[445] | 374 | } |
---|
[557] | 375 | |
---|
| 376 | treeInfos.put(selection, new NodeInfo(selection)); |
---|
| 377 | return selection; |
---|
[445] | 378 | } |
---|
| 379 | |
---|
[557] | 380 | /** |
---|
| 381 | * TODO: comment |
---|
| 382 | * |
---|
| 383 | * @param treeInfos |
---|
| 384 | * @return |
---|
| 385 | */ |
---|
| 386 | private ISelection reuseSelection(int maxNoOfChildren, |
---|
| 387 | int maxDepth, |
---|
| 388 | Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos) |
---|
| 389 | throws Exception |
---|
[445] | 390 | { |
---|
[557] | 391 | int noOfSelections = 0; |
---|
[445] | 392 | |
---|
[557] | 393 | for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : treeInfos.entrySet()) { |
---|
| 394 | if (entry.getKey() instanceof ISelection) { |
---|
| 395 | noOfSelections++; |
---|
| 396 | } |
---|
[445] | 397 | } |
---|
[557] | 398 | |
---|
| 399 | if (noOfSelections > 0) { |
---|
| 400 | noOfSelections = (int) (Math.random() * noOfSelections); |
---|
| 401 | |
---|
| 402 | for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : treeInfos.entrySet()) { |
---|
| 403 | if (entry.getKey() instanceof ISelection) { |
---|
| 404 | if (--noOfSelections <= 0) { |
---|
| 405 | return (ISelection) entry.getKey(); |
---|
| 406 | } |
---|
| 407 | } |
---|
| 408 | } |
---|
| 409 | } |
---|
| 410 | else { |
---|
| 411 | return createNewSelection(maxNoOfChildren, maxDepth, treeInfos); |
---|
| 412 | } |
---|
| 413 | |
---|
| 414 | throw new RuntimeException("this is an implementation error"); |
---|
[445] | 415 | } |
---|
[557] | 416 | |
---|
| 417 | /** |
---|
| 418 | * TODO: comment |
---|
| 419 | * |
---|
| 420 | * @param treeInfos |
---|
| 421 | * @return |
---|
| 422 | */ |
---|
| 423 | private IIteration createNewIteration(int maxNoOfChildren, |
---|
| 424 | int maxDepth, |
---|
| 425 | Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos) |
---|
| 426 | throws Exception |
---|
[445] | 427 | { |
---|
[557] | 428 | IIteration iteration = taskTreeNodeFactory.createNewIteration(); |
---|
[445] | 429 | |
---|
[557] | 430 | ITaskTreeNode child = createTree(maxNoOfChildren, maxDepth - 1, treeInfos); |
---|
[445] | 431 | |
---|
[557] | 432 | // through first removing an existing parent it is assured, that a parent is recorded |
---|
| 433 | // only once. This is needed, because parent may be reused in a tree as well, but we always |
---|
| 434 | // iterate the whole tree |
---|
| 435 | ((NodeInfo) treeInfos.get(child)).removeParent(iteration); |
---|
| 436 | ((NodeInfo) treeInfos.get(child)).addParent(iteration); |
---|
| 437 | taskTreeBuilder.setChild(iteration, child); |
---|
| 438 | |
---|
| 439 | treeInfos.put(iteration, new NodeInfo(iteration)); |
---|
| 440 | return iteration; |
---|
[445] | 441 | } |
---|
[557] | 442 | |
---|
| 443 | /** |
---|
| 444 | * TODO: comment |
---|
| 445 | * |
---|
| 446 | * @param treeInfos |
---|
| 447 | * @return |
---|
| 448 | */ |
---|
| 449 | private IIteration reuseIteration(int maxNoOfChildren, |
---|
| 450 | int maxDepth, |
---|
| 451 | Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos) |
---|
| 452 | throws Exception |
---|
[445] | 453 | { |
---|
[557] | 454 | int noOfIterations = 0; |
---|
| 455 | |
---|
| 456 | for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : treeInfos.entrySet()) { |
---|
| 457 | if (entry.getKey() instanceof IIteration) { |
---|
| 458 | noOfIterations++; |
---|
| 459 | } |
---|
[445] | 460 | } |
---|
[557] | 461 | |
---|
| 462 | if (noOfIterations > 0) { |
---|
| 463 | noOfIterations = (int) (Math.random() * noOfIterations); |
---|
| 464 | |
---|
| 465 | for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : treeInfos.entrySet()) { |
---|
| 466 | if (entry.getKey() instanceof IIteration) { |
---|
| 467 | if (--noOfIterations <= 0) { |
---|
| 468 | return (IIteration) entry.getKey(); |
---|
| 469 | } |
---|
| 470 | } |
---|
| 471 | } |
---|
| 472 | } |
---|
| 473 | else { |
---|
| 474 | return createNewIteration(maxNoOfChildren, maxDepth, treeInfos); |
---|
| 475 | } |
---|
| 476 | |
---|
| 477 | throw new RuntimeException("this is an implementation error"); |
---|
[445] | 478 | } |
---|
| 479 | |
---|
| 480 | } |
---|