Clover coverage report - Maven Clover report
Coverage timestamp: Tue Sep 16 2008 01:16:37 EEST
file stats: LOC: 111   Methods: 5
NCLOC: 48   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
NamespaceImpl.java 0% 0% 0% 0%
coverage
 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.common;
 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.io.Serializable;
 32   
 33    import org.wsmo.common.IRI;
 34    import org.wsmo.common.Namespace;
 35   
 36   
 37    public class NamespaceImpl
 38    implements Namespace, Serializable {
 39   
 40    private String prefix;
 41   
 42    private IRI fullIRI;
 43   
 44  0 public NamespaceImpl(String prefix, IRI fullIRI) {
 45  0 if (null == prefix
 46    || null == fullIRI
 47    // || prefix.length() == 0
 48    || fullIRI.toString().length() == 0) {
 49  0 throw new IllegalArgumentException("cannot use 'null' as "
 50    + "prefix of fullIRI!");
 51    }
 52  0 this.prefix = prefix;
 53  0 if (fullIRI.toString().endsWith("#")
 54    || fullIRI.toString().endsWith("/")) {
 55  0 this.fullIRI = fullIRI;
 56    }
 57    else {
 58  0 this.fullIRI = new IRIImpl(fullIRI.toString() + '#');
 59    }
 60    }
 61   
 62  0 public String getPrefix() {
 63  0 return prefix;
 64    }
 65   
 66  0 public IRI getIRI() {
 67  0 return fullIRI;
 68    }
 69   
 70  0 public boolean equals(Object object) {
 71  0 if (object == this) {
 72  0 return true;
 73    }
 74  0 if (object == null
 75    || false == object instanceof Namespace) {
 76  0 return false;
 77    }
 78   
 79    // internal preconditions
 80  0 assert prefix != null;
 81  0 assert fullIRI != null;
 82   
 83  0 Namespace anotherNS = (Namespace)object;
 84  0 return (this.prefix.equals(anotherNS.getPrefix())
 85    && this.fullIRI.equals(anotherNS.getIRI()));
 86    }
 87   
 88  0 public int hashCode() {
 89  0 return this.prefix.hashCode() + this.fullIRI.hashCode();
 90    }
 91    }
 92   
 93    /*
 94    * $Log$
 95    * Revision 1.14 2005/09/16 14:02:44 alex_simov
 96    * Identifier.asString() removed, use Object.toString() instead
 97    * (Implementations MUST override toString())
 98    *
 99    * Revision 1.13 2005/06/02 14:20:51 alex_simov
 100    * Namespace allows empty string prefix for the default namespace
 101    *
 102    * Revision 1.12 2005/06/01 12:00:53 marin_dimitrov
 103    * v0.4.0
 104    *
 105    * Revision 1.2 2005/05/11 13:33:58 alex
 106    * copyright notice updated
 107    *
 108    * Revision 1.1 2005/05/11 12:24:05 alex
 109    * initial commit
 110    *
 111    */