freemind.modes
Class LinkRegistryAdapter

java.lang.Object
  extended by freemind.modes.LinkRegistryAdapter
All Implemented Interfaces:
MindMapLinkRegistry

public class LinkRegistryAdapter
extends java.lang.Object
implements MindMapLinkRegistry

Interface for the registry, which manages the ids of nodes and the existing links in a map. Thus, this interface is bound to a map model, because other maps have a different registry.


Nested Class Summary
static interface LinkRegistryAdapter.ID_BasicState
          State parent interface.
 class LinkRegistryAdapter.ID_BasicStateAdapter
          State parent interface.
static interface LinkRegistryAdapter.ID_Blank
          This state interface expresses the state that a node is blank (i.e. without an id, normal state).
 class LinkRegistryAdapter.ID_BlankAdapter
          This state interface expresses the state that a node is blank (i.e. without an id, normal state).
static interface LinkRegistryAdapter.ID_Registered
          This state interface expresses the state that a node has an ID.
protected  class LinkRegistryAdapter.ID_RegisteredAdapter
          This state interface expresses the state that a node has an ID.
static interface LinkRegistryAdapter.ID_UsedState
          This state interface expresses the state that a node has an ID, but is abstract.
protected  class LinkRegistryAdapter.ID_UsedStateAdapter
          This state interface expresses the state that a node has an ID, but is abstract.
 
Field Summary
protected  java.util.HashMap IDToCutLinks
           
protected  java.util.HashMap IDToLink
           
protected  java.util.HashMap IDToLinks
           
protected  java.util.HashMap IDToTarget
           
protected  java.util.HashSet mLocallyLinkedIDs
           
protected static java.util.Random ran
           
