agg.attribute.impl
Class AttrTupleManager

java.lang.Object
  extended by agg.attribute.impl.AttrObject
      extended by agg.attribute.impl.AttrTupleManager
All Implemented Interfaces:
AttrManager, java.io.Serializable, java.util.Observer

public class AttrTupleManager
extends AttrObject
implements AttrManager

Attribute Tuple Manager - Factory of attribute management; Provides creating services needed by graphical components.

See Also:
Serialized Form

Field Summary
protected  ContextView defaultContext
           
protected  AttrViewSetting defaultMaskedView
           
protected  AttrViewSetting defaultOpenView
           
protected  AttrViewSetting fixedViewSetting
           
protected  AttrHandler[] handlers
           
protected  boolean isCorrectInputEnforced
           
protected static AttrTupleManager myDefaultInstance
           
 
Fields inherited from class agg.attribute.impl.AttrObject
classHandlerExpr, classObject, classString, initialized
 
Fields inherited from interface agg.attribute.AttrManager
serialVersionUID
 
Constructor Summary
AttrTupleManager()
          Public constructor.
 
Method Summary
 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: variables and attribute conditions.
 void checkIfReadyToTransform(AttrContext matchContext, boolean checkVariablesOnly)
          Checking if a transformation can be performed with the attributes with respect to a given context: if checkVariablesOnly is TRUE then only checking variables, otherwise - variables and attribute conditions.
 void clearErrorMsg()
           
static AttrManager getDefaultManager()
          Returns the default instance of AttrManager.
 AttrViewSetting getDefaultMaskedView()
          Obtaining the masked view of the default view setting ('masked' meaning: it considers permutations as well as hiding of members;).
 AttrViewSetting getDefaultOpenView()
          Obtaining the open view of the default view setting ('open' meaning: it considers permutations, but not hiding of members;).
 java.lang.String getErrorMsg()
          Returns an error message if something gone wrong, otherwise - empty message.
 AttrViewSetting getFixedViewSetting()
           
 AttrHandler getHandler(java.lang.String name)
          Getting an attribute handler by name.
 AttrHandler[] getHandlers()
          Getting all attribute handlers that have been registered.
 java.lang.String isClassName(java.lang.String name)
          Returns a class name if the specified name is a class name, otherwise - null.
 boolean isCorrectInputEnforced()
           
 boolean isVariableContext()
           
 AttrContext newContext(int mapStyle)
          Creating a new attribute context which is the root of a context tree;
 AttrContext newContext(int mapStyle, AttrContext parent)
          Creating a new attribute context which extends an existing one.
 AttrInstance newInstance(AttrType type)
          Creating a new attribute instance of the required type, without a context.
 AttrInstance newInstance(AttrType type, AttrContext context)
          Creating a new attribute instance of the required type and in the given context or a context view.
 AttrContext newLeftContext(AttrContext context)
          Creating a full view on an existing attribute context; Through a "full view" on a context, variables can be declared and values can be assigned to them by the editor of attribute instances.
 AttrMapping newMapping(AttrContext mappingContext, AttrInstance source, AttrInstance target)
          Mapping between two attribute instances; The mapping is done according to the context mapping property (total/partial) and is integrated into the context;
 AttrMapping newMappingChild2Parent(AttrContext mappingContext, AttrInstance source, AttrInstance target)
           
 AttrContext newRightContext(AttrContext context)
          Creating a view on an existing attribute context, through which variables can not be declared; they only can be assigned values; In Graph Transformation, it is used for the right-hand-side of a rule.
 AttrType newType()
          Creating a new attribute type.
 AttrViewSetting newViewSetting()
          Creating a new mediator instance for loose coupling of attribute objects with their visual representation.
 void setCorrectInputEnforced(boolean b)
           
 void setDebug(boolean b)
           
 void setVariableContext(boolean b)
          A variable context mins that mainly variables will be used as values of the graph objects of a graph, so if a rule / match attribute context has an attribute condition, it cannot be evaluated and will get TRUE as result.
 
Methods inherited from class agg.attribute.impl.AttrObject
defaultToString, err, err, getInstRepr, log, log, log, logEnteredMethod, logPrintln, logPrintln, stdoutPrintOnEnter, stdoutPrintOnExit, toString, update, warn, warn, warn, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

handlers

protected AttrHandler[] handlers

defaultOpenView

protected AttrViewSetting defaultOpenView

defaultMaskedView

protected AttrViewSetting defaultMaskedView

fixedViewSetting

protected AttrViewSetting fixedViewSetting

defaultContext

protected ContextView defaultContext

isCorrectInputEnforced

protected boolean isCorrectInputEnforced

myDefaultInstance

protected static AttrTupleManager myDefaultInstance
Constructor Detail

AttrTupleManager

public AttrTupleManager()
Public constructor.

Method Detail

getDefaultManager

public static AttrManager getDefaultManager()
Returns the default instance of AttrManager. Called e.g. by facades.


newContext

public AttrContext newContext(int mapStyle)
Description copied from interface: AttrManager
Creating a new attribute context which is the root of a context tree;

Specified by:
newContext in interface AttrManager
Parameters:
mapStyle - The kind of mapping that is done within this context; it is one of:
-
'AttrMapping.PLAIN_MAP': In Graph Transform.: rule mapping
-
'AttrMapping.MATCH_MAP': In Graph Transformation: matching
Returns:
The new attribute root context
See Also:
AttrContext, AttrMapping

newContext

