01 /* This file is part of the project "Hilbert II" - http://www.qedeq.org
02 *
03 * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>.
04 *
05 * "Hilbert II" is free software; you can redistribute
06 * it and/or modify it under the terms of the GNU General Public
07 * License as published by the Free Software Foundation; either
08 * version 2 of the License, or (at your option) any later version.
09 *
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.se.dto.module;
17
18 import org.qedeq.base.utility.EqualsUtility;
19 import org.qedeq.kernel.se.base.list.Element;
20 import org.qedeq.kernel.se.base.module.Term;
21
22
23 /**
24 * Wraps a term. Such an object is build out of
25 * {@link org.qedeq.kernel.se.base.list.Element}s.
26 *
27 * @author Michael Meyling
28 */
29 public class TermVo implements Term {
30
31 /** Formula or term. */
32 private Element element;
33
34 /**
35 * Constructs a term.
36 *
37 * @param element Element that should be a term.
38 */
39 public TermVo(final Element element) {
40 this.element = element;
41 }
42
43 /**
44 * Empty constructor.
45 */
46 public TermVo() {
47 // nothing to do
48 }
49
50 /**
51 * Set term.
52 *
53 * @param element Term.
54 */
55 public final void setElement(final Element element) {
56 this.element = element;
57 }
58
59 public final Element getElement() {
60 return element;
61 }
62
63 public boolean equals(final Object obj) {
64 if (!(obj instanceof TermVo)) {
65 return false;
66 }
67 final TermVo other = (TermVo) obj;
68 return EqualsUtility.equals(getElement(), other.getElement());
69 }
70
71 public int hashCode() {
72 return (getElement() != null ? getElement().hashCode() : 0);
73 }
74
75 public String toString() {
76 if (getElement() != null) {
77 return getElement().toString();
78 }
79 return "";
80 }
81
82 }
|