agg.attribute.facade.impl
Class DefaultTransformationFacade

java.lang.Object
  extended by agg.attribute.facade.impl.DefaultTransformationFacade
All Implemented Interfaces:
TransformationFacade

public class DefaultTransformationFacade
extends java.lang.Object
implements TransformationFacade

Collection of methods for storing and retrieving information in attribute tuples and members.


Field Summary
protected static DefaultTransformationFacade myOnlyInstance
           
 
Constructor Summary
protected DefaultTransformationFacade()
           
 
Method Summary
 void apply(AttrInstance workGraphInst, AttrInstance rightSideInst, AttrContext context)
          Applying a rule; the substitutions occur "in-place" (in the recipient); In Graph Transformation, this method is applied to attributes of host graph objects, "rightSide" being an attribute of the right side of the rule and "context" being the "match"-context built up by subsequently matching the attributes of corresponding graphical objects.
 void checkIfReadyToMatch(AttrContext ruleContext)
          Checking if matching can be performed with respect to a given rule context.
 void checkIfReadyToTransform(AttrContext matchContext)
          Checking if a transformation can be performed with the attributes with respect to a given context.
 AttrManager getAttrManager()
          Returns the default attribute manager which can be used for advanced operations not provided by this facade.
 AttrContext getLeftContext(AttrContext ruleContext)
          Returns the left side context to a rule context.
 int getNumberOfFreeVariables(AttrInstance tuple, AttrContext context)
          Getting the number of variables declared by an instance which have no value assigned to them yet.
 AttrContext getRightContext(AttrContext ruleContext)
          Returns the right side context to a rule context.
 AttrMapping newMapping(AttrContext mappingContext, AttrInstance source, AttrInstance target)
          Mapping between two attribute instances; The mapping is done according to the context property (rule/match) and is integrated into the context;
 AttrContext newMatchContext(AttrContext ruleContext)
          Creates and returns a new match context to a rule context.
 AttrContext newRuleContext()
          Creates and returns a new rule context.
 boolean nextMapping(AttrMapping mapping)
          Use the next possible attribute mapping;
 void removeMapping(AttrMapping mapping)
          Discard mapping; Removes variable assignments made by a mapping from its context and dissolves the connection between the attribute instances.
static TransformationFacade self()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myOnlyInstance

protected static DefaultTransformationFacade myOnlyInstance
Constructor Detail

DefaultTransformationFacade

protected DefaultTransformationFacade()
Method Detail

self

public static TransformationFacade self()

getAttrManager

public AttrManager getAttrManager()
Returns the default attribute manager which can be used for advanced operations not provided by this facade.

Specified by:
getAttrManager in interface TransformationFacade

newRuleContext

public AttrContext newRuleContext()
Creates and returns a new rule context. Typically calls newContext( AttrMapping.PLAIN_MAP ) of the default AttrManager.

Specified by:
newRuleContext in interface TransformationFacade

getLeftContext

public AttrContext getLeftContext(AttrContext ruleContext)
Returns the left side context to a rule context. Typically calls newLeftContext( ruleContext ) of the default AttrManager.

Specified by:
getLeftContext in interface TransformationFacade

getRightContext

public AttrContext getRightContext(AttrContext ruleContext)
Returns the right side context to a rule context. Typically calls newRightContext( ruleContext ) of the default AttrManager.

Specified by:
getRightContext in interface TransformationFacade

checkIfReadyToMatch

public void checkIfReadyToMatch(AttrContext ruleContext)
                         throws AttrException
Checking if matching can be performed with respect to a given rule context. If the rule context in question is without inconsistencies, this method remains 'silent'. Otherwise, it throws an exception whose message text describes the reason.

Specified by:
checkIfReadyToMatch in interface TransformationFacade
Throws:
AttrException

newMatchContext

public AttrContext newMatchContext(AttrContext ruleContext)
Creates and returns a new match context to a rule context. Typically calls newContext( AttrMapping.MATCH_MAP, ruleContext ) of the default AttrManager.

Specified by:
newMatchContext in interface TransformationFacade

newMapping

public AttrMapping newMapping(AttrContext mappingContext,
                              AttrInstance source,
                              AttrInstance target)
                       throws AttrException
Mapping between two attribute instances; The mapping is done according to the context property (rule/match) and is integrated into the context;

Specified by:
newMapping in interface TransformationFacade
Parameters:
mappingContext - The context to include the mapping in
source - Mapping source attribute
target - Mapping target attribute
Returns:
A handle to the mapping; it can be used to undo the mapping (remove()) or to proceed to the next possible one (next()). If the mapping context is that of a match, a match on the attributes is tried. If this fails, "null" is returned.
Throws:
AttrException

nextMapping

public boolean nextMapping(AttrMapping mapping)
Use the next possible attribute mapping;

Specified by:
nextMapping in interface TransformationFacade
Returns:
"true" if more subsequent mappings exist, "false" otherwise.

removeMapping

public void removeMapping(AttrMapping mapping)
Discard mapping; Removes variable assignments made by a mapping from its context and dissolves the connection between the attribute instances.

Specified by:
removeMapping in interface TransformationFacade

checkIfReadyToTransform

public void checkIfReadyToTransform(AttrContext matchContext)
                             throws AttrException
Checking if a transformation can be performed with the attributes with respect to a given context. If the match context in question is complete and without inconsistencies, this method remains 'silent'. Otherwise, it throws an exception whose message text describes the reason.

Specified by:
checkIfReadyToTransform in interface TransformationFacade
Throws:
AttrException

getNumberOfFreeVariables

public int getNumberOfFreeVariables(AttrInstance tuple,
                                    AttrContext context)
Getting the number of variables declared by an instance which have no value assigned to them yet. Each variable name is counted only once, even if it is used more than once in this tuple.

Specified by:
getNumberOfFreeVariables in interface TransformationFacade
Returns:
The number of free variables.

apply

public void apply(AttrInstance workGraphInst,
                  AttrInstance rightSideInst,
                  AttrContext context)
Applying a rule; the substitutions occur "in-place" (in the recipient); In Graph Transformation, this method is applied to attributes of host graph objects, "rightSide" being an attribute of the right side of the rule and "context" being the "match"-context built up by subsequently matching the attributes of corresponding graphical objects.

Specified by:
apply in interface TransformationFacade