|
From: <lh...@us...> - 2008-08-07 14:36:47
|
Revision: 103
http://tinytim.svn.sourceforge.net/tinytim/?rev=103&view=rev
Author: lheuer
Date: 2008-08-07 14:36:54 +0000 (Thu, 07 Aug 2008)
Log Message:
-----------
Added Paths:
-----------
tinytim/trunk/src/main/java/org/tinytim/index/AbstractIndex.java
tinytim/trunk/src/main/java/org/tinytim/index/IIndexManager.java
tinytim/trunk/src/main/java/org/tinytim/index/IndexManager.java
tinytim/trunk/src/main/java/org/tinytim/index/LiteralIndexImpl.java
tinytim/trunk/src/main/java/org/tinytim/index/ScopedIndexImpl.java
tinytim/trunk/src/main/java/org/tinytim/index/TypeInstanceIndexImpl.java
Removed Paths:
-------------
tinytim/trunk/src/main/java/org/tinytim/AssociationImpl.java
tinytim/trunk/src/main/java/org/tinytim/AssociationRoleImpl.java
tinytim/trunk/src/main/java/org/tinytim/Construct.java
tinytim/trunk/src/main/java/org/tinytim/CopyUtils.java
tinytim/trunk/src/main/java/org/tinytim/DatatypeAwareConstruct.java
tinytim/trunk/src/main/java/org/tinytim/DuplicateRemovalUtils.java
tinytim/trunk/src/main/java/org/tinytim/Event.java
tinytim/trunk/src/main/java/org/tinytim/ICollectionFactory.java
tinytim/trunk/src/main/java/org/tinytim/IConstruct.java
tinytim/trunk/src/main/java/org/tinytim/IDatatypeAwareConstruct.java
tinytim/trunk/src/main/java/org/tinytim/IEventHandler.java
tinytim/trunk/src/main/java/org/tinytim/IEventPublisher.java
tinytim/trunk/src/main/java/org/tinytim/IMovable.java
tinytim/trunk/src/main/java/org/tinytim/IRI.java
tinytim/trunk/src/main/java/org/tinytim/IReifiable.java
tinytim/trunk/src/main/java/org/tinytim/IScoped.java
tinytim/trunk/src/main/java/org/tinytim/ITyped.java
tinytim/trunk/src/main/java/org/tinytim/IdentityManager.java
tinytim/trunk/src/main/java/org/tinytim/JavaCollectionFactory.java
tinytim/trunk/src/main/java/org/tinytim/MergeUtils.java
tinytim/trunk/src/main/java/org/tinytim/OccurrenceImpl.java
tinytim/trunk/src/main/java/org/tinytim/Property.java
tinytim/trunk/src/main/java/org/tinytim/ReificationUtils.java
tinytim/trunk/src/main/java/org/tinytim/Scoped.java
tinytim/trunk/src/main/java/org/tinytim/SignatureGenerator.java
tinytim/trunk/src/main/java/org/tinytim/TMAPIFeature.java
tinytim/trunk/src/main/java/org/tinytim/TopicImpl.java
tinytim/trunk/src/main/java/org/tinytim/TopicMapImpl.java
tinytim/trunk/src/main/java/org/tinytim/TopicMapSystemFactoryImpl.java
tinytim/trunk/src/main/java/org/tinytim/TopicMapSystemImpl.java
tinytim/trunk/src/main/java/org/tinytim/TopicNameImpl.java
tinytim/trunk/src/main/java/org/tinytim/TopicUtils.java
tinytim/trunk/src/main/java/org/tinytim/TroveCollectionFactory.java
tinytim/trunk/src/main/java/org/tinytim/TypeInstanceConverter.java
tinytim/trunk/src/main/java/org/tinytim/Typed.java
tinytim/trunk/src/main/java/org/tinytim/VariantImpl.java
Deleted: tinytim/trunk/src/main/java/org/tinytim/AssociationImpl.java
===================================================================
--- tinytim/trunk/src/main/java/org/tinytim/AssociationImpl.java 2008-08-07 14:28:52 UTC (rev 102)
+++ tinytim/trunk/src/main/java/org/tinytim/AssociationImpl.java 2008-08-07 14:36:54 UTC (rev 103)
@@ -1,114 +0,0 @@
-/*
- * 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.util.ArrayList;
-import java.util.Collections;
-import java.util.Set;
-
-import org.tmapi.core.Association;
-import org.tmapi.core.AssociationRole;
-import org.tmapi.core.TMAPIException;
-import org.tmapi.core.Topic;
-
-/**
- * {@link org.tmapi.core.Association} implementation.
- *
- * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
- * @version $Rev$ - $Date$
- */
-public final class AssociationImpl extends Scoped implements Association,
- IReifiable, ITyped, IScoped {
-
- private Set<AssociationRole> _roles;
-
- AssociationImpl(TopicMapImpl topicMap) {
- super(topicMap, null, null);
- _roles = topicMap.getCollectionFactory().createSet(2);
- }
-
- /**
- * Adds a role to this association.
- *
- * @param role The role to add.
- */
- void addRole(AssociationRole role) {
- AssociationRoleImpl r = (AssociationRoleImpl) role;
- if (r._parent == this) {
- return;
- }
- assert r._parent == null;
- _fireEvent(Event.ADD_ROLE, null, r);
- _roles.add(r);
- r._parent = this;
- TopicImpl player = (TopicImpl) r.getPlayer();
- if (player != null) {
- player.addRolePlayed(r);
- }
- }
-
- /**
- * Removes a role from this association.
- *
- * @param role The role to remove.
- */
- void removeRole(AssociationRole role) {
- AssociationRoleImpl r = (AssociationRoleImpl) role;
- if (r._parent != this) {
- return;
- }
- _fireEvent(Event.REMOVE_ROLE, r, null);
- _roles.remove(role);
- r._parent = null;
- TopicImpl player = (TopicImpl) r.getPlayer();
- if (player != null) {
- player.removeRolePlayed(r);
- }
- }
-
- /* (non-Javadoc)
- * @see org.tmapi.core.Association#createAssociationRole(org.tmapi.core.Topic, org.tmapi.core.Topic)
- */
- public AssociationRole createAssociationRole(Topic player, Topic type) {
- AssociationRoleImpl role = new AssociationRoleImpl(_tm, type, player);
- addRole(role);
- return role;
- }
-
- /* (non-Javadoc)
- * @see org.tmapi.core.Association#getAssociationRoles()
- */
- public Set<AssociationRole> getAssociationRoles() {
- return Collections.unmodifiableSet(_roles);
- }
-
- /* (non-Javadoc)
- * @see org.tmapi.core.TopicMapObject#remove()
- */
- public void remove() throws TMAPIException {
- _tm.removeAssociation(this);
- for (AssociationRole role: new ArrayList<AssociationRole>(_roles)) {
- role.remove();
- }
- _roles = null;
- super.dispose();
- }
-}
Deleted: tinytim/trunk/src/main/java/org/tinytim/AssociationRoleImpl.java
===================================================================
--- tinytim/trunk/src/main/java/org/tinytim/AssociationRoleImpl.java 2008-08-07 14:28:52 UTC (rev 102)
+++ tinytim/trunk/src/main/java/org/tinytim/AssociationRoleImpl.java 2008-08-07 14:36:54 UTC (rev 103)
@@ -1,83 +0,0 @@
-/*
- * 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 org.tmapi.core.Association;
-import org.tmapi.core.AssociationRole;
-import org.tmapi.core.TMAPIException;
-import org.tmapi.core.Topic;
-
-/**
- * {@link org.tmapi.core.AssociationRole} implementation.
- *
- * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
- * @version $Rev$ - $Date$
- */
-public final class AssociationRoleImpl extends Typed implements AssociationRole,
- ITyped {
-
- private Topic _player;
-
- AssociationRoleImpl(TopicMapImpl tm, Topic type, Topic player) {
- super(tm, type);
- _player = player;
- }
-
- /* (non-Javadoc)
- * @see org.tmapi.core.AssociationRole#getAssociation()
- */
- public Association getAssociation() {
- return (Association) _parent;
- }
-
- /* (non-Javadoc)
- * @see org.tmapi.core.AssociationRole#getPlayer()
- */
- public Topic getPlayer() {
- return _player;
- }
-
- /* (non-Javadoc)
- * @see org.tmapi.core.AssociationRole#setPlayer(org.tmapi.core.Topic)
- */
- public void setPlayer(Topic player) {
- if (_player == player) {
- return;
- }
- _fireEvent(Event.SET_PLAYER, _player, player);
- if (_player != null) {
- ((TopicImpl)_player).removeRolePlayed(this);
- }
- _player = player;
- if (player != null) {
- ((TopicImpl) player).addRolePlayed(this);
- }
- }
-
- /* (non-Javadoc)
- * @see org.tinytim.TopicMapObjectImpl#remove()
- */
- public void remove() throws TMAPIException {
- ((AssociationImpl) _parent).removeRole(this);
- super.dispose();
- }
-
-}
Deleted: tinytim/trunk/src/main/java/org/tinytim/Construct.java
===================================================================
--- tinytim/trunk/src/main/java/org/tinytim/Construct.java 2008-08-07 14:28:52 UTC (rev 102)
+++ tinytim/trunk/src/main/java/org/tinytim/Construct.java 2008-08-07 14:36:54 UTC (rev 103)
@@ -1,184 +0,0 @@
-/*
- * 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.util.Collections;
-import java.util.Set;
-
-import org.tmapi.core.DuplicateSourceLocatorException;
-import org.tmapi.core.Locator;
-import org.tmapi.core.TopicMap;
-
-/**
- * Base class for all Topic Maps constructs.
- *
- * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
- * @version $Rev$ - $Date$
- */
-abstract class Construct implements IConstruct {
-
- protected String _id;
- protected TopicMapImpl _tm;
- protected IConstruct _parent;
- private Set<Locator> _iids;
-
- Construct(TopicMapImpl topicMap) {
- _tm = topicMap;
- }
-
- /* (non-Javadoc)
- * @see org.tinytim.IConstruct#getParent()
- */
- public IConstruct getParent() {
- return _parent;
- }
-
- /* (non-Javadoc)
- * @see org.tmapi.core.TopicMapObject#getObjectId()
- */
- public String getObjectId() {
- return _id;
- }
-
- /* (non-Javadoc)
- * @see org.tmapi.core.TopicMapObject#getSourceLocators()
- */
- public Set<Locator> getSourceLocators() {
- return getItemIdentifiers();
- }
-
- /* (non-Javadoc)
- * @see org.tmapi.core.TopicMapObject#addSourceLocator(org.tmapi.core.Locator)
- */
- public void addSourceLocator(Locator loc)
- throws DuplicateSourceLocatorException {
- addItemIdentifier(loc);
- }
-
- /* (non-Javadoc)
- * @see org.tmapi.core.TopicMapObject#removeSourceLocator(org.tmapi.core.Locator)
- */
- public void removeSourceLocator(Locator loc) {
- removeItemIdentifier(loc);
- }
-
- /* (non-Javadoc)
- * @see org.tmapi.core.TopicMapObject#getTopicMap()
- */
- public TopicMap getTopicMap() {
- return _tm;
- }
-
- /* (non-Javadoc)
- * @see org.tinytim.IConstruct#getItemIdentifiers()
- */
- public Set<Locator> getItemIdentifiers() {
- return _iids == null ? Collections.<Locator>emptySet()
- : Collections.unmodifiableSet(_iids);
- }
-
- /* (non-Javadoc)
- * @see org.tinytim.IConstruct#addItemIdentifier(org.tmapi.core.Locator)
- */
- public void addItemIdentifier(Locator itemIdentifier) {
- if (_iids != null && _iids.contains(itemIdentifier)) {
- return;
- }
- _fireEvent(Event.ADD_IID, null, itemIdentifier);
- if (_iids == null) {
- _iids = _tm.getCollectionFactory().createSet();
- }
- _iids.add(itemIdentifier);
- }
-
- /* (non-Javadoc)
- * @see org.tinytim.IConstruct#removeItemIdentifier(org.tmapi.core.Locator)
- */
- public void removeItemIdentifier(Locator itemIdentifier) {
- if (_iids == null || !_iids.contains(itemIdentifier)) {
- return;
- }
- _fireEvent(Event.REMOVE_IID, itemIdentifier, null);
- _iids.remove(itemIdentifier);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public final boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- return (obj instanceof Construct) && _id.equals(((Construct) obj)._id);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
- public final int hashCode() {
- return _id.hashCode();
- }
-
- /**
- * Notifies the topic map about an event.
- *
- * If the topic map is <code>null</code>, no event is sent.
- *
- * @param evt The event.
- * @param oldValue The old value.
- * @param newValue The new value.
- */
- protected void _fireEvent(Event evt, Object oldValue, Object newValue) {
- if (_tm != null) {
- _tm.handleEvent(evt, this, oldValue, newValue);
- }
- }
-
- /**
- * Releases used resources.
- *
- * Should be called in the {@link org.tmapi.core.TopicMapObject#remove()}
- * method.
- */
- protected void dispose() {
- _tm = null;
- _parent = null;
- _iids = null;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder(super.toString());
- sb.append(" ").append(_id);
- sb.append(" iids=[");
- for (Locator iid: getItemIdentifiers()) {
- sb.append(iid);
- sb.append(',');
- }
- sb.append("]");
- return sb.toString();
- }
-}
Deleted: tinytim/trunk/src/main/java/org/tinytim/CopyUtils.java
===================================================================
--- tinytim/trunk/src/main/java/org/tinytim/CopyUtils.java 2008-08-07 14:28:52 UTC (rev 102)
+++ tinytim/trunk/src/main/java/org/tinytim/CopyUtils.java 2008-08-07 14:36:54 UTC (rev 103)
@@ -1,385 +0,0 @@
-/*
- * 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.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.tmapi.core.Association;
-import org.tmapi.core.AssociationRole;
-import org.tmapi.core.Locator;
-import org.tmapi.core.Occurrence;
-import org.tmapi.core.Topic;
-import org.tmapi.core.TopicMap;
-import org.tmapi.core.TopicMapObject;
-import org.tmapi.core.TopicName;
-import org.tmapi.core.Variant;
-
-/**
- * This class provides methods to copy Topic Maps constructs from one
- * topic map to another without creating duplicates.
- *
- * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
- * @version $Rev$ - $Date$
- */
-final class CopyUtils {
-
- /**
- * Copies the topics and associations from the <code>source</code> to the
- * <code>target</code> topic map.
- *
- * @param source The topic map to take the topics and associations from.
- * @param target The topic map which should receive the topics and associations.
- */
- public static void copy(TopicMap source, TopicMap target) {
- _copy((TopicMapImpl) source, (TopicMapImpl) target);
- }
-
- /**
- * @see #copy(TopicMap, TopicMap)
- */
- @SuppressWarnings("unchecked")
- private static void _copy(TopicMapImpl source, TopicMapImpl target) {
- if (source == null || target == null) {
- throw new IllegalArgumentException("Neither the source topic map nor the target topic map must be null");
- }
- if (source == target) {
- return;
- }
- Map<Topic, Topic> mergeMap = target.getCollectionFactory().createMap();
- Topic existing = null;
- TopicMapObject existingConstruct = null;
- for (Topic topic: source.getTopics()) {
- for (Iterator<Locator> iter = topic.getSubjectLocators().iterator(); iter.hasNext();) {
- existing = target.getTopicBySubjectLocator(iter.next());
- if (existing != null) {
- _addMerge(topic, existing, mergeMap);
- }
- }
- for (Iterator<Locator> iter = topic.getSubjectIdentifiers().iterator(); iter.hasNext();) {
- Locator sid = iter.next();
- existing = target.getTopicBySubjectIdentifier(sid);
- if (existing != null) {
- _addMerge(topic, existing, mergeMap);
- }
- existingConstruct = target.getObjectByItemIdentifier(sid);
- if (existingConstruct instanceof Topic) {
- _addMerge(topic, (Topic) existingConstruct, mergeMap);
- }
- }
- for (Iterator<Locator> iter = topic.getSourceLocators().iterator(); iter.hasNext();) {
- Locator iid = iter.next();
- existingConstruct = target.getObjectByItemIdentifier(iid);
- if (existingConstruct instanceof Topic) {
- _addMerge(topic, (Topic) existingConstruct, mergeMap);
- }
- existing = target.getTopicBySubjectIdentifier(iid);
- if (existing != null) {
- _addMerge(topic, existing, mergeMap);
- }
- }
- }
- if (source.getReifier() != null && target.getReifier() != null) {
- _addMerge(source.getReifier(), target.getReifier(), mergeMap);
- }
- for (Topic topic: source.getTopics()) {
- if (!mergeMap.containsKey(topic)) {
- _copyTopic(topic, target, mergeMap);
- }
- }
- for (Topic topic: mergeMap.keySet()) {
- Topic targetTopic = mergeMap.get(topic);
- _copyIdentities(topic, targetTopic);
- _copyTypes(topic, targetTopic, mergeMap);
- _copyCharacteristics(topic, (TopicImpl)targetTopic, mergeMap);
- }
- _copyAssociations(source, target, mergeMap);
- }
-
- /**
- * Copies the <code>topic</code> to the <code>target</code> topic map.
- *
- * @param topic The topic to copy.
- * @param target The target topic map.
- * @param mergeMap The map which holds the merge mappings.
- * @return The newly created topic in the target topic map.
- */
- private static Topic _copyTopic(Topic topic, TopicMap target,
- Map<Topic, Topic> mergeMap) {
- Topic targetTopic = target.createTopic();
- _copyIdentities(topic, targetTopic);
- _copyTypes(topic, targetTopic, mergeMap);
- _copyCharacteristics(topic, (TopicImpl)targetTopic, mergeMap);
- return targetTopic;
- }
-
- /**
- * Copies the identities (item identifiers, subject identifiers and subject
- * locators) from the <code>source/code> to the <code>targetTopic</code>.
- *
- * @param topic The topic to take the identities from.
- * @param targetTopic The topic which gets the identities.
- */
- @SuppressWarnings("unchecked")
- private static void _copyIdentities(Topic topic, Topic targetTopic) {
- for(Iterator<Locator> iter = topic.getSubjectIdentifiers().iterator(); iter.hasNext();) {
- targetTopic.addSubjectIdentifier(iter.next());
- }
- for(Iterator<Locator> iter = topic.getSubjectLocators().iterator(); iter.hasNext();) {
- targetTopic.addSubjectLocator(iter.next());
- }
- _copyItemIdentifiers((IConstruct)topic, (IConstruct)targetTopic);
- }
-
- /**
- * Copies the types from the <code>topic</code> to the <code>targetTopic</code>.
- *
- * @param topic The topic to take the types from.
- * @param targetTopic The topic which receives the types.
- * @param mergeMap The map which holds the merge mappings.
- */
- @SuppressWarnings("unchecked")
- private static void _copyTypes(Topic topic, Topic targetTopic,
- Map<Topic, Topic> mergeMap) {
- for (Iterator<Topic> iter = topic.getTypes().iterator(); iter.hasNext();) {
- Topic type = iter.next();
- Topic targetType = mergeMap.get(type);
- if (targetType == null) {
- targetType = _copyTopic(type, targetTopic.getTopicMap(), mergeMap);
- }
- targetTopic.addType(targetType);
- }
- }
-
- /**
- * Copies the occurrences and names from <code>topic</code> to the
- * <code>targetTopic</code>.
- *
- * @param topic The topic to take the characteristics from.
- * @param targetTopic The target topic which gets the charateristics.
- * @param mergeMap The map which holds the merge mappings.
- */
- private static void _copyCharacteristics(Topic topic, TopicImpl targetTopic,
- Map<Topic, Topic> mergeMap) {
- Map<String, IReifiable> sigs = ((TopicMapImpl) targetTopic.getTopicMap()).getCollectionFactory().<String, IReifiable>createMap();
- for (Occurrence occ: targetTopic.getOccurrences()) {
- sigs.put(SignatureGenerator.generateSignature(occ), (IReifiable)occ);
- }
- IReifiable existing = null;
- for (Occurrence occ: ((TopicImpl) topic).getOccurrences()) {
- Occurrence targetOcc = targetTopic.createOccurrence((String)null, null, null);
- _copyType((ITyped)occ, (ITyped)targetOcc, mergeMap);
- _copyScope((IScoped)occ, (IScoped)targetOcc, mergeMap);
- if (occ.getValue() != null) {
- targetOcc.setValue(occ.getValue());
- }
- else if (occ.getResource() != null) {
- targetOcc.setResource(occ.getResource());
- }
- existing = sigs.get(SignatureGenerator.generateSignature(targetOcc));
- if (existing != null) {
- MergeUtils.removeConstruct((IConstruct) targetOcc);
- targetOcc = (Occurrence)existing;
- }
- _copyReifier((IReifiable) occ, (IReifiable) targetOcc, mergeMap);
- _copyItemIdentifiers((IConstruct) occ, (IConstruct) targetOcc);
- }
- sigs.clear();
- for (TopicName name: targetTopic.getTopicNames()) {
- sigs.put(SignatureGenerator.generateSignature(name), (IReifiable)name);
- }
- for (TopicName name: ((TopicImpl) topic).getTopicNames()) {
- TopicName targetName = targetTopic.createTopicName(name.getValue(), null);
- _copyType((ITyped) name, (ITyped) targetName, mergeMap);
- _copyScope((IScoped) name, (IScoped) targetName, mergeMap);
- existing = sigs.get(SignatureGenerator.generateSignature(targetName));
- if (existing != null) {
- MergeUtils.removeConstruct((IConstruct)targetName);
- targetName = (TopicName) existing;
- }
- _copyReifier((IReifiable) name, (IReifiable) targetName, mergeMap);
- _copyItemIdentifiers((IConstruct) name, (IConstruct) targetName);
- _copyVariants(name, targetName, mergeMap);
- }
- }
-
- /**
- * Copies the variants from <code>source</code> to the <code>target</code>.
- *
- * @param source The name to take the variants from.
- * @param target The target name which receives the variants.
- * @param mergeMap The map which holds the merge mappings.
- */
- private static void _copyVariants(TopicName source, TopicName target,
- Map<Topic, Topic> mergeMap) {
- Map<String, Variant> sigs = ((TopicMapImpl) target.getTopicMap()).getCollectionFactory().createMap();
- for (Variant variant: ((TopicNameImpl) target).getVariants()) {
- sigs.put(SignatureGenerator.generateSignature(variant), variant);
- }
- Variant existing = null;
- for (Variant variant: ((TopicNameImpl) source).getVariants()) {
- Variant targetVar = target.createVariant((String) null, null);
- _copyScope((IScoped) variant, (IScoped) targetVar, mergeMap);
- if (variant.getValue() != null) {
- targetVar.setValue(variant.getValue());
- }
- else if (variant.getResource() != null) {
- targetVar.setResource(variant.getResource());
- }
- existing = sigs.get(SignatureGenerator.generateSignature(targetVar));
- if (existing != null) {
- MergeUtils.removeConstruct((IConstruct) targetVar);
- targetVar = existing;
- }
- _copyReifier((IReifiable) variant, (IReifiable) targetVar, mergeMap);
- _copyItemIdentifiers((IConstruct) variant, (IConstruct) targetVar);
- }
- }
-
- /**
- * Copies the reifier of <code>source</code> (if any) to the <code>target</code>.
- *
- * @param source The reifiable Topic Maps construct to take the reifier from.
- * @param target The target Topic Maps construct.
- * @param mergeMap The map which holds the merge mappings.
- */
- private static void _copyReifier(IReifiable source, IReifiable target,
- Map<Topic, Topic> mergeMap) {
- Topic sourceReifier = source.getReifier();
- if (sourceReifier == null) {
- return;
- }
- Topic reifier = mergeMap.containsKey(sourceReifier) ? mergeMap.get(sourceReifier)
- : _copyTopic(sourceReifier, target.getTopicMap(), mergeMap);
- target.setReifier(reifier);
- }
-
- /**
- * Copies the type of the <code>source</code> (if any) to the <code>target</code>.
- *
- * @param source The Topic Maps construct to take the type from.
- * @param target The Topic Maps construct which receives the type.
- * @param mergeMap The map which holds the merge mappings.
- */
- private static void _copyType(ITyped source, ITyped target,
- Map<Topic, Topic> mergeMap) {
- Topic sourceType = source.getType();
- if (sourceType == null) {
- return;
- }
- Topic type = mergeMap.containsKey(sourceType) ? mergeMap.get(sourceType)
- : _copyTopic(sourceType, target.getTopicMap(), mergeMap);
- target.setType(type);
- }
-
- /**
- * Copies all themes from the <code>source</code> scoped Topic Maps construct
- * to the <code>target</code>.
- *
- * @param source The source to take the scope from.
- * @param target The target which receives the scope.
- * @param mergeMap The map which holds the merge mappings.
- */
- private static void _copyScope(IScoped source, IScoped target,
- Map<Topic, Topic> mergeMap) {
- Topic theme = null;
- for (Topic sourceTheme: source.getScope()) {
- theme = mergeMap.containsKey(sourceTheme) ? mergeMap.get(sourceTheme)
- : _copyTopic(sourceTheme, target.getTopicMap(), mergeMap);
- target.addTheme(theme);
- }
- }
-
- /**
- * Copies the item identifiers from <code>source</code> to <code>target</code>.
- *
- * @param source The source Topic Maps construct.
- * @param target The target Topic Maps construct.
- */
- private static void _copyItemIdentifiers(IConstruct source, IConstruct target) {
- for(Locator iid: source.getItemIdentifiers()) {
- target.addSourceLocator(iid);
- }
- }
-
- /**
- * Copies the associations from the <code>source</code> topic map to the
- * <code>target</code> topic map.
- *
- * @param source The topic map to take the associations from.
- * @param target The topic map which receives the associations.
- * @param mergeMap The map which holds the merge mappings.
- */
- @SuppressWarnings("unchecked")
- private static void _copyAssociations(TopicMapImpl source,
- TopicMapImpl target, Map<Topic, Topic> mergeMap) {
- Set<Association> assocs = target.getAssociations();
- Map<String, Association> sigs = target.getCollectionFactory().createMap(assocs.size());
- for (Association assoc: assocs) {
- sigs.put(SignatureGenerator.generateSignature(assoc), assoc);
- }
- Association existing = null;
- for (Association assoc: source.getAssociations()) {
- Association targetAssoc = target.createAssociation();
- _copyType((ITyped) assoc, (ITyped) targetAssoc, mergeMap);
- _copyScope((IScoped) assoc, (IScoped) targetAssoc, mergeMap);
- for (Iterator<AssociationRole> iter = assoc.getAssociationRoles().iterator(); iter.hasNext();) {
- AssociationRole role = iter.next();
- AssociationRole targetRole = targetAssoc.createAssociationRole(role.getPlayer(), role.getType());
- _copyItemIdentifiers((IConstruct)role, (IConstruct)targetRole);
- _copyReifier((IReifiable) role, (IReifiable) targetRole, mergeMap);
- }
- existing = sigs.get(SignatureGenerator.generateSignature(targetAssoc));
- if (existing != null) {
- MergeUtils.moveRoleCharacteristics(targetAssoc, existing);
- MergeUtils.removeConstruct((IConstruct) targetAssoc);
- targetAssoc = existing;
- }
- _copyReifier((IReifiable) assoc, (IReifiable) targetAssoc, mergeMap);
- _copyItemIdentifiers((IConstruct) assoc, (IConstruct) targetAssoc);
- }
- }
-
- /**
- * Adds a mapping from <code>source</code> to <code>target</code> into the
- * <code>mergeMap</code>.
- *
- * If <code>source</code> has already a mapping to another target topic,
- * <code>target</code> is merged with the existing target topic.
- *
- * @param source The source topic.
- * @param target The target topic.
- * @param mergeMap The map which holds the merge mappings.
- */
- private static void _addMerge(Topic source, Topic target, Map<Topic, Topic> mergeMap) {
- Topic prevTarget = mergeMap.get(source);
- if (prevTarget != null) {
- if (!prevTarget.equals(target)) {
- MergeUtils.merge(target, prevTarget);
- }
- }
- else {
- mergeMap.put(source, target);
- }
- }
-
-}
Deleted: tinytim/trunk/src/main/java/org/tinytim/DatatypeAwareConstruct.java
===================================================================
--- tinytim/trunk/src/main/java/org/tinytim/DatatypeAwareConstruct.java 2008-08-07 14:28:52 UTC (rev 102)
+++ tinytim/trunk/src/main/java/org/tinytim/DatatypeAwareConstruct.java 2008-08-07 14:36:54 UTC (rev 103)
@@ -1,127 +0,0 @@
-/*
- * 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.util.Collection;
-
-import org.tmapi.core.Locator;
-import org.tmapi.core.Topic;
-
-/**
- * Implementation of {@link org.tinytim.IDatatypeAwareConstruct}.
- *
- * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
- * @version $Rev$ - $Date$
- */
-abstract class DatatypeAwareConstruct extends Scoped implements
- IDatatypeAwareConstruct {
-
- private static final String _XSD_BASE = "http://www.w3.org/2001/XMLSchema#";
- private static final Locator STRING = new IRI(_XSD_BASE + "string");
- private static final Locator ANY_URI = new IRI(_XSD_BASE + "anyURI");
-
- private String _value;
- private Locator _resource;
-
- DatatypeAwareConstruct(TopicMapImpl topicMap, Topic type, String value, Collection<Topic> scope) {
- super(topicMap, type, scope);
- _value = value;
- }
-
- DatatypeAwareConstruct(TopicMapImpl topicMap, Topic type, Locator value, Collection<Topic> scope) {
- super(topicMap, type, scope);
- _resource = value;
- }
-
- /* (non-Javadoc)
- * @see org.tinytim.IDatatypeAwareConstruct#getValue2()
- */
- public String getValue2() {
- if (_value != null) {
- return _value;
- }
- return _resource != null ? _resource.getReference() : "";
- }
-
- /**
- * Sets the value (xsd:string) of this construct.
- *
- * Sideeffect: The resource is set to null.
- *
- * @param value Sets the value of this construct.
- */
- public void setValue(String value) {
- _fireEvent(Event.SET_VALUE, _value, value);
- _resource = null;
- _value = value;
- }
-
- /**
- * Returns the value of this construct.
- *
- * @return The value or <code>null</code>.
- */
- public String getValue() {
- return _value;
- }
-
- /**
- * Returns the locator (xsd:anyURI value) of this construct.
- *
- * @return The locator or <code>null</code>.
- */
- public Locator getResource() {
- return _resource;
- }
-
- /**
- * Sets the value (xsd:anyURI) of this construct.
- *
- * Side effect: The string value (if any) is set to <code>null</code>.
- *
- * @param value The locator.
- */
- public void setResource(Locator value) {
- _fireEvent(Event.SET_LOCATOR, _resource, value);
- _value = null;
- _resource = value;
- }
-
- /* (non-Javadoc)
- * @see org.tinytim.IDatatypeAwareConstruct#getDatatype()
- */
- public Locator getDatatype() {
- if (_value != null || _resource == null) {
- return STRING;
- }
- return ANY_URI;
- }
-
- /* (non-Javadoc)
- * @see org.tinytim.Construct#dispose()
- */
- @Override
- protected void dispose() {
- _value = null;
- _resource = null;
- super.dispose();
- }
-}
Deleted: tinytim/trunk/src/main/java/org/tinytim/DuplicateRemovalUtils.java
===================================================================
--- tinytim/trunk/src/main/java/org/tinytim/DuplicateRemovalUtils.java 2008-08-07 14:28:52 UTC (rev 102)
+++ tinytim/trunk/src/main/java/org/tinytim/DuplicateRemovalUtils.java 2008-08-07 14:36:54 UTC (rev 103)
@@ -1,209 +0,0 @@
-/*
- * 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.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.tinytim.index.ITypeInstanceIndex;
-import org.tmapi.core.Association;
-import org.tmapi.core.AssociationRole;
-import org.tmapi.core.Occurrence;
-import org.tmapi.core.Topic;
-import org.tmapi.core.TopicMap;
-import org.tmapi.core.TopicMapObject;
-import org.tmapi.core.TopicName;
-import org.tmapi.core.Variant;
-
-/**
- * Removes duplicates from Topic Maps constructs.
- *
- * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
- * @version $Rev:$ - $Date:$
- */
-public final class DuplicateRemovalUtils {
-
- private DuplicateRemovalUtils() {
- // noop.
- }
-
- /**
- * Removes duplicate Topic Maps constructs from a topic map.
- *
- * @param topicMap The topic map to remove the duplicates from.
- */
- public static void removeDuplicates(TopicMap topicMap) {
- TopicMapImpl tm = (TopicMapImpl) topicMap;
- for (Topic topic: tm.getTopics()) {
- removeDuplicates(topic);
- }
- Map<String, Association> sig2Assoc = tm.getCollectionFactory().createMap();
- ITypeInstanceIndex typeInstanceIdx = tm.getIndexManager().getTypeInstanceIndex();
- if (!typeInstanceIdx.isAutoUpdated()) {
- typeInstanceIdx.reindex();
- }
- for (Topic type: typeInstanceIdx.getAssociationTypes()) {
- _removeDuplicateAssociations(sig2Assoc, typeInstanceIdx.getAssociations(type));
- }
- _removeDuplicateAssociations(sig2Assoc, typeInstanceIdx.getAssociations(null));
- }
-
- private static void _removeDuplicateAssociations(Map<String, Association> sig2Assoc, Collection<AssociationImpl> assocs) {
- sig2Assoc.clear();
- Association existing = null;
- String sig = null;
- for (Association assoc: assocs) {
- removeDuplicates(assoc);
- sig = SignatureGenerator.generateSignature(assoc);
- existing = sig2Assoc.get(sig);
- if (existing != null) {
- MergeUtils.moveRoleCharacteristics(assoc, existing);
- _removeConstruct(assoc);
- }
- else {
- sig2Assoc.put(sig, assoc);
- }
- }
- }
-
- /**
- * Removes duplicate occurrences and names from a topic.
- *
- * @param topic The topic from which duplicates should be removed from.
- */
- @SuppressWarnings("unchecked")
- public static void removeDuplicates(Topic topic) {
- _removeDuplicateOccurrences(topic.getOccurrences());
- _removeDuplicateNames(topic.getTopicNames());
- }
-
- /**
- * Removes duplicate variants from a name.
- *
- * @param name The name from which the duplicates should be removed.
- */
- @SuppressWarnings("unchecked")
- public static void removeDuplicates(TopicName name) {
- Map<String, Variant> sigs = new HashMap<String, Variant>();
- for (Variant variant: new ArrayList<Variant>(name.getVariants())) {
- String sig = SignatureGenerator.generateSignature(variant);
- Variant existing = sigs.get(sig);
- if (existing != null) {
- _handleExistingConstruct(variant, existing);
- _removeConstruct(variant);
- }
- else {
- sigs.put(sig, variant);
- }
- }
- }
-
- /**
- *
- *
- * @param occs
- */
- private static void _removeDuplicateOccurrences(Collection<Occurrence> occs) {
- Map<String, Occurrence> sigs = new HashMap<String, Occurrence>(occs.size());
- Occurrence existing = null;
- for (Occurrence occ: new ArrayList<Occurrence>(occs)) {
- String sig = SignatureGenerator.generateSignature(occ);
- existing = sigs.get(sig);
- if (existing != null) {
- _handleExistingConstruct(occ, existing);
- _removeConstruct(occ);
- }
- else {
- sigs.put(sig, occ);
- }
- }
- }
-
- /**
- *
- *
- * @param names
- */
- private static void _removeDuplicateNames(Collection<TopicName> names) {
- Map<String, TopicName> sigs = new HashMap<String, TopicName>(names.size());
- TopicName existing = null;
- for (TopicName name: new ArrayList<TopicName>(names)) {
- removeDuplicates(name);
- String sig = SignatureGenerator.generateSignature(name);
- existing = sigs.get(sig);
- if (existing != null) {
- _handleExistingConstruct(name, existing);
- _moveVariants(name, existing);
- _removeConstruct(name);
- }
- else {
- sigs.put(sig, name);
- }
- }
- }
-
- /**
- * Removes duplicate roles from an association.
- *
- * @param assoc The association to remove duplicate roles from.
- */
- @SuppressWarnings("unchecked")
- public static void removeDuplicates(Association assoc) {
- Map<String, AssociationRole> sig2Role = ((TopicMapImpl) assoc.getTopicMap()).getCollectionFactory().createMap();
- AssociationRole existing = null;
- String sig = null;
- for (AssociationRole role: new ArrayList<AssociationRole>(assoc.getAssociationRoles())) {
- sig = SignatureGenerator.generateSignature(role);
- existing = sig2Role.get(sig);
- if (existing != null) {
- _handleExistingConstruct(role, existing);
- _removeConstruct(role);
- }
- else {
- sig2Role.put(sig, role);
- }
- }
- }
-
- /**
- * @see {@link MergeUtils#moveVariants(TopicNameImpl, TopicNameImpl)}
- */
- private static void _moveVariants(TopicName source, TopicName target) {
- MergeUtils.moveVariants((TopicNameImpl)source, (TopicNameImpl)target);
- }
-
- /**
- * @see {@link MergeUtils#removeConstruct(IConstruct)}
- */
- private static void _removeConstruct(TopicMapObject construct) {
- MergeUtils.removeConstruct((IConstruct) construct);
- }
-
- /**
- * @see {@link MergeUtils#handleExistingConstruct(IReifiable, IReifiable)}
- */
- private static void _handleExistingConstruct(TopicMapObject source, TopicMapObject target) {
- MergeUtils.handleExistingConstruct((IReifiable) source, (IReifiable) target);
- }
-
-}
Deleted: tinytim/trunk/src/main/java/org/tinytim/Event.java
===================================================================
--- tinytim/trunk/src/main/java/org/tinytim/Event.java 2008-08-07 14:28:52 UTC (rev 102)
+++ tinytim/trunk/src/main/java/org/tinytim/Event.java 2008-08-07 14:36:54 UTC (rev 103)
@@ -1,160 +0,0 @@
-/*
- * 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;
-
-/**
- * Event constants.
- *
- * All events are sent before a change happens. This allows to check
- * some constraints.
- *
- * This class is not meant to be used outside of the tinyTiM package.
- *
- * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
- * @version $Rev$ - $Date$
- */
-public enum Event {
-
- /**
- * Notification that a topic should be added.
- */
- ADD_TOPIC,
- /**
- * Notification that a topic should be removed.
- */
- REMOVE_TOPIC,
- /**
- * Notification that an association should be added.
- */
- ADD_ASSOCIATION,
- /**
- * Notification that an association should be removed.
- */
- REMOVE_ASSOCIATION,
- /**
- * Notification that a role should be added.
- */
- ADD_ROLE,
- /**
- * Notification that a role should be removed.
- */
- REMOVE_ROLE,
- /**
- * Notification that an occurrence should be added.
- */
- ADD_OCCURRENCE,
- /**
- * Notification that an occurrence should be removed.
- */
- REMOVE_OCCURRENCE,
- /**
- * Notification that a name should be added.
- */
- ADD_NAME,
- /**
- * Notification that a name should be removed.
- */
- REMOVE_NAME,
- /**
- * Notification that a variant should be added.
- */
- ADD_VARIANT,
- /**
- * Notification that a variant should be removed.
- */
- REMOVE_VARIANT,
-
- /**
- * Notification that a subject identifier should be added.
- */
- ADD_SID,
- /**
- * Notification that a subject identifier should be removed.
- */
- REMOVE_SID,
- /**
- * Notification that a subject locator should be added.
- */
- ADD_SLO,
- /**
- * Notification that a subject locator should be removed.
- */
- REMOVE_SLO,
- /**
- * Notification that an item identifier should be added.
- */
- ADD_IID,
- /**
- * Notification that an item identifier should be removed.
- */
- REMOVE_IID,
-
- /**
- * Notification that a type should be added to a topic.
- */
- ADD_TYPE,
- /**
- * Notification that a type should be removed from a topic.
- */
- REMOVE_TYPE,
- /**
- * Notification that the type of a {@link ITyped} construct should be set.
- */
- SET_TYPE,
-
- /**
- * Notification that a theme should be added to a {@link IScoped} construct.
- */
- ADD_THEME,
- /**
- * Notification that a theme should be removed from a
- * {@link IScoped} construct.
- */
- REMOVE_THEME,
-
- /**
- * Notification that the value of a name, an occurrence or variant
- * should be set.
- */
- SET_VALUE,
-
- /**
- * Notification that the player of a role should be set.
- */
- SET_PLAYER,
-
- /**
- * Notification that the reifier of a {@link IReifiable} construct
- * should be set.
- */
- SET_REIFIER,
-
- /**
- * Notification that the "resource" of an occurrence or variant should be
- * set.
- */
- SET_LOCATOR, //TODO: Remove this once we have a TMDM-compatible version
-
- MOVE_OCCURRENCE,
- MOVE_NAME,
- MOVE_VARIANT
-
-}
Deleted: tinytim/trunk/src/main/java/org/tinytim/ICollectionFactory.java
===================================================================
--- tinytim/trunk/src/main/java/org/tinytim/ICollectionFactory.java 2008-08-07 14:28:52 UTC (rev 102)
+++ tinytim/trunk/src/main/java/org/tinytim/ICollectionFactory.java 2008-08-07 14:36:54 UTC (rev 103)
@@ -1,72 +0,0 @@
-/*
- * 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.util.Map;
-import java.util.Set;
-
-/**
- * Factory for collections.
- *
- * Implementations of this interface must provide a default constructor.
- *
- * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
- * @version $Rev$ - $Date$
- */
-public interface ICollectionFactory {
-
- /**
- * Creates a Set with the specified initial <code>size</code>.
- *
- * @param <E>
- * @param size The initial capacity.
- * @return
- */
- <E> Set<E> createSet(int size);
-
- /**
- * Creates a Set.
- *
- * @param <E>
- * @return
- */
- <E> Set<E> createSet();
-
- /**
- * Creates a Map.
- *
- * @param <K>
- * @param <V>
- * @return
- */
- <K, V> Map<K, V> createMap();
-
- /**
- * Creates a Map with the specified initial <code>size</code>.
- *
- * @param <K>
- * @param <V>
- * @param size The initial capacity.
- * @return
- */
- <K, V> Map<K, V> createMap(int size);
-
-}
Deleted: tinytim/trunk/src/main/java/org/tinytim/IConstruct.java
===================================================================
--- tinytim/trunk/src/main/java/org/tinytim/IConstruct.java 2008-08-07 14:28:52 UTC (rev 102)
+++ tinytim/trunk/src/main/java/org/tinytim/IConstruct.java 2008-08-07 14:36:54 UTC (rev 103)
@@ -1,66 +0,0 @@
-/*
- * 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.util.Set;
-
-import org.tmapi.core.Locator;
-import org.tmapi.core.TopicMapObject;
-
-/**
- * The Topic Maps construct.
- *
- * This interface is not meant to be used outside of the tinyTiM package.
- *
- * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
- * @version $Rev$ - $Date$
- */
-public interface IConstruct extends TopicMapObject {
-
- /**
- * Returns the parent of the Topic Maps construct.
- *
- * @return The parent of a Topic Maps construct or <code>null</code>.
- */
- public IConstruct getParent();
-
- /**
- * Returns the item identifiers of the Topic Maps construct.
- *
- * @return A (maybe empty) immutable Set of item identifiers.
- */
- public Set<Locator> getItemIdentifiers();
-
- /**
- * Adds an item identifier to the Topic Maps construct.
- *
- * @param itemIdentifier The item identifier to add.
- */
- public void addItemIdentifier(Locator itemIdentifier);
-
- /**
- * Removes an item identifier from the Topic Maps construct.
- *
- * @param itemIdentifier The item identifier to remove.
- */
- public void removeItemIdentifier(Locator itemIdentifier);
-
-}
Deleted: tinytim/trunk/src/main/java/org/tinytim/IDatatypeAwareConstruct.java
===================================================================
--- tinytim/trunk/src/main/java/org/tinytim/IDatatypeAwareConstruct.java 2008-08-07 14:28:52 UTC (rev 102)
+++ tinytim/trunk/src/main/java/org/tinytim/IDatatypeAwareConstruct.java 2008-08-07 14:36:54 UTC (rev 103)
@@ -1,54 +0,0 @@
-/*
- * 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 org.tmapi.core.Locator;
-
-/**
- * Indicates that a Topic Maps construct has a value and a datatype.
- *
- * This interface is not meant to be used outside of the tinyTiM package.
- *
- * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
- * @version $Rev$ - $Date$
- */
-public interface IDatatypeAwareConstruct extends IConstruct {
-
- /**
- * The value of this Topic Maps construct.
- *
- * This method differs from TMAPI: This method MUST return the value OR the
- * locator as string. This method should be removed if we have TMAPI 2.0
- * (maybe the whole interface should be removed).
- * Currently, the {@link SignatureGenerator} needs it.
- *
- * @return The value.
- */
- public String getValue2();
-
- /**
- * Returns the datatype of this Topic Maps construct.
- *
- * @return The datatype.
- */
- public Locator getDatatype();
-
-}
Deleted: tinytim/trunk/src/main/java/org/tinytim/IEventHandler.java
===================================================================
--- tinytim/trunk/src/main/java/org/tinytim/IEventHandler.java 2008-08-07 14:28:52 UTC (rev 102)
+++ tinytim/trunk/src/main/java/org/tinytim/IEventHandler.java 2008-08-07 14:36:54 UTC (rev 103)
@@ -1,47 +0,0 @@
-/*
- * 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;
-
-/**
- * Event handler that is able to handle Topic Maps events.
- *
- * This interface is not meant to be used outside of the tinyTiM package.
- *
- * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
- * @version $Rev$ - $Date$
- */
-public interface IEventHandler {
-
- /**
- * Callback method if a {@link IEventPublisher} sends an event to which
- * this handler is subscribed to.
- *
- * @param evt The event.
- * @param sender The sender of the event (this is not necessarily the
- * publisher).
- * @param oldValue The old value or <code>null</code> if the old value
- * is not available or was <code>null</code>.
- * @param newValue The new value or <code>null</code> if the new value
- * is not available or should become <code>null</code>.
- */
- public void handleEvent(Event evt, IConstruct sender, Object oldValue, Object newValue);
-
-}
Deleted: tinytim/trunk/src/main/java/org/tinytim/IEventPublisher.java
===================================================================
--- tinytim/trunk/src/main/java/org/tinytim/IEventPublisher.java 2008-08-07 14:28:52 UTC (rev 102)
+++ tinytim/trunk/src/main/java/org/tinytim/IEventPublisher.java 2008-08-07 14:36:54 UTC (rev 103)
@@ -1,48 +0,0 @@
-/*
- * 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;
-
-/**
- * Publisher for Topic Maps events.
- *
- * This interface is not meant to be used outside of the tinyTiM package.
- *
- * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
- * @version $Rev$ - $Date$
- */
-public interface IEventPublisher {
-
- /**
- * Subscribes the handler for the specified event.
- *
- * @param event The event of interesst.
- * @param handler The event handler.
- */
- public void subscribe(Event event, IEventHandler handler);
-
- /**
- * Removes the handler from the publisher.
- *
- * @param event The event.
- * @param handler The event handler.
- */
- public void unsubscribe(Event event, IEventHandler handler);
-}
Deleted: tinytim/trunk/src/main/java/org/tinytim/IMovable.java
===================================================================
--- tinytim/trunk/src/main/java/org/t...
[truncated message content] |