de.unihalle.informatik.Alida.operator
Class ALDPortHash

java.lang.Object
  extended by de.unihalle.informatik.Alida.operator.ALDPortHash

 class ALDPortHash
extends java.lang.Object

Hashmap keeping links between objects and data ports in processing history.

This class holds for each processed data item its link into the processing history. All data items manipulated by any Alida operator during a session are stored in this hash for later documentation.

The basic concept of Alida assumes that data objects are manipulated by operators. Accordingly, to log data object manipulations it is straightforward to trace all operator calls with their configurations, i.e. input and output objects and parameter settings. If in addition also the order of operator calls is available it is possible to reconstruct the processing history for each single data object.

This hash stores for each data object a link (via a port) to the last manipulating operator. Internally, operators are further linked together allowing to trace back the whole processing history.

Author:
moeller

Field Summary
private static ALDConcReadWeakHashMap historyAnchors
          Hashmap of port links into the processing history.
 
Constructor Summary
private ALDPortHash()
          Constructor without function.
 
Method Summary
protected static int getEntryNum()
          Returns the number of objects currently stored in the port hash.
protected static ALDPort getHistoryLink(java.lang.Object obj)
          Get port to which object is currently linked in the history.
protected static boolean isRegistered(java.lang.Object obj)
          Returns true if the given object is already registered in the hash.
protected static void register(java.lang.Object obj)
          Adds the object's port to the hash.
protected static void setHistoryLink(java.lang.Object obj, ALDPort port)
          Set port to which data is currently linked in the history.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

historyAnchors

private static ALDConcReadWeakHashMap historyAnchors
Hashmap of port links into the processing history.

Constructor Detail

ALDPortHash

private ALDPortHash()
Constructor without function.

Note that there will only be one port hash per session and not many different objects of this type.

Method Detail

getEntryNum

protected static int getEntryNum()
Returns the number of objects currently stored in the port hash.

Note that the number can be larger than the number of objects actually referenced from the Java process due to the management of weak references by the Java Garbage Collector.


getHistoryLink

protected static ALDPort getHistoryLink(java.lang.Object obj)
Get port to which object is currently linked in the history.

Returns:
Current port of this data, may be 'null'.

isRegistered

protected static boolean isRegistered(java.lang.Object obj)
Returns true if the given object is already registered in the hash.


register

protected static void register(java.lang.Object obj)
Adds the object's port to the hash.

If there is no key in the database equal to the given object, a new hashmap entry is generated, i.e. a new ALDDataPort is initialized and put into the port database. .

Parameters:
obj - Object to be registered.

setHistoryLink

protected static void setHistoryLink(java.lang.Object obj,
                                     ALDPort port)
Set port to which data is currently linked in the history.

Note that if the object was not registered before, this is done now. Subsequently the port is set to the given port object.

Parameters:
port - New current port the data is linked to.