public class TopicMapImpl extends TopicMap
Modifier and Type | Field and Description |
---|---|
private java.util.Set<Association> |
associations
All associations in this topic map.
|
private java.util.Map<Topic,java.util.Collection<Association>> |
associationTypeIndex
Indexes associations according to their type.
|
private java.util.List<TopicMapListener> |
disabledListeners |
private static int |
idCounter |
private java.util.Map<java.lang.String,Topic> |
idIndex
Indexes topics according to their id.
|
private java.util.Map<java.lang.String,Topic> |
nameIndex
Indexes topics according to base names.
|
private java.util.Map<Locator,Topic> |
subjectIdentifierIndex
Indexes topics according to subject identifiers.
|
private java.util.Map<Locator,Topic> |
subjectLocatorIndex
Indexes topics according to subject locators.
|
private boolean |
topicMapChanged |
private static int |
topicMapCounter |
private int |
topicMapID |
private java.util.List<TopicMapListener> |
topicMapListeners |
private java.util.Set<Topic> |
topics
All topics in this topic map.
|
private boolean |
trackDependent |
private java.util.Map<Topic,java.util.Collection<Topic>> |
typeIndex
Indexes topics according to their type.
|
consistencyCheck, consistencyCheckWhenXTMImport, EDITTIME_SI, isReadOnly, logger, parentTopicMap
Constructor and Description |
---|
TopicMapImpl() |
TopicMapImpl(java.lang.String topicmapFile)
Creates a new instance of TopicMapImpl
|
Modifier and Type | Method and Description |
---|---|
private Association |
_copyAssociationIn(Association a) |
private Topic |
_copyTopicIn(Topic t,
boolean deep,
boolean stub,
java.util.Hashtable copied) |
private Topic |
_copyTopicIn(Topic t,
boolean deep,
java.util.Hashtable copied) |
void |
addTopicMapListener(TopicMapListener listener)
Adds a topic map listener.
|
void |
addTopicSubjectIdentifier(Topic t,
Locator l) |
void |
addTopicType(Topic t,
Topic type) |
void |
associationChanged(Association a) |
void |
associationPlayerChanged(Association a,
Topic role,
Topic newPlayer,
Topic oldPlayer) |
void |
associationRemoved(Association a) |
void |
associationTypeChanged(Association a,
Topic newType,
Topic oldType) |
void |
checkAssociationConsistency(TopicMapLogger logger)
Checks association consistency and fixes any inconsistencies.
|
void |
clearTopicMap()
Completely clears the topic map.
|
void |
clearTopicMapIndexes()
If the topic map implementation keeps indexes or caches of topics, calling
this method will clear such data structures and cause further methods to
retrieve data directly from the original data source.
|
void |
close()
Close the topic map.
|
protected AssociationImpl |
constructAssociation(Topic type) |
protected TopicImpl |
constructTopic() |
protected TopicImpl |
constructTopic(java.lang.String id) |
Association |
copyAssociationIn(Association a)
Copies an association of a different topic map in this topic map.
|
void |
copyTopicAssociationsIn(Topic t)
Copies all associations of a topic of a different topic map in this topic
map using copyAssociationIn.
|
Topic |
copyTopicIn(Topic t,
boolean deep)
Copies a topic of different topic map in this topic map.
|
Association |
createAssociation(Topic type)
Creates a new association of the given type without any members.
|
Topic |
createTopic()
Creates a new topic without base name, subject identifier, data or any associations.
|
Topic |
createTopic(java.lang.String id)
Creates a new topic without base name, subject identifier, data or any associations.
|
void |
disableAllListeners() |
void |
duplicateAssociationRemoved(Association a,
Association removeda) |
void |
enableAllListeners() |
java.util.Iterator |
getAssociations()
Returns all associations in the topic map.
|
java.util.Collection |
getAssociationsOfType(Topic type)
Returns all associations in the topic map that are of the given type.
|
private int |
getIDCounter() |
int |
getNumAssociations()
Returns the number of associations in topic map.
|
int |
getNumTopics()
Returns the number of topics in topic map.
|
TopicMapStatData |
getStatistics(TopicMapStatOptions options) |
Topic |
getTopic(java.util.Collection SIs) |
Topic |
getTopic(Locator si)
Gets a topic with subject identifier.
|
Topic |
getTopicBySubjectLocator(Locator sl)
Gets a topic with subject locator.
|
java.util.List<TopicMapListener> |
getTopicMapListeners()
Gets all topic map listeners.
|
java.util.Iterator |
getTopics()
Gets all topics in the topic map.
|
Topic[] |
getTopics(java.lang.String[] sis)
Gets the topics whose subject identifiers are given in the array.
|
java.util.Collection |
getTopicsOfType(Topic type)
Gets all topics in the topic map that are of the given type.
|
Topic |
getTopicWithBaseName(java.lang.String name)
Gets a topic with topic base name.
|
java.util.Collection |
getTypeTopics() |
boolean |
isTopicMapChanged()
Checks if the topic map has been changed since the last call to resetTopicMapChanged.
|
void |
mergeIn(TopicMap tm)
Merges the contents of the given topic map in this topic map.
|
void |
removeTopicMapListener(TopicMapListener listener)
Removes a topic map listener.
|
void |
removeTopicSubjectIdentifier(Topic t,
Locator l) |
void |
removeTopicSubjectLocator(Topic t,
Locator l) |
void |
removeTopicType(Topic t,
Topic type) |
boolean |
resetTopicMapChanged() |
java.util.Collection<Topic> |
search(java.lang.String query,
TopicMapSearchOptions options)
Searches the topic map for the given string.
|
private boolean |
searchMatch(java.lang.String s,
java.util.regex.Pattern p) |
void |
setAssociationType(Association a,
Topic type,
Topic oldtype) |
void |
setTopicName(Topic t,
java.lang.String name,
java.lang.String oldname) |
void |
setTopicSubjectLocator(Topic t,
Locator l,
Locator oldLocator) |
void |
setTrackDependent(boolean v)
NOTE: The two trackDependent methods are mostly deprecated.
|
void |
topicBaseNameChanged(Topic t,
java.lang.String newName,
java.lang.String oldName) |
void |
topicChanged(Topic t) |
void |
topicDataChanged(Topic t,
Topic type,
Topic version,
java.lang.String newValue,
java.lang.String oldValue) |
void |
topicRemoved(Topic t) |
void |
topicsMerged(Topic newtopic,
Topic deletedtopic) |
void |
topicSubjectIdentifierChanged(Topic t,
Locator added,
Locator removed) |
void |
topicSubjectLocatorChanged(Topic t,
Locator newLocator,
Locator oldLocator) |
void |
topicTypeChanged(Topic t,
Topic added,
Topic removed) |
void |
topicVariantChanged(Topic t,
java.util.Collection<Topic> scope,
java.lang.String newName,
java.lang.String oldName) |
boolean |
trackingDependent() |
addTopicMapListeners, checkAssociationConsistency, copyTopicCollectionIn, createLocator, createLocator, escapeXML, exportJTM, exportJTM, exportJTM, exportJTM, exportLTM, exportLTM, exportLTM, exportLTM, exportTopicMap, exportTopicMap, exportXTM, exportXTM, exportXTM, exportXTM, exportXTM10, exportXTM10, exportXTM10, exportXTM20, exportXTM20, forceStop, getConsistencyCheck, getLogger, getMergingTopics, getParentTopicMap, getRootTopicMap, getTopic, getTopicBySubjectLocator, getTopics, getTopicsOfType, hlog, importJTM, importJTM, importJTM, importJTM, importJTM, importJTM, importLTM, importLTM, importLTM, importLTM, importLTM, importLTM, importTopicMap, importTopicMap, importTopicMap, importXTM, importXTM, importXTM, importXTM, importXTM, isConnected, isReadOnly, log, log, log, makeJTMString, makeJTMTopicId, makeLTMString, makeLTMTopicId, makeSubjectIndicator, makeSubjectIndicatorAsLocator, mergeIn, setConsistencyCheck, setLogger, setLogTitle, setParentTopicMap, setProgress, setProgressMax, setReadOnly
private java.util.List<TopicMapListener> topicMapListeners
private java.util.List<TopicMapListener> disabledListeners
private int topicMapID
private static int topicMapCounter
private java.util.Map<java.lang.String,Topic> idIndex
private java.util.Map<Topic,java.util.Collection<Topic>> typeIndex
private java.util.Map<Locator,Topic> subjectIdentifierIndex
private java.util.Map<Locator,Topic> subjectLocatorIndex
private java.util.Map<java.lang.String,Topic> nameIndex
private java.util.Map<Topic,java.util.Collection<Association>> associationTypeIndex
private java.util.Set<Topic> topics
private java.util.Set<Association> associations
private boolean trackDependent
private boolean topicMapChanged
private static int idCounter
public TopicMapImpl(java.lang.String topicmapFile)
public TopicMapImpl()
public void clearTopicMap() throws TopicMapException
TopicMap
clearTopicMap
in class TopicMap
TopicMapException
public void clearTopicMapIndexes() throws TopicMapException
TopicMap
clearTopicMapIndexes
in class TopicMap
TopicMapException
public void close()
TopicMap
public void checkAssociationConsistency(TopicMapLogger logger) throws TopicMapException
checkAssociationConsistency
in class TopicMap
TopicMapException
public java.util.List<TopicMapListener> getTopicMapListeners()
TopicMap
getTopicMapListeners
in class TopicMap
public void addTopicMapListener(TopicMapListener listener)
TopicMap
addTopicMapListener
in class TopicMap
public void removeTopicMapListener(TopicMapListener listener)
TopicMap
removeTopicMapListener
in class TopicMap
public void disableAllListeners()
disableAllListeners
in class TopicMap
public void enableAllListeners()
enableAllListeners
in class TopicMap
protected TopicImpl constructTopic(java.lang.String id) throws TopicMapException
TopicMapException
protected TopicImpl constructTopic() throws TopicMapException
TopicMapException
public Topic createTopic(java.lang.String id) throws TopicMapException
TopicMap
createTopic
in class TopicMap
TopicMapException
public Topic createTopic() throws TopicMapException
TopicMap
createTopic
in class TopicMap
TopicMapException
protected AssociationImpl constructAssociation(Topic type) throws TopicMapException
TopicMapException
public Association createAssociation(Topic type) throws TopicMapException
TopicMap
createAssociation
in class TopicMap
TopicMapException
public Topic getTopic(Locator si) throws TopicMapException
TopicMap
getTopic
in class TopicMap
TopicMapException
public Topic getTopicWithBaseName(java.lang.String name) throws TopicMapException
TopicMap
getTopicWithBaseName
in class TopicMap
TopicMapException
public java.util.Collection getTopicsOfType(Topic type) throws TopicMapException
TopicMap
getTopicsOfType
in class TopicMap
TopicMapException
public java.util.Collection getTypeTopics() throws TopicMapException
TopicMapException
public Topic getTopicBySubjectLocator(Locator sl) throws TopicMapException
TopicMap
getTopicBySubjectLocator
in class TopicMap
TopicMapException
public java.util.Iterator getTopics() throws TopicMapException
TopicMap
getTopics
in class TopicMap
TopicMapException
public Topic[] getTopics(java.lang.String[] sis) throws TopicMapException
TopicMap
getTopics
in class TopicMap
TopicMapException
public java.util.Iterator getAssociations() throws TopicMapException
TopicMap
getAssociations
in class TopicMap
TopicMapException
public java.util.Collection getAssociationsOfType(Topic type) throws TopicMapException
TopicMap
getAssociationsOfType
in class TopicMap
TopicMapException
public Topic getTopic(java.util.Collection SIs) throws TopicMapException
TopicMapException
private int getIDCounter()
private Topic _copyTopicIn(Topic t, boolean deep, java.util.Hashtable copied) throws TopicMapException
TopicMapException
private Topic _copyTopicIn(Topic t, boolean deep, boolean stub, java.util.Hashtable copied) throws TopicMapException
TopicMapException
private Association _copyAssociationIn(Association a) throws TopicMapException
TopicMapException
public Association copyAssociationIn(Association a) throws TopicMapException
TopicMap
copyAssociationIn
in class TopicMap
TopicMapException
public Topic copyTopicIn(Topic t, boolean deep) throws TopicMapException
TopicMap
copyTopicIn
in class TopicMap
TopicMapException
public void mergeIn(TopicMap tm) throws TopicMapException
TopicMap
mergeIn
in class TopicMap
TopicMapException
public void copyTopicAssociationsIn(Topic t) throws TopicMapException
TopicMap
copyTopicAssociationsIn
in class TopicMap
TopicMapException
public void addTopicSubjectIdentifier(Topic t, Locator l) throws TopicMapException
TopicMapException
public void removeTopicSubjectIdentifier(Topic t, Locator l) throws TopicMapException
TopicMapException
public void setTopicSubjectLocator(Topic t, Locator l, Locator oldLocator) throws TopicMapException
TopicMapException
public void removeTopicSubjectLocator(Topic t, Locator l) throws TopicMapException
TopicMapException
public void addTopicType(Topic t, Topic type) throws TopicMapException
TopicMapException
public void removeTopicType(Topic t, Topic type) throws TopicMapException
TopicMapException
public void setTopicName(Topic t, java.lang.String name, java.lang.String oldname) throws TopicMapException
TopicMapException
public void setAssociationType(Association a, Topic type, Topic oldtype) throws TopicMapException
TopicMapException
public void topicRemoved(Topic t) throws TopicMapException
TopicMapException
public void associationRemoved(Association a) throws TopicMapException
TopicMapException
public void duplicateAssociationRemoved(Association a, Association removeda)
public int getNumAssociations() throws TopicMapException
TopicMap
getNumAssociations
in class TopicMap
TopicMapException
public int getNumTopics() throws TopicMapException
TopicMap
getNumTopics
in class TopicMap
TopicMapException
public boolean trackingDependent()
trackingDependent
in class TopicMap
public void setTrackDependent(boolean v)
TopicMap
setTrackDependent
in class TopicMap
public void topicSubjectIdentifierChanged(Topic t, Locator added, Locator removed) throws TopicMapException
TopicMapException
public void topicBaseNameChanged(Topic t, java.lang.String newName, java.lang.String oldName) throws TopicMapException
TopicMapException
public void topicTypeChanged(Topic t, Topic added, Topic removed) throws TopicMapException
TopicMapException
public void topicVariantChanged(Topic t, java.util.Collection<Topic> scope, java.lang.String newName, java.lang.String oldName) throws TopicMapException
TopicMapException
public void topicDataChanged(Topic t, Topic type, Topic version, java.lang.String newValue, java.lang.String oldValue) throws TopicMapException
TopicMapException
public void topicSubjectLocatorChanged(Topic t, Locator newLocator, Locator oldLocator) throws TopicMapException
TopicMapException
public void topicChanged(Topic t) throws TopicMapException
TopicMapException
public void associationTypeChanged(Association a, Topic newType, Topic oldType) throws TopicMapException
TopicMapException
public void associationPlayerChanged(Association a, Topic role, Topic newPlayer, Topic oldPlayer) throws TopicMapException
TopicMapException
public void associationChanged(Association a) throws TopicMapException
TopicMapException
public boolean resetTopicMapChanged()
resetTopicMapChanged
in class TopicMap
TopicMap.isTopicMapChanged()
public boolean isTopicMapChanged()
TopicMap
isTopicMapChanged
in class TopicMap
public java.util.Collection<Topic> search(java.lang.String query, TopicMapSearchOptions options) throws TopicMapException
TopicMap
search
in class TopicMap
TopicMapException
private boolean searchMatch(java.lang.String s, java.util.regex.Pattern p)
public TopicMapStatData getStatistics(TopicMapStatOptions options) throws TopicMapException
getStatistics
in class TopicMap
TopicMapException
Copyright 2004-2015 Wandora Team