agg.attribute.impl
Class ValueTuple

java.lang.Object
  extended by agg.attribute.impl.AttrObject
      extended by agg.attribute.impl.ManagedObject
          extended by agg.attribute.impl.ChainedObserver
              extended by agg.attribute.impl.TupleObject
                  extended by agg.attribute.impl.ValueTuple
All Implemented Interfaces:
AttrInstance, AttrObserver, AttrTuple, AttrMsgCode, Disposable, XMLObject, java.io.Serializable, java.util.Observer
Direct Known Subclasses:
LoneTuple

public class ValueTuple
extends TupleObject
implements AttrInstance, AttrMsgCode

Implementation of the interface agg.attribute.AttrInstance; Encapsulates a tuple of attributes, so that a graphical object needs to talk to this one object only;

See Also:
Serialized Form

Field Summary
protected  java.lang.String errorMsg
          GUI editor for this instance.
protected  DeclTuple type
          Type reference.
 
Fields inherited from class agg.attribute.impl.TupleObject
members, parent
 
Fields inherited from class agg.attribute.impl.ChainedObserver
MAX_SIZE_OF_EVENT_STACK, sizeOfEventStack
 
Fields inherited from class agg.attribute.impl.ManagedObject
manager
 
Fields inherited from class agg.attribute.impl.AttrObject
classHandlerExpr, classObject, classString, initialized
 
Fields inherited from interface agg.attribute.impl.AttrMsgCode
ATTR_DONT_MATCH, BAD_EXPR_TYPE, EXPR_EVAL_ERR, EXPR_MUST_BE_CONST, EXPR_MUST_BE_CONST_OR_VAR, EXPR_PARSE_ERR, EXPR_REQUIRED, MATCH_TARGETS_DIFFER, NAME_DUPLICATION, NO_SUCH_NAME, NO_SUCH_TYPE, OK, RULE_SOURCES_DIFFER, VAR_NOT_DECLARED
 
Fields inherited from interface agg.attribute.AttrObserver
serialVersionUID
 
Constructor Summary
ValueTuple(AttrTupleManager manager, DeclTuple type)
           
ValueTuple(AttrTupleManager manager, DeclTuple type, ContextView context)
           
ValueTuple(AttrTupleManager manager, DeclTuple type, ContextView context, ValueTuple parent)
           
 
Method Summary
protected  void adaptToType()
          Causes the value container (Vector) size to match the type container size.
 void adoptEntriesWhereEmpty(AttrInstance source)
          Copying the contents of an attribute instance into another;
 void apply(AttrInstance rightSide, AttrContext attrcontext)
          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 apply(AttrInstance rightSide, AttrContext attrcontext, AttrInstance g)
          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 apply(AttrInstance rightSide, AttrContext attrcontext, AttrInstance g, boolean allowVariableWithoutValue)
          This method works like apply( AttrInstance, AttrContext, AttrInstance) additionally, allows using variables without value in value of attribute member.
 void apply(AttrInstance rightSide, AttrContext attrcontext, AttrInstance g, boolean allowVariableWithoutValue, boolean similarVariableName)
          This method works like apply( AttrInstance, AttrContext, AttrInstance) additionally, allows using variables without value in value of attribute member.
 void apply(AttrInstance rightSide, AttrContext attrcontext, boolean allowVariableWithoutValue)
          This method works like apply( AttrInstance,context ) additionally, allow using variables without value in the value of attribute members
 void apply(AttrInstance rightSide, AttrContext attrcontext, boolean allowVariableWithoutValue, boolean equalVariableName)
          This method works like apply( AttrInstance,context ) additionally, allow using variables without value in the value of attribute members.
protected  void assignParent(TupleObject newParent)
           
 boolean canMatchChild2Parent(ValueTuple target, ContextView attrcontext)
           
 boolean canMatchTo(ValueTuple target, ContextView attrcontext)
           
 boolean compareTo(AttrInstance another)
           
 void copy(AttrInstance source)
          Copying the contents of an attribute instance into another; The reference to the attribute type is shared.
 void copyEntries(AttrInstance source)
          Copying the contents of an attribute instance into another;
 void copyEntriesToSimilarMembers(AttrInstance source)
           
 java.util.Vector<java.lang.String> getAllVariableNames()
           
 java.util.Vector<java.lang.String> getAllVariableNamesOfExpressions()
           
 AttrContext getContext()
          Retrieving the context of an instance.
protected  ContextView getContextView()
           
 ValueMember getEntryAt(int index)
          Getting a single value, referenced by 'index'.
 ValueMember getEntryAt(java.lang.String name)
          Getting a single value, referenced by 'name'.
 ValueMember getEntryWithValueAsText(java.lang.String valueText)
           
 java.lang.String getErrorMsg()
           
