Class LocationMapper

java.lang.Object
  |
  +--LocationMapper

public class LocationMapper
extends java.lang.Object

Service Class

This class enables a mapping of hierarchical locations or components (i.e. their instantition) to flat ones.

This mapping can be retrieved lateron, which is neccessary for the translation of global joins.

Version:
Vanilla-1 Mon Apr 9 10:04:40 2001
Author:
M. Oliver Möller
See Also:
GlobalJoin

Field Summary
(package private) static boolean allEntriesAreCreated
           
(package private) static boolean debug
          Spam out debuggin information, if debug is true
private  FlatDocumentWriter fdw
          Relevant writer (necessary to create object)
private  java.util.Hashtable hashHierarchicalLocationsToHashtable
          Maps (basic) hierarchical locations to another hashtable, that maps textual instantiations to Elements, namely the Element this particular instantion of a location was translated to.
private  java.util.Hashtable hashIDConcatenationsToFlatLocations
          Maps concatentations of separators to another hashtable, that maps TextualInstantiations to (flat) locations.
Used to map entries of hierarchical components.
private  java.util.Hashtable hashTextualInstantitionsToActiveLocation
          Maps textual instantions to their active locations.

In Vanilla-1, there is only one unique active location per AND Component.
private  java.util.Hashtable hashTextualInstantitionsToIdleLocation
          Maps textual instantions to their idle locations.

In Vanilla-1, there is only one unique active location per Component.
private  HierarchicalDocumentReader hdr
          Relevant reader (necessary to follow ID references)
(package private) static boolean sanityChecks
          Do (possibly time-consuming) sanity checks, if true
private static java.lang.String unambigousIDSeparator
          Separates IDs of element and contiains characters that are disallowed for XML IDs, thus no concatations of different IDs with this separator can give a clash
 
Constructor Summary
LocationMapper(HierarchicalDocumentReader theHdr, FlatDocumentWriter theFdw)
          Default Constructor
 
Method Summary
 org.w3c.dom.Element mapHierachicalLocationToFlatOne(org.w3c.dom.Element loc, TextualInstantiation tinst)
          Computes the mapping

{Locations, Components} * TextualInstantiation -> Location


Throws an exception, if there is no entry.
 org.w3c.dom.Element mapTargetIDEntryrefToFlatLocation(java.lang.String elementID, java.lang.String entryID, TextualInstantiation tinst)
          Map ID of Element a connection points to and (possibly) the ID of the entry to a coresponding flat location.
(If it does not exist yet, invent a new (flat) location for it).

If the target point to a basic location, it behaves like
 org.w3c.dom.Element mapTargetToFlatLocation(org.w3c.dom.Element target, TextualInstantiation tinst)
          Map a (hierarchical) target to the flat location it points to.
(If it does not exist yet, invent a new (flat) location for it).

If the target point to a basic location, it behaves like
 org.w3c.dom.Element mapTextualInstantiationToActiveLocation(TextualInstantiation tinst)
          for instantiations of AND templates
 org.w3c.dom.Element mapTextualInstantiationToIdleLocation(TextualInstantiation tinst)
          for instantiations of XOR/AND templates
 org.w3c.dom.Element migrateOrdinaryLocation(org.w3c.dom.Element loc, TextualInstantiation tinst)
          Take an ordinary location and return a flattened one.

Does NOT migrate all the children (this is job of Flatten, in particular of the methos transformLocationToFlat) and the ID is up to a change later.

However, it records a mapping
{Location, Component} * TextualInstantiation -> Location

that is needed in the translations of global joins.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

hdr

private HierarchicalDocumentReader hdr
Relevant reader (necessary to follow ID references)

fdw

private FlatDocumentWriter fdw
Relevant writer (necessary to create object)

hashHierarchicalLocationsToHashtable

private java.util.Hashtable hashHierarchicalLocationsToHashtable
Maps (basic) hierarchical locations to another hashtable, that maps textual instantiations to Elements, namely the Element this particular instantion of a location was translated to.
See Also:
GlobalJoin

