From: <lh...@us...> - 2008-04-20 15:33:35
|
Revision: 19 http://tinytim.svn.sourceforge.net/tinytim/?rev=19&view=rev Author: lheuer Date: 2008-04-20 08:30:50 -0700 (Sun, 20 Apr 2008) Log Message: ----------- Initial (partially) import of the index package Added Paths: ----------- tinytim/trunk/main/java/org/tinytim/index/ tinytim/trunk/main/java/org/tinytim/index/IIndex.java tinytim/trunk/main/java/org/tinytim/index/IScopedIndex.java tinytim/trunk/main/java/org/tinytim/index/ITypeInstanceIndex.java tinytim/trunk/main/java/org/tinytim/index/IndexFlagsImpl.java Added: tinytim/trunk/main/java/org/tinytim/index/IIndex.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/index/IIndex.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/index/IIndex.java 2008-04-20 15:30:50 UTC (rev 19) @@ -0,0 +1,57 @@ +/* + * 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.index; + +/** + * Simplified interface for indexes. + * + * Copied from the TMAPIX-project. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public interface IIndex { + + /** + * Returns if this index is automatically kept in sync. with the + * topic map values. + * + * @return <code>true</code> if the index synchronizes itself with the + * underlying topic map, otherwise <code>false</code> + */ + public boolean isAutoUpdated(); + + /** + * Resynchronizes this index with the data in the topic map. + * + * Indexes that are automatically kept in sync should ignore this. + */ + public void reindex(); + + /** + * Closes the index. + * + * This operation is optional but useful to release resources. + * After closing the index must not be used further. + */ + public void close(); + +} Property changes on: tinytim/trunk/main/java/org/tinytim/index/IIndex.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/index/IScopedIndex.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/index/IScopedIndex.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/index/IScopedIndex.java 2008-04-20 15:30:50 UTC (rev 19) @@ -0,0 +1,79 @@ +/* + * 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.index; + +import java.util.Collection; + +import org.tinytim.AssociationImpl; +import org.tinytim.OccurrenceImpl; +import org.tinytim.TopicNameImpl; +import org.tinytim.VariantImpl; +import org.tmapi.core.Topic; + +/** + * Index for all scoped Topic Maps Constructs. + * + * Copied from the TMAPIX-project, this interface is not meant to be used + * outside of the tinyTiM package. Once TMAPI exposes <code>ITyped</code> this + * interface should be changed to return interfaces rather than the + * implementations. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public interface IScopedIndex extends IIndex { + + /** + * Returns all associations which use the specified topic as theme. + * + * @param theme The theme. + * @return A (maybe empty) collection of associations which use the theme + * in their [scope] property. + */ + public Collection<AssociationImpl> getAssociationsByTheme(Topic theme); + + /** + * Returns all occurrences which use the specified topic as theme. + * + * @param theme The theme. + * @return A (maybe empty) collection of occurrences which use the theme + * in their [scope] property. + */ + public Collection<OccurrenceImpl> getOccurrencesByTheme(Topic theme); + + /** + * Returns all names which use the specified topic as theme. + * + * @param theme The theme. + * @return A (maybe empty) collection of names which use the theme + * in their [scope] property. + */ + public Collection<TopicNameImpl> getNamesByTheme(Topic theme); + + /** + * Returns all variants which use the specified topic as theme. + * + * @param theme The theme. + * @return A (maybe empty) collection of variants which use the theme + * in their [scope] property. + */ + public Collection<VariantImpl> getVariantsByTheme(Topic theme); +} Property changes on: tinytim/trunk/main/java/org/tinytim/index/IScopedIndex.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/index/ITypeInstanceIndex.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/index/ITypeInstanceIndex.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/index/ITypeInstanceIndex.java 2008-04-20 15:30:50 UTC (rev 19) @@ -0,0 +1,138 @@ +/* + * 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.index; + +import java.util.Collection; + +import org.tinytim.AssociationImpl; +import org.tinytim.AssociationRoleImpl; +import org.tinytim.OccurrenceImpl; +import org.tinytim.TopicNameImpl; +import org.tmapi.core.Topic; + +/** + * Type-instance index. This index allows the retrieval of all typed Topic Maps + * constructs and topics. + * + * Copied from the TMAPIX-project, this interface is not meant to be used + * outside of the tinyTiM package. Once TMAPI exposes <code>ITyped</code> this + * interface should be changed to return interfaces rather than the + * implementations. + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public interface ITypeInstanceIndex extends IIndex { + + /** + * Returns the topics that include the <code>type</code> as one of + * their types. + * + * @param type The type of topics to be returned. If <code>type</code> is + * <code>null</code> all untyped topics will be returned. + * @return A (maybe empty) collection of topic instances. + */ + public Collection<Topic> getTopics(Topic... type); + + /** + * Returns the associations that are typed by the {@link org.tmapi.core.Topic} + * <code>type</code>. + * + * @param type The type of associations to be returned. + * If <code>type</code> is <code>null</code> all untyped + * associations will be returned. + * @return A (maybe empty) collection of topic instances. + */ + public Collection<AssociationImpl> getAssociations(Topic type); + + /** + * Returns the association roles that are typed by the + * {@link org.tmapi.core.Topic} <code>type</code>. + * + * @param type The type of association roles to be returned. + * If <code>type</code> is <code>null</code> all untyped + * association roles will be returned. + * @return A (maybe empty) collection of topic instances. + */ + public Collection<AssociationRoleImpl> getRoles(Topic type); + + /** + * Returns the occurrences that are typed by the {@link org.tmapi.core.Topic} + * <code>type</code>. + * + * @param type The type of occurrences to be returned. + * If <code>type</code> is <code>null</code> all untyped + * occurrences will be returned. + * @return A (maybe empty) collection of topic instances. + */ + public Collection<OccurrenceImpl> getOccurrences(Topic type); + + /** + * Returns the topic names that are typed by the {@link org.tmapi.core.Topic} + * <code>type</code>. + * + * @param type The type of topic names to be returned. + * If <code>type</code> is <code>null</code> all untyped + * topic names will be returned. + * @return A (maybe empty) collection of topic instances. + */ + public Collection<TopicNameImpl> getNames(Topic type); + + /** + * Returns the topics that are used as type of {@link org.tmapi.core.Topic}s. + * + * @return A (maybe empty) collection of topic instances. + */ + public Collection<Topic> getTopicTypes(); + + /** + * Returns the topics that are used as type of + * {@link org.tmapi.core.Association}s. + * + * @return A (maybe empty) collection of topic instances. + */ + public Collection<Topic> getAssociationTypes(); + + /** + * Returns the topics that are used as type of + * {@link org.tmapi.core.AssociationRole}s. + * + * @return A (maybe empty) collection of topic instances. + */ + public Collection<Topic> getRoleTypes(); + + /** + * Returns the topics that are used as type of + * {@link org.tmapi.core.Occurrence}s. + * + * @return A (maybe empty) collection of topic instances. + */ + public Collection<Topic> getOccurrenceTypes(); + + /** + * Returns the topics that are used as type of + * {@link org.tmapi.core.TopicName}s. + * + * @return A (maybe empty) collection of topic instances. + */ + public Collection<Topic> getNameTypes(); + +} Property changes on: tinytim/trunk/main/java/org/tinytim/index/ITypeInstanceIndex.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native Added: tinytim/trunk/main/java/org/tinytim/index/IndexFlagsImpl.java =================================================================== --- tinytim/trunk/main/java/org/tinytim/index/IndexFlagsImpl.java (rev 0) +++ tinytim/trunk/main/java/org/tinytim/index/IndexFlagsImpl.java 2008-04-20 15:30:50 UTC (rev 19) @@ -0,0 +1,51 @@ +/* + * 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.index; + +import org.tmapi.index.IndexFlags; + +/** + * Immutable {@link org.tmapi.index.IndexFlags} implementation. + * + * Use {@link #AUTOUPDATED} or {@link #NOT_AUTOUPDATED} + * + * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> + * @version $Rev:$ - $Date:$ + */ +public class IndexFlagsImpl implements IndexFlags { + + public static IndexFlags AUTOUPDATED = new IndexFlagsImpl(true); + public static IndexFlags NOT_AUTOUPDATED = new IndexFlagsImpl(false); + + private final boolean _autoUpdated; + + private IndexFlagsImpl(boolean autoUpdated) { + _autoUpdated = autoUpdated; + } + + /* (non-Javadoc) + * @see org.tmapi.index.IndexFlags#isAutoUpdated() + */ + public boolean isAutoUpdated() { + return _autoUpdated; + } + +} Property changes on: tinytim/trunk/main/java/org/tinytim/index/IndexFlagsImpl.java ___________________________________________________________________ Name: svn:keywords + Rev Date Id Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |