source: trunk/autoquest-core-tasktrees/src/main/java/de/ugoe/cs/autoquest/tasktrees/treeifc/TaskTreeUtils.java @ 1767

Last change on this file since 1767 was 1767, checked in by pharms, 10 years ago
  • first version of merging similar task trees
File size: 1.6 KB
Line 
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
15package de.ugoe.cs.autoquest.tasktrees.treeifc;
16
17/**
18 * <p>
19 * TODO comment
20 * </p>
21 *
22 * @author Patrick Harms
23 */
24public class TaskTreeUtils {
25   
26    /**
27     *
28     */
29    public static boolean isChild(ITask potentialChild, ITask potentialParent) {
30        if (potentialParent instanceof IStructuringTemporalRelationship) {
31            for (ITask child : ((IStructuringTemporalRelationship) potentialParent).getChildren()) {
32                if (child.equals(potentialChild) || isChild(potentialChild, child)) {
33                    return true;
34                }
35            }
36        }
37        else if (potentialParent instanceof IMarkingTemporalRelationship) {
38            ITask child = ((IMarkingTemporalRelationship) potentialParent).getMarkedTask();
39            if (child.equals(potentialChild) || isChild(potentialChild, child)) {
40                return true;
41            }
42        }
43       
44        return false;
45    }
46
47   
48    /**
49     *
50     */
51    private TaskTreeUtils() { /* prevent instantiation */ }
52}
Note: See TracBrowser for help on using the repository browser.