protected  java.lang.String getLogEntry(int index)
          Subprocedure for 'log()', creates a text showing the entry at 'index'
 int getNumberOfFreeVariables(AttrContext ctx)
          Getting the number of variables declared by this instance which have no value assigned to them yet.
 DeclTuple getTupleType()
          Retrieving the type of this tuple instance
 java.lang.String getValueAsString(int entryIndex)
          Getting a simple representation of a value as String.
 java.lang.Object getValueAt(java.lang.String name)
          Retrieving the value of an entry.
 ValueMember getValueMemberAt(int index)
          Convenience method for internal operations; works much like the generic getMemberAt( int index ), but returns the appropriate member type.
 ValueMember getValueMemberAt(java.lang.String name)
          Convenience method for internal operations; works much like the generic getMemberAt( String name ), but returns the appropriate member type.
 boolean isEmpty()
           
 boolean isValueSetAt(int index)
          Test, if a value is set or not.
 boolean isValueSetAt(java.lang.String name)
          Test, if a value is set or not.
 void log()
          For debugging: displaying itself in the logging window.
 void logPrintln(boolean logTopic, java.lang.String msg)
          Print itself and a message if 'logTopic' == 'true'.
 java.lang.String[] matchChild2Parent(ValueTuple target, ContextView attrcontext)
           
 java.lang.String[] matchTo(ValueTuple target, ContextView attrcontext)
          Performs a match in a per-element-style.
protected  ValueMember newMember(DeclMember decl)
           
protected  void propagateEvent(TupleEvent e)
          Propagates the event to the observers, pretending to be the source.
 void refreshParents()
           
protected  void setContextView(ContextView view)
           
 void setExprAt(java.lang.String expr, java.lang.String name)
          Setting an expression as an entry without immediate evaluation.
 void setExprValueAt(java.lang.String expr, java.lang.String name)
          Evaluating an expression and setting its value as an entry.
protected  void setType(DeclTuple type)
           
 void setValueAt(java.lang.Object value, java.lang.String name)
          Setting the value of an entry directly.
 void setValueAt(java.lang.String valueText, int index)
          Setting the value of the specified entry;
 void setValueAt(ValueMember value, int index)
          Setting the value of the specified entry;
 void showValue()
           
 java.lang.String toString()
           
 void unsetValue()
          Unset the value of the own attribute members (not of attribute members of its parents).
 void updateMemberAdded(TupleEvent e)
          Fires the same event.
 void updateMemberDeleted(TupleEvent e)
          Fires the same event.
 void updateMemberRetyped(TupleEvent e)
          Fires the same event.
 void updateMemberValueChanged(TupleEvent e)
          Interface synchronization.
 void XreadObject(XMLHelper h)
           
 void XwriteObject(XMLHelper h)
           
 
Methods inherited from class agg.attribute.impl.TupleObject
addMember, addMember, deleteMemberAt, dispose, ensureNonNull, finalize, getForm, getIndexForMember, getIndexForName, getIndexInView, getMemberAt, getMemberAt, getMemberAt, getNameAsString, getNameAsString, getNumberOfEntries, getNumberOfEntries, getParent, getParentInCharge, getParentSize, getSize, getType, getTypeAsString, getTypeAsString, getValueAsString, isSubclassOf, isValid, memberChanged, rawAddMember, rawAddMember, rawDeleteMemberAt, rawGetMemberAt, rawGetSize, setForm
 
Methods inherited from class agg.attribute.impl.ChainedObserver
addObserver, addObserverAtPos, attributeChanged, contains, filterEvent, findObserver, fireAttrChanged, fireAttrChanged, fireAttrChanged, getObservers, isPersistentFor, removeObserver, updateGeneralChange, updateMemberModified, updateMemberRenamed, updateUnknownChange, updateValueCorrectness, updateValueModified
 
Methods inherited from class agg.attribute.impl.ManagedObject
getAttrManager, getManager
 
Methods inherited from class agg.attribute.impl.AttrObject
defaultToString, err, err, getInstRepr, log, log, logEnteredMethod, logPrintln, stdoutPrintOnEnter, stdoutPrintOnExit, update, warn, warn, warn, warn
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface agg.attribute.AttrInstance
getType
 
Methods inherited from interface agg.attribute.AttrTuple
addObserver, getAttrManager, getIndexForMember, getMemberAt, getMemberAt, getMemberAt, getNameAsString, getNameAsString, getNumberOfEntries, getNumberOfEntries, getTypeAsString, getTypeAsString, getValueAsString, isValid, removeObserver
 

Field Detail

type

protected DeclTuple type
Type reference.


errorMsg

protected transient java.lang.String errorMsg
GUI editor for this instance.

Constructor Detail

ValueTuple

public ValueTuple(AttrTupleManager manager,
                  DeclTuple type)
