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  
18  package org.deri.wsmo4j.logicalexpression;
19  
20  
21  import org.omwg.logicalexpression.*;
22  
23  
24  /**
25   * @author DERI Innsbruck, reto.krummenacher@deri.org
26   * @author DERI Innsbruck, thomas.haselwanter@deri.org
27   */
28  public class InverseImplicationImpl
29          extends BinaryImpl
30          implements InverseImplication {
31  
32      public InverseImplicationImpl(LogicalExpression exprLeft, LogicalExpression exprRight)
33              throws IllegalArgumentException {
34          super(exprLeft, exprRight);
35      }
36  
37      public void accept(Visitor v) {
38          v.visitInverseImplication(this);
39      }
40  
41      /**
42       * <p>
43       * The <code>equals</code> method implements an equivalence relation
44       * on non-null object references. Binary expressions are equal if their operator, their
45       * left logical expression and their right logical expression are equal.
46       * In case the operator is either EQUIVALENT, OR or AND, the left logical expression
47       * must to be equal to either the left or the right logical expression of the obj
48       * argument and analogous for the right logical expression.
49       * </p>
50       * <p>
51       * It is generally necessary to override the <code>hashCode</code> method whenever this method
52       * is overridden.
53       * </p>
54       * @param o the reference object with which to compare.
55       * @return <code>true</code> if this object is the same as the obj
56       *          argument; <code>false</code> otherwise.
57       * @see java.lang.Object#equals(java.lang.Object)
58       * @see java.lang.Object#hashCode()
59       */
60      public boolean equals(Object o) {
61          if (o instanceof InverseImplication) {
62              InverseImplication b = (InverseImplication)o;
63              return b.getLeftOperand().equals(exprLeft)
64                      && b.getRightOperand().equals(exprRight);
65          }
66          return false;
67      }
68  }