ist.palcom.hmap
Class HmapDir

java.lang.Object
  extended by ist.palcom.hmap.HmapNode
      extended by ist.palcom.hmap.HmapDir
Direct Known Subclasses:
AbstractDisplayEngine, AbstractTypeManager, Accomplice, Display, HmapAssemblyWindow, HmapConnection, HmapDeviceWindow, HmapJButton, HmapJPanel, HmapMirrorer, HmapMirrorerCommunication, HmapMirrorerCommunication2, HmapServiceWindow

public class HmapDir
extends HmapNode


Nested Class Summary
 class HmapDir.EntryHandler
           
 
Nested classes/interfaces inherited from class ist.palcom.hmap.HmapNode
HmapNode.NameHandler
 
Field Summary
protected  Collection entries
          Collection of entries contained by this h-map dir.
static String HMAPDIR_COMMAND_ADDNODE
           
static String HMAPDIR_COMMAND_REMOVENODE
           
 
Fields inherited from class ist.palcom.hmap.HmapNode
HET_DIR, HET_LEAF, HET_UNKNOWN, HMAPNODE_COMMAND_GETNAME, HMAPNODE_COMMAND_SETNAME, nameInvokator, nodeInvokator, parent, path, valueInvokator
 
Constructor Summary
  HmapDir()
           
  HmapDir(String name)
           
protected HmapDir(String name, String typeName, String typeVersion, String typeFullyQualifiedVersion)
           
 
Method Summary
protected  void _addNode(HmapNode node)
           
 void addNode(HmapEvent event)
          Adds a hmap node to this dir Ensures that the child name is unique
 void addNode(HmapNode node)
          Adds a hmap node to this dir Ensures that the child name is unique
protected  void invokeHandlers(HmapEvent event)
          Relays the invocation of a handler in accordance with its destination given in the event
protected  void invokeHandlersDown(HmapEvent event)
          Invokes a handler on a downwards path.
protected  void invokeHandlersUp(HmapEvent event, int commonPoint)
          Invokes a handler on an upwards path with background in a precalculated common point
protected  boolean isAncestorOf(HmapNode node)
          Returns true if this node is a direct ancestor of
 Iterator iterator()
           
protected  void recalculatePath(HmapPath parentPath)
          Recalculates the path on the basis of the path of ones ancestors
 void removeNode(HmapEvent event)
           
 void removeNode(HmapNode node)
          Removes a node from this dir
 boolean removeNode(String name)
          Removes the first found child node of this dir named
 HmapNode resolve(HmapPath resolvePath, int type)
          Resolves the node a the given path
 HmapNode resolveLocally(HmapKey key, int type)
          Resolves a child of the current node
 String toString()
           
 String toString(int indent)
           
 String toStringAll(int indent)
           
 String toStringFlat()
           
 
Methods inherited from class ist.palcom.hmap.HmapNode
addHandler, addInvokator, addListener, asDir, asLeaf, callback, getFullyQualifiedType, getHmapEntryType, getKey, getName, getParent, getPath, getType, getTypeVersion, handle, handlerIterator, hasHandlers, hasInvokators, hasListeners, hasName, hasType, invokation, invokatorIterator, invokeListeners, isDir, isLeaf, listenerIterator, printHandlers, printInvokators, printListeners, recalculatePath, removeHandler, removeInvocator, removeListener, resolve, resolve, resolveDir, resolveDir, resolveDirLocally, resolveDirLocally, resolveLeaf, resolveLeaf, resolveLeafLocally, resolveLeafLocally, resolveLocally, resolveLocally, setName, setName, setParent
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, println
 

Field Detail

HMAPDIR_COMMAND_ADDNODE

public static final String HMAPDIR_COMMAND_ADDNODE
See Also:
Constant Field Values

HMAPDIR_COMMAND_REMOVENODE

public static final String HMAPDIR_COMMAND_REMOVENODE
See Also:
Constant Field Values

entries

protected Collection entries
Collection of entries contained by this h-map dir.

Constructor Detail

HmapDir

public HmapDir()

HmapDir

public HmapDir(String name)
Parameters:
name - The name of the directory

HmapDir

protected HmapDir(String name,
                  String typeName,
                  String typeVersion,
                  String typeFullyQualifiedVersion)
Method Detail

resolveLocally

public HmapNode resolveLocally(HmapKey key,
                               int type)
Description copied from class: HmapNode
Resolves a child of the current node

Specified by:
resolveLocally in class HmapNode
Parameters:
key - The key of the child
type - The type of the given node. Can be leaf, dir and unknown
Returns:
The resolved node; null if none was resolved

resolve

public HmapNode resolve(HmapPath resolvePath,
                        int type)
Resolves the node a the given path

Specified by:
resolve in class HmapNode
Parameters:
resolvePath - the path of the node to resolve
type - the type of the given node. Can be leaf, dir and unknown
Returns:
The resolved node if it exists. Null if not

invokeHandlers

protected void invokeHandlers(HmapEvent event)
Relays the invocation of a handler in accordance with its destination given in the event

Specified by:
invokeHandlers in class HmapNode
Parameters:
event - The event to invoke the handlers with

invokeHandlersUp

protected void invokeHandlersUp(HmapEvent event,
                                int commonPoint)
Invokes a handler on an upwards path with background in a precalculated common point

Parameters:
event - The HmapEvent
commonPoint - The precalculated common point between the current path and the path to be resolved

invokeHandlersDown

protected void invokeHandlersDown(HmapEvent event)
Invokes a handler on a downwards path.

Parameters:
event - The HmapEvent

addNode

public void addNode(HmapNode node)
Adds a hmap node to this dir Ensures that the child name is unique

Parameters:
node - The node to add

addNode

public void addNode(HmapEvent event)
Adds a hmap node to this dir Ensures that the child name is unique

Parameters:
event - The event containing node to add

_addNode

protected void _addNode(HmapNode node)

isAncestorOf

protected boolean isAncestorOf(HmapNode node)
Description copied from class: HmapNode
Returns true if this node is a direct ancestor of

Specified by:
isAncestorOf in class HmapNode
Parameters:
node - The potential (grand)child node
Returns:
True if this node is an ancestor of the given node. False if not

removeNode

public void removeNode(HmapNode node)
Removes a node from this dir

Parameters:
node - The entry to remove

removeNode

public void removeNode(HmapEvent event)

removeNode

public boolean removeNode(String name)
Removes the first found child node of this dir named

Parameters:
name - The name of the child node to remove
Returns:
True if a node has been removed. False if no node named was found

iterator

public Iterator iterator()
Returns:
The iterator of the internal datastructure holding the child entries

recalculatePath

protected void recalculatePath(HmapPath parentPath)
Description copied from class: HmapNode
Recalculates the path on the basis of the path of ones ancestors

Specified by:
recalculatePath in class HmapNode
Parameters:
parentPath - The path of ones parent

toString

public String toString()
Overrides:
toString in class Object
Returns:
A stringified version of the dir and its children

toStringFlat

public String toStringFlat()
Returns:
A stringified version of the dir

toString

public String toString(int indent)
Specified by:
toString in class HmapNode
Parameters:
indent - Start the returned string with a number of whitespaces
Returns:
A stringified version of the dir and its children

toStringAll

public String toStringAll(int indent)
Specified by:
toStringAll in class HmapNode
Parameters:
indent - prepend a number of whitespaces to the retured string
Returns:
a stringified version of this node with all handlers, invokators and listernes also