Parameters:
manager - AttrTupleManager managing this tuple;
type - Type, of which this tuple shall be an instance.

ValueTuple

public ValueTuple(AttrTupleManager manager,
                  DeclTuple type,
                  ContextView context)
Parameters:
manager - AttrTupleManager managing this tuple
type - Type, of which this tuple shall be an instance
context - The context in which this instance is placed

ValueTuple

public ValueTuple(AttrTupleManager manager,
                  DeclTuple type,
                  ContextView context,
                  ValueTuple parent)
Parameters:
manager - AttrTupleManager managing this tuple
type - Type, of which this tuple shall be an instance
context - The context in which this instance is placed
Method Detail

propagateEvent

protected void propagateEvent(TupleEvent e)
Propagates the event to the observers, pretending to be the source.

Overrides:
propagateEvent in class TupleObject

refreshParents

public void refreshParents()

setContextView

protected void setContextView(ContextView view)

getContextView

protected ContextView getContextView()

assignParent

protected void assignParent(TupleObject newParent)
Overrides:
assignParent in class TupleObject

setType

protected void setType(DeclTuple type)

adaptToType

protected void adaptToType()
Causes the value container (Vector) size to match the type container size.


newMember

protected ValueMember newMember(DeclMember decl)

getErrorMsg

public java.lang.String getErrorMsg()

getContext

public AttrContext getContext()
Description copied from interface: AttrInstance
Retrieving the context of an instance.

Specified by:
getContext in interface AttrInstance

log

public void log()
For debugging: displaying itself in the logging window.

Overrides:
log in class AttrObject

getLogEntry

protected java.lang.String getLogEntry(int index)
Subprocedure for 'log()', creates a text showing the entry at 'index'


getTupleType

public DeclTuple getTupleType()
Retrieving the type of this tuple instance

Specified by:
getTupleType in interface AttrTuple
Specified by:
getTupleType in class TupleObject

updateMemberAdded

public void updateMemberAdded(TupleEvent e)
Description copied from class: ChainedObserver
Fires the same event. Subclasses should override this method for customized behaviour.

Overrides:
updateMemberAdded in class ChainedObserver

updateMemberDeleted

public void updateMemberDeleted(TupleEvent e)
Description copied from class: ChainedObserver
Fires the same event. Subclasses should override this method for customized behaviour.

Overrides:
updateMemberDeleted in class ChainedObserver

updateMemberRetyped

public void updateMemberRetyped(TupleEvent e)
Description copied from class: ChainedObserver
Fires the same event. Subclasses should override this method for customized behaviour.

Overrides:
updateMemberRetyped in class ChainedObserver

updateMemberValueChanged

public void updateMemberValueChanged(TupleEvent e)
Interface synchronization.


getValueMemberAt

public ValueMember getValueMemberAt(int index)
Convenience method for internal operations; works much like the generic getMemberAt( int index ), but returns the appropriate member type.

See Also:
TupleObject.getMemberAt( int )

getValueMemberAt

public ValueMember getValueMemberAt(java.lang.String name)
Convenience method for internal operations; works much like the generic getMemberAt( String name ), but returns the appropriate member type.

See Also:
TupleObject.getMemberAt( String )

getValueAsString

public java.lang.String getValueAsString(int entryIndex)
Getting a simple representation of a value as String.

Specified by:
getValueAsString in interface AttrTuple
Overrides:
getValueAsString in class TupleObject
Parameters:
entryIndex - Index of entry.

copy

public void copy(AttrInstance source)
Copying the contents of an attribute instance into another; The reference to the attribute type is shared.

Specified by:
copy in interface AttrInstance

copyEntries

public void copyEntries(AttrInstance source)
Copying the contents of an attribute instance into another;

Specified by:
copyEntries in interface AttrInstance

copyEntriesToSimilarMembers

public void copyEntriesToSimilarMembers(AttrInstance source)

adoptEntriesWhereEmpty

public void adoptEntriesWhereEmpty(AttrInstance source)
Copying the contents of an attribute instance into another;


unsetValue

public void unsetValue()
Unset the value of the own attribute members (not of attribute members of its parents). The value of its attribute member is null after this.

Specified by:
unsetValue in interface AttrInstance

apply

public void apply(AttrInstance rightSide,
                  AttrContext attrcontext,
                  AttrInstance g)
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. Needs the graphobject from the graph G.

Specified by:
apply in interface AttrInstance

apply

public void apply(AttrInstance rightSide,
                  AttrContext attrcontext,
                  AttrInstance g,
                  boolean allowVariableWithoutValue)
This method works like apply( AttrInstance, AttrContext, AttrInstance) additionally, allows using variables without value in value of attribute member.

Specified by:
apply in interface AttrInstance

apply

