|
From: <lh...@us...> - 2008-04-20 15:34:45
|
Revision: 18
http://tinytim.svn.sourceforge.net/tinytim/?rev=18&view=rev
Author: lheuer
Date: 2008-04-20 08:21:48 -0700 (Sun, 20 Apr 2008)
Log Message:
-----------
- Added locator impl
- Removed unnecessary generics from _topicmaps initialization
Modified Paths:
--------------
tinytim/trunk/main/java/org/tinytim/TopicMapSystemImpl.java
Added Paths:
-----------
tinytim/trunk/main/java/org/tinytim/IRI.java
Added: tinytim/trunk/main/java/org/tinytim/IRI.java
===================================================================
--- tinytim/trunk/main/java/org/tinytim/IRI.java (rev 0)
+++ tinytim/trunk/main/java/org/tinytim/IRI.java 2008-04-20 15:21:48 UTC (rev 18)
@@ -0,0 +1,97 @@
+/*
+ * This is tinyTiM, a tiny Topic Maps engine.
+ *
+ * Copyright (C) 2008 Lars Heuer (heuer[at]semagia.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+package org.tinytim;
+
+import java.net.URI;
+
+import org.tmapi.core.Locator;
+
+/**
+ * Immutable representation of an IRI.
+ *
+ * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
+ * @version $Rev:$ - $Date:$
+ */
+public final class IRI implements Locator {
+
+ private final URI _uri;
+
+ public IRI(String reference) {
+ this(URI.create(reference));
+ }
+
+ private IRI(URI uri) {
+ _uri = uri;
+ }
+
+ /* (non-Javadoc)
+ * @see org.tmapi.core.Locator#getNotation()
+ */
+ public String getNotation() {
+ return "URI";
+ }
+
+ /* (non-Javadoc)
+ * @see org.tmapi.core.Locator#getReference()
+ */
+ public String getReference() {
+ return _uri.toString();
+ }
+
+ /* (non-Javadoc)
+ * @see org.tmapi.core.Locator#resolveRelative(java.lang.String)
+ */
+ public Locator resolveRelative(String reference) {
+ return new IRI(_uri.resolve(reference));
+ }
+
+ /* (non-Javadoc)
+ * @see org.tmapi.core.Locator#toExternalForm()
+ */
+ public String toExternalForm() {
+ return _uri.toASCIIString();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ return this == obj || (obj instanceof IRI && _uri.equals(((IRI) obj)._uri));
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return _uri.hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return _uri.toString();
+ }
+
+}
Property changes on: tinytim/trunk/main/java/org/tinytim/IRI.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date Id
Name: svn:eol-style
+ native
Modified: tinytim/trunk/main/java/org/tinytim/TopicMapSystemImpl.java
===================================================================
--- tinytim/trunk/main/java/org/tinytim/TopicMapSystemImpl.java 2008-04-20 15:11:15 UTC (rev 17)
+++ tinytim/trunk/main/java/org/tinytim/TopicMapSystemImpl.java 2008-04-20 15:21:48 UTC (rev 18)
@@ -34,7 +34,7 @@
* {@link org.tmapi.core.TopicMapSystem} implementation.
*
* @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
- * @version $Rev:$ - $Date:$
+ * @version $Rev$ - $Date$
*/
final class TopicMapSystemImpl implements TopicMapSystem {
@@ -48,7 +48,7 @@
_collectionFactory = collFactory;
_features = features;
_properties = properties;
- _topicMaps = collFactory.<Locator, TopicMap>createMap();
+ _topicMaps = collFactory.createMap();
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|