agg.attribute.impl
Class ValueMember

java.lang.Object
  extended by agg.attribute.impl.AttrObject
      extended by agg.attribute.impl.Member
          extended by agg.attribute.impl.ValueMember
All Implemented Interfaces:
AttrInstanceMember, AttrMember, AttrMsgCode, XMLObject, java.io.Serializable, java.util.Observer
Direct Known Subclasses:
CondMember, VarMember

public class ValueMember
extends Member
implements AttrInstanceMember, AttrMsgCode

Holds an attribute handler expression, its type and the functionality for matching and transforming thereof.

See Also:
Serialized Form

Field Summary
protected  java.lang.Exception currentException
           
protected  DeclMember decl
          Declaration
static java.lang.String EMPTY_VALUE_SYMBOL
          This string is shown for an empty value.
protected  java.lang.String errorMsg
           
protected  HandlerExpr expression
          Attribute handler expression.
protected  java.lang.Object expressionObject
           
protected  java.lang.String expressionText
           
protected  boolean isTransient
           
protected  ValueTuple tuple
          Instance tuple that this value is a member of.
 
Fields inherited from class agg.attribute.impl.AttrObject
classHandlerExpr, classObject, classString, initialized
 
Fields inherited from interface agg.attribute.AttrInstanceMember
serialVersionUID
 
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
 
Constructor Summary
ValueMember(ValueTuple tuple, DeclMember decl)
          Creating a new instance with the specified type.
 
Method Summary
protected  void apply(HandlerExpr expr)
          This method is used inside of the method rawSetExprAsText(String text) to initialize the attribute members of Java class type.
 void apply(ValueMember rightSide, AttrContext context)
          Transformation application
 void apply(ValueMember rightSide, AttrContext context, boolean allowVariableWithoutValue)
          Transform application like apply( ValueMember, AttrContext), additionally do allow using variables without value as value of attribute member.
 void apply(ValueMember rightSide, AttrContext context, boolean allowVariableWithoutValue, boolean equalVariableName)
          Transform application like apply( ValueMember, AttrContext), additionally do allow using variables without value as value of attribute member.
 boolean canMatchTo(ValueMember target, ContextView context)
          Check if matching is possible into 'target' within the match context 'context'.
protected  void checkInContext(HandlerExpr hExpr, AttrContext ctx)
          Checking the validity of the expression 'hExpr' relative to the context 'ctx'.
 void checkValidity()
          Checking the current expression validity relative to my tuple's context.
 void checkValidity(HandlerExpr hExpr)
           
 boolean compareTo(ValueMember member)
           
 void copy(ValueMember fromInstance)
          Copying the contents of a single entry instance into another.
 boolean equals(ValueMember testObject)
          Tests if the handler expressions are equal.
 java.util.Vector<java.lang.String> getAllVariableNamesOfExpression()
           
 java.lang.String getAttrHandlerExceptionMsg()
           
 java.util.Vector<Node> getChildrenOfExpression()
           
protected  ContextView getContext()
          Getting the context of this value.
protected  DeclMember getDecl()
          Getting the declaration for this value
 AttrTypeMember getDeclaration()
          Retrieving the type.
 java.lang.String getErrorMsg()
           
 HandlerExpr getExpr()
          Retrieving the expression (value) contained in this member.
 java.lang.Object getExprAsObject()
          Retrieving the value of an entry.
 java.lang.String getExprAsText()
          Returns the textual representation of the expression.
 AttrHandler getHandler()
          Getting the handler of this value.
 AttrTuple getHoldingTuple()
          Returns the tuple that contains this member.
 java.lang.String getName()
          Getting the name of this value member.
protected  ValueTuple getTuple()
          Getting the instance tuple that contains this value as a member.
protected  HandlerType getType()
          Getting the type of this value.
 java.lang.String getValidityReport()
          Returns a text describing the errors in this member, or null if the member is correct.
 boolean isEmpty()
          Check if no expression yet.
 boolean isSet()
          Check if set.
 boolean isTransient()
           
 boolean isValid()
          Testing if the member is consistent and complete.
 java.lang.String matchTo(ValueMember target, ContextView context)
          Perform matching with 'target' in the match context 'context'.