protected  java.util.HashMap TargetToID
           
 
Constructor Summary
LinkRegistryAdapter()
           
 
Method Summary
 LinkRegistryAdapter.ID_Registered _registerLinkTarget(MindMapNode target)
          The main method.
 LinkRegistryAdapter.ID_Registered _registerLinkTarget(MindMapNode target, java.lang.String proposedID)
           
 void clearCuttedNodeBuffer()
          Clears the set of recent cutted nodes.
 void cutNode(MindMapNode target)
          Removes links to all nodes beginning from target with its children.
 void deregisterLink(MindMapLink link)
           
 void deregisterLinkTarget(MindMapNode target)
          If there are still targets registered, they are removed, too.
 java.lang.String generateUniqueID(java.lang.String proposedID)
          This can be used, if the id has to be known, before a node can be labled.
 java.lang.String generateUniqueLinkID(java.lang.String proposedID)
          This can be used, if the id has to be known, before a link can be labled.
 java.util.Vector getAllLinks(MindMapNode node)
           
 java.util.Vector getAllLinksFromMe(MindMapNode source)
           
 java.util.Vector getAllLinksIntoMe(MindMapNode target)
           
 java.util.Vector getAllSources(MindMapNode target)
          Returns a Vector of Nodes that point to the given target node.
 java.util.Vector getCuttedLinks(java.lang.String oldTargetID)
           
 java.lang.String getLabel(MindMapNode target)
           
 MindMapLink getLinkForID(java.lang.String ID)
          Reverses the getUniqueID method: searches for a link with the id given as the argument.
 LinkRegistryAdapter.ID_BasicState getState(MindMapNode node)
           
 MindMapNode getTargetForID(java.lang.String ID)
          Reverses the getLabel method: searches for a node with the id given as the argument.
 boolean isTargetOfLocalHyperlinks(java.lang.String pTargetId)
           
 void registerLink(MindMapLink link)
          Method to keep track of the sources associated to a target node.
 void registerLinkTarget(MindMapNode pTarget)
           
 java.lang.String registerLinkTarget(MindMapNode pTarget, java.lang.String pProposedID)
          The second variant of the main method.
 void registerLocalHyperlinkId(java.lang.String pTargetId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TargetToID

protected java.util.HashMap TargetToID

IDToTarget

protected java.util.HashMap IDToTarget

IDToLinks

protected java.util.HashMap IDToLinks

IDToCutLinks

protected java.util.HashMap IDToCutLinks

IDToLink

protected java.util.HashMap IDToLink

mLocallyLinkedIDs

protected java.util.HashSet mLocallyLinkedIDs

ran

protected static java.util.Random ran
Constructor Detail

LinkRegistryAdapter

public LinkRegistryAdapter()
Method Detail

generateUniqueID

public java.lang.String generateUniqueID(java.lang.String proposedID)
Description copied from interface: MindMapLinkRegistry
This can be used, if the id has to be known, before a node can be labled.

Specified by:
generateUniqueID in interface MindMapLinkRegistry

generateUniqueLinkID

public java.lang.String generateUniqueLinkID(java.lang.String proposedID)
Description copied from interface: MindMapLinkRegistry
This can be used, if the id has to be known, before a link can be labled.

Specified by:
generateUniqueLinkID in interface MindMapLinkRegistry

registerLinkTarget

public void registerLinkTarget(MindMapNode pTarget)
Specified by:
registerLinkTarget in interface MindMapLinkRegistry

registerLinkTarget

public java.lang.String registerLinkTarget(MindMapNode pTarget,
                                           java.lang.String pProposedID)
Description copied from interface: MindMapLinkRegistry
The second variant of the main method. The difference is that here an ID is proposed, but has not to be taken, though.

Specified by:
registerLinkTarget in interface MindMapLinkRegistry

_registerLinkTarget

public LinkRegistryAdapter.ID_Registered _registerLinkTarget(MindMapNode target)
The main method. Registeres a node with a new (or an existing) node-id. If the state of the id is pending, then it is set to registered again.


_registerLinkTarget

public LinkRegistryAdapter.ID_Registered _registerLinkTarget(MindMapNode target,
                                                             java.lang.String proposedID)

getState

public LinkRegistryAdapter.ID_BasicState getState(MindMapNode node)

getTargetForID

public MindMapNode getTargetForID(java.lang.String ID)
Description copied from interface: MindMapLinkRegistry
Reverses the getLabel method: searches for a node with the id given as the argument.

Specified by:
getTargetForID in interface MindMapLinkRegistry

deregisterLinkTarget

public void deregisterLinkTarget(MindMapNode target)
                          throws java.lang.IllegalArgumentException
If there are still targets registered, they are removed, too.

Specified by:
deregisterLinkTarget in interface MindMapLinkRegistry
Throws:
java.lang.IllegalArgumentException

registerLink

public void registerLink(MindMapLink link)
                  throws java.lang.IllegalArgumentException
Method to keep track of the sources associated to a target node. This method also sets the new id to the target. Moreover, it is not required that the target node is already registered. This will be done on the fly.

Specified by:
registerLink in interface MindMapLinkRegistry
Throws:
java.lang.IllegalArgumentException

deregisterLink

public void deregisterLink(MindMapLink link)
Specified by:
deregisterLink in interface MindMapLinkRegistry

getLinkForID

public MindMapLink getLinkForID(java.lang.String ID)
Description copied from interface: MindMapLinkRegistry
Reverses the getUniqueID method: searches for a link with the id given as the argument.

Specified by:
getLinkForID in interface MindMapLinkRegistry

getAllSources

public java.util.Vector getAllSources(MindMapNode target)
Returns a Vector of Nodes that point to the given target node.


getAllLinks

public java.util.Vector getAllLinks(MindMapNode node)
Specified by:
getAllLinks in interface MindMapLinkRegistry
Returns:
returns all links from or to this node.

getAllLinksIntoMe

public java.util.Vector getAllLinksIntoMe(MindMapNode target)
Specified by:
getAllLinksIntoMe in interface MindMapLinkRegistry
Returns:
returns all links to this node.

getAllLinksFromMe

public java.util.Vector getAllLinksFromMe(MindMapNode source)
Specified by:
getAllLinksFromMe in interface MindMapLinkRegistry
Returns:
returns all links from this node.

getLabel

public java.lang.String getLabel(MindMapNode target)
Specified by:
getLabel in interface MindMapLinkRegistry

cutNode

public void cutNode(MindMapNode target)
Description copied from interface: MindMapLinkRegistry
Removes links to all nodes beginning from target with its children.

Specified by:
cutNode in interface MindMapLinkRegistry

clearCuttedNodeBuffer

public void clearCuttedNodeBuffer()
Clears the set of recent cutted nodes.

Specified by:
clearCuttedNodeBuffer in interface MindMapLinkRegistry

getCuttedLinks

public java.util.Vector getCuttedLinks(java.lang.String oldTargetID)
Specified by:
getCuttedLinks in interface MindMapLinkRegistry
Returns:
returns all links that have been cutted out recently.

registerLocalHyperlinkId

public void registerLocalHyperlinkId(java.lang.String pTargetId)
Specified by:
registerLocalHyperlinkId in interface MindMapLinkRegistry

isTargetOfLocalHyperlinks

public boolean isTargetOfLocalHyperlinks(java.lang.String pTargetId)
Specified by:
isTargetOfLocalHyperlinks in interface MindMapLinkRegistry