hashTextualInstantitionsToActiveLocation

private java.util.Hashtable hashTextualInstantitionsToActiveLocation
Maps textual instantions to their active locations.

In Vanilla-1, there is only one unique active location per AND Component.
See Also:
GlobalJoin

hashTextualInstantitionsToIdleLocation

private java.util.Hashtable hashTextualInstantitionsToIdleLocation
Maps textual instantions to their idle locations.

In Vanilla-1, there is only one unique active location per Component.
See Also:
GlobalJoin

unambigousIDSeparator

private static final java.lang.String unambigousIDSeparator
Separates IDs of element and contiains characters that are disallowed for XML IDs, thus no concatations of different IDs with this separator can give a clash

hashIDConcatenationsToFlatLocations

private java.util.Hashtable hashIDConcatenationsToFlatLocations
Maps concatentations of separators to another hashtable, that maps TextualInstantiations to (flat) locations.
Used to map entries of hierarchical components.

debug

static boolean debug
Spam out debuggin information, if debug is true

sanityChecks

static boolean sanityChecks
Do (possibly time-consuming) sanity checks, if true

allEntriesAreCreated

static boolean allEntriesAreCreated
Constructor Detail

LocationMapper

public LocationMapper(HierarchicalDocumentReader theHdr,
                      FlatDocumentWriter theFdw)
Default Constructor
Method Detail

migrateOrdinaryLocation

public org.w3c.dom.Element migrateOrdinaryLocation(org.w3c.dom.Element loc,
                                                   TextualInstantiation tinst)
                                            throws java.lang.Exception
Take an ordinary location and return a flattened one.

Does NOT migrate all the children (this is job of Flatten, in particular of the methos transformLocationToFlat) and the ID is up to a change later.

However, it records a mapping
{Location, Component} * TextualInstantiation -> Location

that is needed in the translations of global joins.

In the case, there is a component, it maps to the flat location, in the father of the instantiation of this component, that corresponds to the situation that the component is active.
See Also:
GlobalJoin, Flatten

mapTextualInstantiationToActiveLocation

public org.w3c.dom.Element mapTextualInstantiationToActiveLocation(TextualInstantiation tinst)
                                                            throws java.lang.Exception

for instantiations of AND templates

Retrieve the location Element (in some template, that is instantiatied exactly once), that corresponds to the instantiated component to be active.

If it does not exist yet, invent it.

If not called on an AND instantiation, an exception is thrown.

mapTextualInstantiationToIdleLocation

public org.w3c.dom.Element mapTextualInstantiationToIdleLocation(TextualInstantiation tinst)
                                                          throws java.lang.Exception

for instantiations of XOR/AND templates

Retrieve the location Element (in some template, that is instantiatied exactly once), that corresponds to the instantiated component to be idle.


If it does not exist yet, invent it.


mapHierachicalLocationToFlatOne

public org.w3c.dom.Element mapHierachicalLocationToFlatOne(org.w3c.dom.Element loc,
                                                           TextualInstantiation tinst)
                                                    throws java.lang.Exception
Computes the mapping

{Locations, Components} * TextualInstantiation -> Location


Throws an exception, if there is no entry.

mapTargetToFlatLocation

public org.w3c.dom.Element mapTargetToFlatLocation(org.w3c.dom.Element target,
                                                   TextualInstantiation tinst)
                                            throws java.lang.Exception
Map a (hierarchical) target to the flat location it points to.
(If it does not exist yet, invent a new (flat) location for it).

If the target point to a basic location, it behaves like

mapTargetIDEntryrefToFlatLocation

public org.w3c.dom.Element mapTargetIDEntryrefToFlatLocation(java.lang.String elementID,
                                                             java.lang.String entryID,
                                                             TextualInstantiation tinst)
                                                      throws java.lang.Exception
Map ID of Element a connection points to and (possibly) the ID of the entry to a coresponding flat location.
(If it does not exist yet, invent a new (flat) location for it).

If the target point to a basic location, it behaves like