1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using System.Collections.Generic;
|
---|
23 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
24 | namespace HeuristicLab.Data {
|
---|
25 | [StorableClass]
|
---|
26 | public sealed class ComparisonOperation {
|
---|
27 | public static readonly ComparisonOperation Equal = new ComparisonOperation(0, "Equal");
|
---|
28 | public static readonly ComparisonOperation NotEqual = new ComparisonOperation(1, "Not equal");
|
---|
29 | public static readonly ComparisonOperation Lesser = new ComparisonOperation(2, "Lesser");
|
---|
30 | public static readonly ComparisonOperation LesserOrEqual = new ComparisonOperation(3, "Lesser or equal");
|
---|
31 | public static readonly ComparisonOperation Greater = new ComparisonOperation(4, "Greater");
|
---|
32 | public static readonly ComparisonOperation GreaterOrEqual = new ComparisonOperation(5, "Greater or equal");
|
---|
33 | public static readonly ComparisonOperation IsTypeOf = new ComparisonOperation(6, "Is type of");
|
---|
34 | public static readonly ComparisonOperation IsNotTypeOf = new ComparisonOperation(7, "Is not type of");
|
---|
35 |
|
---|
36 | [Storable]
|
---|
37 | private int value;
|
---|
38 | [Storable]
|
---|
39 | private string name;
|
---|
40 | [StorableConstructor]
|
---|
41 | private ComparisonOperation() {
|
---|
42 | value = -1;
|
---|
43 | name = "empty";
|
---|
44 | }
|
---|
45 | private ComparisonOperation(int value, string name) {
|
---|
46 | this.value = value;
|
---|
47 | this.name = name;
|
---|
48 | }
|
---|
49 |
|
---|
50 | public override string ToString() {
|
---|
51 | return name;
|
---|
52 | }
|
---|
53 |
|
---|
54 | public override bool Equals(object obj) {
|
---|
55 | if (obj is ComparisonOperation)
|
---|
56 | return this == (ComparisonOperation)obj;
|
---|
57 |
|
---|
58 | return false;
|
---|
59 | }
|
---|
60 | public override int GetHashCode() {
|
---|
61 | return value;
|
---|
62 | }
|
---|
63 | public static bool operator ==(ComparisonOperation co1, ComparisonOperation co2) {
|
---|
64 | return co1.value == co2.value;
|
---|
65 | }
|
---|
66 | public static bool operator !=(ComparisonOperation co1, ComparisonOperation co2) {
|
---|
67 | return !(co1 == co2);
|
---|
68 | }
|
---|
69 | }
|
---|
70 | } |
---|