public AttrContext newContext(int mapStyle,
                              AttrContext parent)
Creating a new attribute context which extends an existing one. In Graph Transformation, the setting of variables by matching corresponding graphical objects requires such a construction. It allows for keeping more that one rule match at a given time;

Specified by:
newContext in interface AttrManager
Parameters:
mapStyle - The kind of mapping that is allowed within this context; it is one of: - AttrMapping.PLAIN_MAP: In Graph Transformation: rule mapping - AttrMapping.MATCH_MAP: In Graph Transformation: matching
parent - The context to extend
Returns:
The new attribute context child
See Also:
AttrContext, AttrMapping

newLeftContext

public AttrContext newLeftContext(AttrContext context)
Creating a full view on an existing attribute context; Through a "full view" on a context, variables can be declared and values can be assigned to them by the editor of attribute instances. In Graph Transformation, it is used for the left-hand-side of a rule.

Specified by:
newLeftContext in interface AttrManager
Parameters:
context - The context to generate the view on
Returns:
The new attribute context view
See Also:
AttrContext

newRightContext

public AttrContext newRightContext(AttrContext context)
Creating a view on an existing attribute context, through which variables can not be declared; they only can be assigned values; In Graph Transformation, it is used for the right-hand-side of a rule.

Specified by:
newRightContext in interface AttrManager
Parameters:
context - The context to generate the view on
Returns:
The new attribute context view
See Also:
AttrContext

setVariableContext

public void setVariableContext(boolean b)
A variable context mins that mainly variables will be used as values of the graph objects of a graph, so if a rule / match attribute context has an attribute condition, it cannot be evaluated and will get TRUE as result. This feature is mainly used for critical pair analysis, where the attribute conditions will be handled especially. Do not use this setting for common transformation.


isVariableContext

public boolean isVariableContext()
See Also:
agg.attribute.impl

getHandler

public AttrHandler getHandler(java.lang.String name)
Getting an attribute handler by name.

Specified by:
getHandler in interface AttrManager
Returns:
The attribute handler with the specified name or 'null'.

newType

public AttrType newType()
Creating a new attribute type.

Specified by:
newType in interface AttrManager
Returns:
The new attribute type

newInstance

public AttrInstance newInstance(AttrType type)
Creating a new attribute instance of the required type, without a context. Note that for such attributes, expressions cannot contain variables. In Graph Transformation, it is used for creating a new attribute in the host graph.

Specified by:
newInstance in interface AttrManager
Parameters:
type - The type to use
Returns:
The new attribute instance

newInstance

public AttrInstance newInstance(AttrType type,
                                AttrContext context)
Creating a new attribute instance of the required type and in the given context or a context view. In Graph Transformation, it is used for creating a new attribute in a rule.

Specified by:
newInstance in interface AttrManager
Parameters:
type - The type to use
context - The context to use
Returns:
The new attribute instance

getErrorMsg

public java.lang.String getErrorMsg()
Returns an error message if something gone wrong, otherwise - empty message.

Specified by:
getErrorMsg in interface AttrManager

clearErrorMsg

public void clearErrorMsg()

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 AttrManager
Throws:
AttrException

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 mapping property (total/partial) and is integrated into the context;

Specified by:
newMapping in interface AttrManager
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())
Throws:
AttrException
See Also:
AttrMapping.remove(), AttrMapping.next()

newMappingChild2Parent

public AttrMapping newMappingChild2Parent(AttrContext mappingContext,
                                          AttrInstance source,
                                          AttrInstance target)
                                   throws AttrException
Throws:
AttrException

checkIfReadyToTransform

public void checkIfReadyToTransform(AttrContext matchContext)
                             throws AttrException
Checking if a transformation can be performed with the attributes with respect to a given context: variables and attribute conditions. 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 AttrManager
Throws:
AttrException

checkIfReadyToTransform

public void checkIfReadyToTransform(AttrContext matchContext,
                                    boolean checkVariablesOnly)
                             throws AttrException
Checking if a transformation can be performed with the attributes with respect to a given context: if checkVariablesOnly is TRUE then only checking variables, otherwise - variables and attribute conditions. 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 AttrManager
Throws:
AttrException

newViewSetting

public AttrViewSetting newViewSetting()
Creating a new mediator instance for loose coupling of attribute objects with their visual representation.

Specified by:
newViewSetting in interface AttrManager

getDefaultOpenView

public AttrViewSetting getDefaultOpenView()
Description copied from interface: AttrManager
Obtaining the open view of the default view setting ('open' meaning: it considers permutations, but not hiding of members;).

Specified by:
getDefaultOpenView in interface AttrManager

getDefaultMaskedView

public AttrViewSetting getDefaultMaskedView()
Description copied from interface: AttrManager
Obtaining the masked view of the default view setting ('masked' meaning: it considers permutations as well as hiding of members;).

Specified by:
getDefaultMaskedView in interface AttrManager

getFixedViewSetting

public AttrViewSetting getFixedViewSetting()

setDebug

public void setDebug(boolean b)

getHandlers

public AttrHandler[] getHandlers()
Description copied from interface: AttrManager
Getting all attribute handlers that have been registered.

Specified by:
getHandlers in interface AttrManager

isCorrectInputEnforced

public boolean isCorrectInputEnforced()

setCorrectInputEnforced

public void setCorrectInputEnforced(boolean b)

isClassName

public java.lang.String isClassName(java.lang.String name)
Returns a class name if the specified name is a class name, otherwise - null.

Specified by:
isClassName in interface AttrManager