source: branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskIdentityRule.java

Last change on this file was 1734, checked in by rkrimmel, 10 years ago

Added automatically created javadoc, still needs to be commented properly though

  • Property svn:executable set to *
File size: 3.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.taskequality;
16
17import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
18import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance;
19
20// TODO: Auto-generated Javadoc
21/**
22 * <p>
23 * This comparison rule returns <code>TaskEquality.IDENTICAL</code> if the
24 * comparison of the two tasks using the <code>==</code> operator returns true.
25 * Else it returns null to denote, that it can not compare the tasks.
26 * </p>
27 *
28 * @author 2012, last modified by $Author: patrick$
29 * @version $Revision: $ $Date: 19.02.2012$
30 */
31public class TaskIdentityRule implements TaskComparisonRule {
32
33        /*
34         * (non-Javadoc)
35         *
36         * @see TaskComparisonRule#areLexicallyEqual(ITask, ITask)
37         */
38        @Override
39        public boolean areLexicallyEqual(ITask task1, ITask task2) {
40                return (task1 == task2);
41        }
42
43        /*
44         * (non-Javadoc)
45         *
46         * @see TaskComparisonRule#areLexicallyEqual(ITaskInstance, ITaskInstance)
47         */
48        @Override
49        public boolean areLexicallyEqual(ITaskInstance instance1,
50                        ITaskInstance instance2) {
51                return (instance1.getTask() == instance2.getTask());
52        }
53
54        /*
55         * (non-Javadoc)
56         *
57         * @see TaskComparisonRule#areSemanticallyEqual(ITask, ITask)
58         */
59        @Override
60        public boolean areSemanticallyEqual(ITask task1, ITask task2) {
61                return (task1 == task2);
62        }
63
64        /*
65         * (non-Javadoc)
66         *
67         * @see TaskComparisonRule#areSemanticallyEqual(ITaskInstance,
68         * ITaskInstance)
69         */
70        @Override
71        public boolean areSemanticallyEqual(ITaskInstance instance1,
72                        ITaskInstance instance2) {
73                return (instance1.getTask() == instance2.getTask());
74        }
75
76        /*
77         * (non-Javadoc)
78         *
79         * @see TaskComparisonRule#areSyntacticallyEqual(ITask, ITask)
80         */
81        @Override
82        public boolean areSyntacticallyEqual(ITask task1, ITask task2) {
83                return (task1 == task2);
84        }
85
86        /*
87         * (non-Javadoc)
88         *
89         * @see TaskComparisonRule#areSyntacticallyEqual(ITaskInstance,
90         * ITaskInstance)
91         */
92        @Override
93        public boolean areSyntacticallyEqual(ITaskInstance instance1,
94                        ITaskInstance instance2) {
95                return (instance1.getTask() == instance2.getTask());
96        }
97
98        /*
99         * (non-Javadoc)
100         *
101         * @see TaskComparisonRule#compare(ITask, ITask)
102         */
103        @Override
104        public TaskEquality compare(ITask task1, ITask task2) {
105                if (isApplicable(task1, task2)) {
106                        return TaskEquality.IDENTICAL;
107                } else {
108                        return null;
109                }
110        }
111
112        /*
113         * (non-Javadoc)
114         *
115         * @see TaskComparisonRule#compare(ITaskInstance, ITaskInstance)
116         */
117        @Override
118        public TaskEquality compare(ITaskInstance instance1, ITaskInstance instance2) {
119                if (isApplicable(instance1, instance2)) {
120                        return TaskEquality.IDENTICAL;
121                } else {
122                        return null;
123                }
124        }
125
126        /*
127         * (non-Javadoc)
128         *
129         * @see TaskComparisonRule#isApplicable(ITask, ITask)
130         */
131        @Override
132        public boolean isApplicable(ITask task1, ITask task2) {
133                return (task1 == task2);
134        }
135
136        /*
137         * (non-Javadoc)
138         *
139         * @see TaskComparisonRule#isApplicable(ITaskInstance, ITaskInstance)
140         */
141        @Override
142        public boolean isApplicable(ITaskInstance instance1, ITaskInstance instance2) {
143                return (instance1.getTask() == instance2.getTask());
144        }
145
146}
Note: See TracBrowser for help on using the repository browser.