public void apply(AttrInstance rightSide,
                  AttrContext attrcontext,
                  AttrInstance g,
                  boolean allowVariableWithoutValue,
                  boolean similarVariableName)
This method works like apply( AttrInstance, AttrContext, AttrInstance) additionally, allows using variables without value in value of attribute member. If similarVariableName is TRUE, then the name of the variable from rightSide must be equal to the name of the current variable. The similarVariableName option is only used when allowVariableWithoutValue is TRUE.


apply

public void apply(AttrInstance rightSide,
                  AttrContext attrcontext)
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 AttrInstance

apply

public void apply(AttrInstance rightSide,
                  AttrContext attrcontext,
                  boolean allowVariableWithoutValue)
This method works like apply( AttrInstance,context ) additionally, allow using variables without value in the value of attribute members

Specified by:
apply in interface AttrInstance

apply

public void apply(AttrInstance rightSide,
                  AttrContext attrcontext,
                  boolean allowVariableWithoutValue,
                  boolean equalVariableName)
This method works like apply( AttrInstance,context ) additionally, allow using variables without value in the value of attribute members. If equalVariableName is TRUE, then the name of the variable from rightSide must be equal to the name of the current variable. The equalVariableName option is only used when allowVariableWithoutValue is TRUE.


getNumberOfFreeVariables

public int getNumberOfFreeVariables(AttrContext ctx)
Description copied from interface: AttrInstance
Getting the number of variables declared by this 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 AttrInstance
Returns:
The number of free variables.

XwriteObject

public void XwriteObject(XMLHelper h)
Specified by:
XwriteObject in interface XMLObject

XreadObject

public void XreadObject(XMLHelper h)
Specified by:
XreadObject in interface XMLObject

canMatchTo

public boolean canMatchTo(ValueTuple target,
                          ContextView attrcontext)

canMatchChild2Parent

public boolean canMatchChild2Parent(ValueTuple target,
                                    ContextView attrcontext)

matchTo

public java.lang.String[] matchTo(ValueTuple target,
                                  ContextView attrcontext)
Performs a match in a per-element-style.


matchChild2Parent

public java.lang.String[] matchChild2Parent(ValueTuple target,
                                            ContextView attrcontext)

logPrintln

public void logPrintln(boolean logTopic,
                       java.lang.String msg)
Description copied from class: AttrObject
Print itself and a message if 'logTopic' == 'true'.

Overrides:
logPrintln in class AttrObject

toString

public java.lang.String toString()
Overrides:
toString in class AttrObject

setValueAt

public void setValueAt(java.lang.String valueText,
                       int index)
Setting the value of the specified entry;

Parameters:
valueText - String representation of the new value;
index - specifies the entry to change; Used by AttrEditor instances.

setValueAt

public void setValueAt(ValueMember value,
                       int index)
Setting the value of the specified entry;

Parameters:
value - the new value;
index - specifies the entry to change; Used by AttrEditor instances.

isValueSetAt

public boolean isValueSetAt(java.lang.String name)
Test, if a value is set or not.

Specified by:
isValueSetAt in interface AttrInstance

isValueSetAt

public boolean isValueSetAt(int index)
Test, if a value is set or not.


getValueAt

public java.lang.Object getValueAt(java.lang.String name)
Retrieving the value of an entry.

Specified by:
getValueAt in interface AttrInstance

setValueAt

public void setValueAt(java.lang.Object value,
                       java.lang.String name)
Setting the value of an entry directly.

Specified by:
setValueAt in interface AttrInstance
Parameters:
value - Any object instance.
name - specifies the entry to change.

isEmpty

public boolean isEmpty()

setExprValueAt

public void setExprValueAt(java.lang.String expr,
                           java.lang.String name)
Evaluating an expression and setting its value as an entry.

Specified by:
setExprValueAt in interface AttrInstance
Parameters:
expr - textual expression representation;
name - specifies the entry to change.

setExprAt

public void setExprAt(java.lang.String expr,
                      java.lang.String name)
Setting an expression as an entry without immediate evaluation. Syntax and type checking are performed.

Specified by:
setExprAt in interface AttrInstance
Parameters:
expr - textual expression representation;
name - specifies the entry to change;

getEntryAt

public ValueMember getEntryAt(int index)
Getting a single value, referenced by 'index'.


getEntryAt

public ValueMember getEntryAt(java.lang.String name)
Getting a single value, referenced by 'name'.


getEntryWithValueAsText

public ValueMember getEntryWithValueAsText(java.lang.String valueText)

getAllVariableNamesOfExpressions

public java.util.Vector<java.lang.String> getAllVariableNamesOfExpressions()

getAllVariableNames

public java.util.Vector<java.lang.String> getAllVariableNames()

compareTo

public boolean compareTo(AttrInstance another)
Specified by:
compareTo in interface AttrInstance

showValue

public void showValue()