View Javadoc

1   /*
2    wsmo4j - a WSMO API and Reference Implementation
3    
4    Copyright (c) 2004-2005, OntoText Lab. / SIRMA
5                            University of Innsbruck, Austria
6    
7    This library is free software; you can redistribute it and/or modify it under
8    the terms of the GNU Lesser General Public License as published by the Free
9    Software Foundation; either version 2.1 of the License, or (at your option)
10   any later version.
11   This library is distributed in the hope that it will be useful, but WITHOUT
12   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13   FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14   details.
15   You should have received a copy of the GNU Lesser General Public License along
16   with this library; if not, write to the Free Software Foundation, Inc.,
17   59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18   */
19  
20  package com.ontotext.wsmo4j.ontology;
21  
22  import org.omwg.ontology.SimpleDataType;
23  import org.omwg.ontology.WsmlDataType;
24  import org.wsmo.common.IRI;
25  
26  /**
27   * <p>Title: WSMO4J</p>
28   * <p>Description: WSMO API and a Reference Implementation</p>
29   * <p>Copyright:  Copyright (c) 2004-2005</p>
30   * <p>Company: OntoText Lab. / SIRMA </p>
31   * @author not attributable
32   * @version 1.0
33   *
34   */
35  
36  public class SimpleDataTypeImpl implements SimpleDataType{
37      IRI iri;
38      public SimpleDataTypeImpl(IRI iri) {
39          this.iri = iri;
40      }
41      public String toString() {
42          return iri.toString();
43      }
44      
45      public IRI getIRI() {
46          return iri;
47      }
48      
49      public boolean equals(Object object) {
50          if (object == this) {
51              return true;
52          }
53          if (object == null
54                  || false == object instanceof WsmlDataType) {
55              return false;
56          }
57          return toString().equals(object.toString());
58      }
59      
60      public int hashCode() {
61          return iri.hashCode();
62      }
63  }
64  
65  /*
66  * $Log$
67  * Revision 1.2  2005/09/16 14:02:44  alex_simov
68  * Identifier.asString() removed, use Object.toString() instead
69  * (Implementations MUST override toString())
70  *
71  * Revision 1.1  2005/09/06 18:33:42  holgerlausen
72  *   support for datatypes: updated implementation according to interfaces
73  *   renamed WsmlDataTypeImpl to SimpleDataTypeImpl
74  *   moved DataValueImpl to ComplexDataValueImpl
75  *   added SimpleDataValueImpl for basic strings, decimal, ints
76  *
77  * Revision 1.4  2005/07/04 15:25:16  alex_simov
78  * DataValue/DataType changes
79  *
80  */