freemind.modes
Class LinkRegistryAdapter

java.lang.Object
  extended byfreemind.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
 class LinkRegistryAdapter.ID_BasicStateAdapter
          State parent interface.
 class LinkRegistryAdapter.ID_BlankAdapter
          This state interface expresses the state that a node is blank (i.e.
protected  class LinkRegistryAdapter.ID_RegisteredAdapter
          This state interface expresses the state that a node has an ID.
protected  class LinkRegistryAdapter.ID_UsedStateAdapter
          This state interface expresses the state that a node has an ID, but is abstract.
 
Nested classes inherited from class freemind.modes.MindMapLinkRegistry
MindMapLinkRegistry.ID_BasicState, MindMapLinkRegistry.ID_Blank, MindMapLinkRegistry.ID_Registered, MindMapLinkRegistry.ID_UsedState
 
Field Summary
protected  java.util.HashMap IDToCuttedLinks
           
protected  java.util.HashMap IDToLink
           
protected  java.util.HashMap IDToLinks
           
protected static java.util.Random ran
           
protected  java.util.HashMap TargetToID
           
 
Constructor Summary
LinkRegistryAdapter()
           
 
Method Summary
 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)
          Exception if there are still targets registered.
 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 getCuttedNode(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.
 MindMapLinkRegistry.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.
 void registerLink(MindMapLink link)
          Method to keep track of the sources associated to a target node.
 MindMapLinkRegistry.ID_Registered registerLinkTarget(MindMapNode target)
          The main method.
 MindMapLinkRegistry.ID_Registered registerLinkTarget(MindMapNode target, java.lang.String proposedID)
          The second variant of the main method.
 
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

IDToLinks

protected java.util.HashMap IDToLinks

IDToCuttedLinks

protected java.util.HashMap IDToCuttedLinks

IDToLink

protected java.util.HashMap IDToLink

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 MindMapLinkRegistry.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.

Specified by:
registerLinkTarget in interface MindMapLinkRegistry

registerLinkTarget

public MindMapLinkRegistry.ID_Registered registerLinkTarget(MindMapNode target,
                                                            java.lang.String proposedID)
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

getState

public MindMapLinkRegistry.ID_BasicState getState(MindMapNode node)
Specified by:
getState in interface MindMapLinkRegistry

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
Exception if there are still targets registered.

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.

Specified by:
getAllSources in interface MindMapLinkRegistry

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

getCuttedNode

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