View Javadoc

1   /*
2    wsmo4j - a WSMO API and Reference Implementation
3    Copyright (c) 2005 University of Innsbruck, Austria
4                  2005 National University of Ireland, Galway
5    This library is free software; you can redistribute it and/or modify it under
6    the terms of the GNU Lesser General Public License as published by the Free
7    Software Foundation; either version 2.1 of the License, or (at your option)
8    any later version.
9    This library is distributed in the hope that it will be useful, but WITHOUT
10   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   details.
13   You should have received a copy of the GNU Lesser General Public License along
14   with this library; if not, write to the Free Software Foundation, Inc.,
15   59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16   */
17  package org.deri.wsmo4j.logicalexpression;
18  
19  
20  import org.omwg.logicalexpression.*;
21  import org.omwg.logicalexpression.Visitor;
22  import org.omwg.logicalexpression.terms.*;
23  
24  
25  /**
26   * @author DERI Innsbruck, reto.krummenacher@deri.org
27   * @author DERI Innsbruck, thomas.haselwanter@deri.org
28   * @author DERI Innsbruck, holger.lausen@deri.org
29   */
30  public class AttributeInferenceMoleculeImpl
31          extends AttributeMoleculeImpl
32          implements AttributeInferenceMolecule {
33  
34      public AttributeInferenceMoleculeImpl(Term leftTerm, Term attributeName, Term rightTerm) {
35          super(leftTerm,attributeName,rightTerm);
36      }
37      
38      public void accept(Visitor v) {
39          v.visitAttributeInferenceMolecule(this);
40      }
41  
42  
43      /**
44       * <p>
45       * The <code>equals</code> method implements an equivalence relation
46       * on non-null object references. Attribute Specifications are equal if their operator,
47       * their name and their arguments are equal.
48       * </p>
49       * <p>
50       * It is generally necessary to override the <code>hashCode</code> method whenever this method
51       * is overridden.
52       * </p>
53       * @param o the reference object with which to compare.
54       * @return <code>true</code> if this object is the same as the obj
55       *          argument; <code>false</code> otherwise.
56       * @see java.lang.Object#equals(java.lang.Object)
57       * @see java.lang.Object#hashCode()
58       */
59      public boolean equals(Object o) {
60          if (o instanceof AttributeInferenceMolecule) {
61              AttributeInferenceMolecule as = (AttributeInferenceMolecule)o;
62              return (attributeName.equals(as.getAttribute())
63                      && getLeftParameter().equals(as.getLeftParameter())
64                      && getRightParameter().equals(as.getRightParameter()));
65          }
66          return false;
67      }
68  }