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 | |
---|
15 | package de.ugoe.cs.autoquest.usageprofiles; |
---|
16 | |
---|
17 | /** |
---|
18 | * <p> |
---|
19 | * Default implementation for the {@link SymbolComparator} using the equals method of the provided |
---|
20 | * symbols for comparison. The {@link #equals(Object, Object)} method will also return true if |
---|
21 | * both symbols are <code>null</code> |
---|
22 | * </p> |
---|
23 | * |
---|
24 | * @author Patrick Harms |
---|
25 | */ |
---|
26 | public class DefaultSymbolComparator<T> implements SymbolComparator<T> { |
---|
27 | |
---|
28 | /** |
---|
29 | * default serial version UID |
---|
30 | */ |
---|
31 | private static final long serialVersionUID = 1L; |
---|
32 | |
---|
33 | /* (non-Javadoc) |
---|
34 | * @see de.ugoe.cs.autoquest.tasktrees.temporalrelation.SymbolComparator#equals(Object, Object) |
---|
35 | */ |
---|
36 | @Override |
---|
37 | public boolean equals(T symbol1, T symbol2) { |
---|
38 | if (symbol1 == null) { |
---|
39 | return (symbol2 == null); |
---|
40 | } |
---|
41 | else { |
---|
42 | return symbol1.equals(symbol2); |
---|
43 | } |
---|
44 | } |
---|
45 | |
---|
46 | } |
---|