protected  HandlerExpr rawGetExpr()
           
protected  void rawSetExpr(HandlerExpr expr)
           
protected  void rawSetExprAsObject(java.lang.Object obj)
           
protected  void rawSetExprAsText(java.lang.String exprText)
          Setting the value.
protected  void setCheckedExpr(HandlerExpr expr)
          Setting the value and checking validity.
 void setExpr(HandlerExpr expr)
          Setting the value and fire event.
 void setExprAsEvaluatedText(java.lang.String exprText)
          Setting the value.
 void setExprAsObject(java.lang.Object obj)
          Setting the value.
 void setExprAsText(java.lang.String exprText)
          Setting the value.
 void setTransient(boolean trans)
           
 java.lang.String toString()
           
 void typeChanged()
           
 void XreadObject(XMLHelper h)
           
 void XwriteObject(XMLHelper h)
           
 
Methods inherited from class agg.attribute.impl.Member
fireChanged, getIndexInTuple
 
Methods inherited from class agg.attribute.impl.AttrObject
defaultToString, err, err, getInstRepr, log, log, log, logEnteredMethod, logPrintln, logPrintln, stdoutPrintOnEnter, stdoutPrintOnExit, update, warn, warn, warn, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface agg.attribute.AttrMember
getIndexInTuple
 

Field Detail

EMPTY_VALUE_SYMBOL

public static final java.lang.String EMPTY_VALUE_SYMBOL
This string is shown for an empty value.

See Also:
Constant Field Values

decl

protected DeclMember decl
Declaration


tuple

protected ValueTuple tuple
Instance tuple that this value is a member of.


expression

protected HandlerExpr expression
Attribute handler expression.


expressionText

protected java.lang.String expressionText

expressionObject

protected java.lang.Object expressionObject

currentException

protected transient java.lang.Exception currentException

errorMsg

protected transient java.lang.String errorMsg

isTransient

protected boolean isTransient
Constructor Detail

ValueMember

public ValueMember(ValueTuple tuple,
                   DeclMember decl)
Creating a new instance with the specified type.

Parameters:
tuple - Instance tuple that this value is a member of.
decl - Declaration for this member.
Method Detail

getErrorMsg

public java.lang.String getErrorMsg()

isValid

public boolean isValid()
Description copied from interface: AttrMember
Testing if the member is consistent and complete.

Specified by:
isValid in interface AttrMember

getValidityReport

public java.lang.String getValidityReport()
Description copied from interface: AttrMember
Returns a text describing the errors in this member, or null if the member is correct.

Specified by:
getValidityReport in interface AttrMember

getDeclaration

public AttrTypeMember getDeclaration()
Description copied from interface: AttrInstanceMember
Retrieving the type.

Specified by:
getDeclaration in interface AttrInstanceMember

getExprAsObject

public java.lang.Object getExprAsObject()
Description copied from interface: AttrInstanceMember
Retrieving the value of an entry. If the result is 'null', the reason can be: 1. The value is set as 'null'; 2. The value is not set at all. For testing if the value was set as 'null' or not set at all, use 'isSet()' of this interface.

Specified by:
getExprAsObject in interface AttrInstanceMember

getExpr

public HandlerExpr getExpr()
Description copied from interface: AttrInstanceMember
Retrieving the expression (value) contained in this member. The result can be queried and set according to the agg.attribute.handler.HandlerExpr interface.

Specified by:
getExpr in interface AttrInstanceMember

getExprAsText

public java.lang.String getExprAsText()
Description copied from interface: AttrInstanceMember
Returns the textual representation of the expression.

Specified by:
getExprAsText in interface AttrInstanceMember

setExpr

public void setExpr(HandlerExpr expr)
Setting the value and fire event.

Specified by:
setExpr in interface AttrInstanceMember

setExprAsObject

public void setExprAsObject(java.lang.Object obj)
Setting the value.

Specified by:
setExprAsObject in interface AttrInstanceMember
Parameters:
obj - Any object instance.

rawSetExprAsObject

protected void rawSetExprAsObject(java.lang.Object obj)

setExprAsText

public void setExprAsText(java.lang.String exprText)
Setting the value.

