[1113] | 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 | |
---|
[1146] | 15 | package de.ugoe.cs.autoquest.tasktrees.taskequality; |
---|
[439] | 16 | |
---|
[1146] | 17 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; |
---|
[439] | 18 | |
---|
| 19 | /** |
---|
[557] | 20 | * <p> |
---|
[1146] | 21 | * This comparison rule returns <code>TaskEquality.IDENTICAL</code> if the comparison of the two |
---|
| 22 | * tasks using the <code>==</code> operator or the <code>equals</code> method return true. |
---|
| 23 | * Else it returns null to denote, that it can not compare the tasks. |
---|
[557] | 24 | * </p> |
---|
[439] | 25 | * |
---|
| 26 | * @version $Revision: $ $Date: 19.02.2012$ |
---|
| 27 | * @author 2012, last modified by $Author: patrick$ |
---|
| 28 | */ |
---|
[1146] | 29 | public class TaskIdentityRule implements TaskComparisonRule { |
---|
[439] | 30 | |
---|
[1125] | 31 | /* (non-Javadoc) |
---|
[1146] | 32 | * @see NodeComparisonRule#isApplicable(ITask, ITask) |
---|
[557] | 33 | */ |
---|
| 34 | @Override |
---|
[1146] | 35 | public boolean isApplicable(ITask task1, ITask task2) { |
---|
| 36 | return (task1 == task2); |
---|
[1125] | 37 | } |
---|
| 38 | |
---|
| 39 | /* (non-Javadoc) |
---|
[1146] | 40 | * @see NodeComparisonRule#areLexicallyEqual(ITask, ITask) |
---|
[1125] | 41 | */ |
---|
| 42 | @Override |
---|
[1146] | 43 | public boolean areLexicallyEqual(ITask task1, ITask task2) { |
---|
| 44 | return (task1 == task2); |
---|
[1125] | 45 | } |
---|
| 46 | |
---|
| 47 | /* (non-Javadoc) |
---|
[1146] | 48 | * @see NodeComparisonRule#areSyntacticallyEqual(ITask, ITask) |
---|
[1125] | 49 | */ |
---|
| 50 | @Override |
---|
[1146] | 51 | public boolean areSyntacticallyEqual(ITask task1, ITask task2) { |
---|
| 52 | return (task1 == task2); |
---|
[1125] | 53 | } |
---|
| 54 | |
---|
| 55 | /* (non-Javadoc) |
---|
[1146] | 56 | * @see NodeComparisonRule#areSemanticallyEqual(ITask, ITask) |
---|
[1125] | 57 | */ |
---|
| 58 | @Override |
---|
[1146] | 59 | public boolean areSemanticallyEqual(ITask task1, ITask task2) { |
---|
| 60 | return (task1 == task2); |
---|
[1125] | 61 | } |
---|
| 62 | |
---|
| 63 | /* (non-Javadoc) |
---|
[1146] | 64 | * @see NodeComparisonRule#compare(ITask, ITask) |
---|
[1125] | 65 | */ |
---|
| 66 | @Override |
---|
[1146] | 67 | public TaskEquality compare(ITask task1, ITask task2) { |
---|
| 68 | if (isApplicable(task1, task2)) { |
---|
| 69 | return TaskEquality.IDENTICAL; |
---|
[557] | 70 | } |
---|
| 71 | else { |
---|
| 72 | return null; |
---|
| 73 | } |
---|
[439] | 74 | } |
---|
| 75 | |
---|
| 76 | } |
---|