View Javadoc

1   /*
2    wsmo4j - a WSMO API and Reference Implementation
3   
4    Copyright (c) 2004-2005, OntoText Lab. / SIRMA
5   
6    This library is free software; you can redistribute it and/or modify it under
7    the terms of the GNU Lesser General Public License as published by the Free
8    Software Foundation; either version 2.1 of the License, or (at your option)
9    any later version.
10   This library is distributed in the hope that it will be useful, but WITHOUT
11   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12   FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13   details.
14   You should have received a copy of the GNU Lesser General Public License along
15   with this library; if not, write to the Free Software Foundation, Inc.,
16   59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17   */
18  
19  
20  package com.ontotext.wsmo4j.ontology;
21  
22  /**
23   * <p>Title: WSMO4J</p>
24   * <p>Description: WSMO API and a Reference Implementation</p>
25   * <p>Copyright:  Copyright (c) 2004-2005</p>
26   * <p>Company: OntoText Lab. / SIRMA </p>
27   * @author not attributable
28   * @version 1.0
29   *
30   */
31  import java.util.Collections;
32  import java.util.LinkedHashSet;
33  import java.util.Set;
34  
35  import org.omwg.ontology.Axiom;
36  import org.omwg.logicalexpression.LogicalExpression;
37  import org.wsmo.common.Identifier;
38  
39  
40  public class AxiomImpl extends OntologyElementImpl
41          implements Axiom {
42      
43      private LinkedHashSet <LogicalExpression> definitions;
44  
45      public AxiomImpl(Identifier thisID) {
46          super(thisID);
47          definitions = new LinkedHashSet <LogicalExpression> ();
48      }
49  
50      public Set <LogicalExpression> listDefinitions() {
51          return Collections.unmodifiableSet(definitions);
52      }
53  
54      public void addDefinition(LogicalExpression definition) {
55          if (definition == null) {
56              throw new IllegalArgumentException();
57          }
58          definitions.add(definition);
59      }
60  
61      public void removeDefinition(LogicalExpression le) {
62          if (le == null) {
63              throw new IllegalArgumentException();
64          }
65          definitions.remove(le);
66      }
67      
68      public boolean equals(Object target) {
69          if (target == this) {
70              return true; // instance match
71          }
72  
73          if (null == target 
74                  || false == target instanceof Axiom) {
75              return false;
76          }
77          return super.equals(target);
78      }
79  }
80  
81  /*
82   * $Log$
83   * Revision 1.16  2007/04/02 12:13:20  morcen
84   * Generics support added to wsmo-api, wsmo4j and wsmo-test
85   *
86   * Revision 1.15  2005/09/02 13:32:45  ohamano
87   * move logicalexpression packages from ext to core
88   * move tests from logicalexpression.test to test module
89   *
90   * Revision 1.14  2005/06/22 09:16:05  alex_simov
91   * Simplified equals() method. Identity strongly relies on identifier string
92   *
93   * Revision 1.13  2005/06/01 12:09:33  marin_dimitrov
94   * v0.4.0
95   *
96   * Revision 1.2  2005/05/17 12:04:56  alex
97   * Collections.unmodifiableSet() used instead of new set construction
98   *
99   * Revision 1.1  2005/05/11 13:40:00  alex
100  * initial commit
101  *
102  */