|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ExistentialQuantificationImpl.java | 0% | 0% | 0% | 0% |
|
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 java.util.*; | |
22 | ||
23 | import org.deri.wsmo4j.logicalexpression.util.*; | |
24 | import org.omwg.logicalexpression.*; | |
25 | import org.omwg.ontology.*; | |
26 | ||
27 | ||
28 | /** | |
29 | * @author DERI Innsbruck, reto.krummenacher@deri.org | |
30 | * @author DERI Innsbruck, thomas.haselwanter@deri.org | |
31 | */ | |
32 | public class ExistentialQuantificationImpl | |
33 | extends QuantifiedImpl | |
34 | implements ExistentialQuantification { | |
35 | ||
36 | 0 | public ExistentialQuantificationImpl(Variable variable, LogicalExpression expr) |
37 | throws IllegalArgumentException { | |
38 | 0 | this(SetUtil.createSet(variable), expr); |
39 | } | |
40 | ||
41 | 0 | public ExistentialQuantificationImpl(Set <Variable> variables, LogicalExpression expr) |
42 | throws IllegalArgumentException { | |
43 | 0 | super(variables, expr); |
44 | } | |
45 | ||
46 | 0 | public void accept(Visitor v) { |
47 | 0 | v.visitExistentialQuantification(this); |
48 | } | |
49 | ||
50 | /** | |
51 | * <p> | |
52 | * The <code>equals</code> method implements an equivalence relation | |
53 | * on non-null object references. Quantified expressions are equal if their operator, | |
54 | * their logical expresssion and their set of variables are equal. | |
55 | * </p> | |
56 | * <p> | |
57 | * It is generally necessary to override the <code>hashCode</code> method whenever this method | |
58 | * is overridden. | |
59 | * </p> | |
60 | * @param o the reference object with which to compare. | |
61 | * @return <code>true</code> if this object is the same as the obj | |
62 | * argument; <code>false</code> otherwise. | |
63 | * @see java.lang.Object#equals(java.lang.Object) | |
64 | * @see java.lang.Object#hashCode() | |
65 | */ | |
66 | 0 | public boolean equals(Object o) { |
67 | 0 | if (o instanceof ExistentialQuantification) { |
68 | 0 | ExistentialQuantification q = (ExistentialQuantification)o; |
69 | 0 | if (!variables.equals(q.listVariables())) { |
70 | 0 | return false; |
71 | } | |
72 | 0 | return expr.equals(q.getOperand()); |
73 | } | |
74 | 0 | return false; |
75 | } | |
76 | ||
77 | /** | |
78 | * <p> | |
79 | * If two objects are equal according to the <code>equals(Object)</code> method, then calling | |
80 | * the <code>hashCode</code> method on each of the two objects must produce the same integer | |
81 | * result. However, it is not required that if two objects are unequal according to | |
82 | * the <code>equals(Object)</code> method, then calling the <code>hashCode</code> method on each of the two | |
83 | * objects must produce distinct integer results. | |
84 | * </p> | |
85 | * <p> | |
86 | * This method should be overriden, when the <code>equals(Object)</code> method is overriden. | |
87 | * </p> | |
88 | * @return A hash code value for this Object. | |
89 | * @see java.lang.Object#hashCode() | |
90 | * @see java.lang.Object#equals(Object) | |
91 | * @see com.ontotext.wsmo4j.ontology.LogicalExpressionImpl#hashCode() | |
92 | * @see java.util.Set#hashCode() | |
93 | */ | |
94 | ||
95 | } |
|