Specified by:
setExprAsText in interface AttrInstanceMember
Parameters:
exprText - textual expression representation;

rawSetExprAsText

protected void rawSetExprAsText(java.lang.String exprText)
Setting the value.


setExprAsEvaluatedText

public void setExprAsEvaluatedText(java.lang.String exprText)
Setting the value.

Specified by:
setExprAsEvaluatedText in interface AttrInstanceMember
Parameters:
exprText - textual expression representation;

typeChanged

public void typeChanged()

isEmpty

public boolean isEmpty()
Check if no expression yet.


isSet

public boolean isSet()
Check if set.

Specified by:
isSet in interface AttrInstanceMember

apply

protected void apply(HandlerExpr expr)
This method is used inside of the method rawSetExprAsText(String text) to initialize the attribute members of Java class type. For example, expr.toString() can be like "new Integer(7)" to initialize attribute member of Integer type or "new Vector()" to initialize attribute member of Vector type.

Parameters:
expr -

apply

public void apply(ValueMember rightSide,
                  AttrContext context)
Transformation application

Parameters:
rightSide - The expression from the right rule side
context - The match context.

apply

public void apply(ValueMember rightSide,
                  AttrContext context,
                  boolean allowVariableWithoutValue)
Transform application like apply( ValueMember, AttrContext), additionally do allow using variables without value as value of attribute member.


apply

public void apply(ValueMember rightSide,
                  AttrContext context,
                  boolean allowVariableWithoutValue,
                  boolean equalVariableName)
Transform application like apply( ValueMember, AttrContext), additionally do allow using variables without value as value of attribute member. 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.


canMatchTo

public boolean canMatchTo(ValueMember target,
                          ContextView context)
Check if matching is possible into 'target' within the match context 'context'.

Returns:
'true' if possible, 'false' otherwise.

matchTo

public java.lang.String matchTo(ValueMember target,
                                ContextView context)
Perform matching with 'target' in the match context 'context'.

Returns:
The name of the variable that this match has affected, i.e. assigned value to. If no variable is concerned, returns null.

copy

public void copy(ValueMember fromInstance)
Copying the contents of a single entry instance into another.


equals

public boolean equals(ValueMember testObject)
Tests if the handler expressions are equal.


compareTo

public boolean compareTo(ValueMember member)

toString

public java.lang.String toString()
Overrides:
toString in class AttrObject
Returns:
The textual representation of the expression or 'EMPTY_VALUE_SYMBOL' if that is null.

getHoldingTuple

public AttrTuple getHoldingTuple()
Description copied from interface: AttrMember
Returns the tuple that contains this member.

Specified by:
getHoldingTuple in interface AttrMember
Specified by:
getHoldingTuple in class Member

getTuple

protected ValueTuple getTuple()
Getting the instance tuple that contains this value as a member.


getContext

protected ContextView getContext()
Getting the context of this value.


getDecl

protected DeclMember getDecl()
Getting the declaration for this value


getHandler

public AttrHandler getHandler()
Getting the handler of this value.


getType

protected HandlerType getType()
Getting the type of this value.


getName

public java.lang.String getName()
Getting the name of this value member.

Specified by:
getName in interface AttrMember

getAllVariableNamesOfExpression

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

getChildrenOfExpression

public java.util.Vector<Node> getChildrenOfExpression()

rawGetExpr

protected HandlerExpr rawGetExpr()

rawSetExpr

protected void rawSetExpr(HandlerExpr expr)

setCheckedExpr

protected void setCheckedExpr(HandlerExpr expr)
Setting the value and checking validity.


checkValidity

public void checkValidity()
Checking the current expression validity relative to my tuple's context.


checkValidity

public void checkValidity(HandlerExpr hExpr)

checkInContext

protected void checkInContext(HandlerExpr hExpr,
                              AttrContext ctx)
Checking the validity of the expression 'hExpr' relative to the context 'ctx'.


getAttrHandlerExceptionMsg

public java.lang.String getAttrHandlerExceptionMsg()

setTransient

public void setTransient(boolean trans)

isTransient

public boolean isTransient()

XwriteObject

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

XreadObject

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