View Javadoc

1   /* This file is part of the project "Hilbert II" - http://www.qedeq.org" target="alexandria_uri">http://www.qedeq.org
2    *
3    * Copyright 2000-2014,  Michael Meyling <mime@qedeq.org>.
4    *
5    * "Hilbert II" is free software; you can redistribute
6    * it and/or modify it under the terms of the GNU General Public
7    * License as published by the Free Software Foundation; either
8    * version 2 of the License, or (at your option) any later version.
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   * GNU General Public License for more details.
14   */
15  
16  package org.qedeq.kernel.bo.logic.common;
17  
18  import org.qedeq.base.utility.EqualsUtility;
19  
20  /**
21   * One subject variable. This class is mainly used in the model area.
22   * For this kernel he normal form of a subject variable is an
23   * {@link org.qedeq.kernel.se.base.list.ElementList}
24   * with an {@link org.qedeq.kernel.se.base.list.Atom} with the name of the subject variable.
25   *
26   * @author  Michael Meyling
27   */
28  public class SubjectVariable {
29  
30      /** Text to identify the subject variable. */
31      private final String name;
32  
33      /**
34       * Constructor.
35       *
36       * @param   name        Show this to represent the subject variable within outputs.
37       */
38      public SubjectVariable(final String name) {
39          this.name = name;
40      }
41  
42      /**
43       * Get subject variable name.
44       *
45       * @return  Subject variable name.
46       */
47      public String getName() {
48          return name;
49      }
50  
51      public int hashCode() {
52          return name.hashCode();
53      }
54  
55      public boolean equals(final Object other) {
56          if (!(other instanceof SubjectVariable)) {
57              return false;
58          }
59          final SubjectVariable var = (SubjectVariable) other;
60          return EqualsUtility.equals(name, var.name);
61      }
62  
63      public String toString() {
64          return name;
65      }
66  
67  }