de.interactive_instruments.ShapeChange.TargetHelper
Class XpathConstraintNode

java.lang.Object
  extended by de.interactive_instruments.ShapeChange.TargetHelper.XpathConstraintNode
Direct Known Subclasses:
XpathConstraintNode.AllInstances, XpathConstraintNode.Arithmetic, XpathConstraintNode.Attribute, XpathConstraintNode.Cast, XpathConstraintNode.ChangeCase, XpathConstraintNode.Comparison, XpathConstraintNode.Concatenate, XpathConstraintNode.Empty, XpathConstraintNode.Error, XpathConstraintNode.Exists, XpathConstraintNode.IfThenElse, XpathConstraintNode.KindOf, XpathConstraintNode.Literal, XpathConstraintNode.Logic, XpathConstraintNode.Matches, XpathConstraintNode.MessageComment, XpathConstraintNode.Select, XpathConstraintNode.Size, XpathConstraintNode.Substring, XpathConstraintNode.Unique, XpathConstraintNode.Variable

public abstract class XpathConstraintNode
extends Object

XpathConstraintNode and its concrete derivations stand for a representation of OCL contents, which are close to the capabilities of Xpath/Schematron and the logic, which can be realized within Schematron Rules.

There are two basic patterns of use of these classes:


Nested Class Summary
static class XpathConstraintNode.AllInstances
          This class represents the OCL operation allInstances().
static class XpathConstraintNode.Arithmetic
          This class stands for OCL arithmetic.
static class XpathConstraintNode.Attribute
          This class represents a chain of attribute selectors based on some value source such as a variable, a select() or allInstances.
static class XpathConstraintNode.BindingContext
          The primary information stored in this class is whether there is currently a nodeset context at all - NONE if the expression is not a nodeset - and if the context is currently identical to current() - ATCURRENT.
static class XpathConstraintNode.Cast
          This class represents oclAsType(), which is for casting a type to one of its subtypes.
static class XpathConstraintNode.ChangeCase
          This class stands for an the changeCase operations on the CharacterString object.
static class XpathConstraintNode.Comparison
          This class stands for comparisons.
static class XpathConstraintNode.Concatenate
          This class stands for an OCL concat operation.
static class XpathConstraintNode.Empty
          This one stands for the OCL isEmpty() and notEmpty() predicate operations.
static class XpathConstraintNode.Error
          This is generated for unimplemented material.
static class XpathConstraintNode.Exists
          This class represents the Exists iterator predicate.
static class XpathConstraintNode.IfThenElse
          This class represents an if ... then ... else ... endif construct.
static class XpathConstraintNode.KindOf
          This class represents oclIsKindOf and oclIsTypeOf nodes.
static class XpathConstraintNode.Literal
          This wraps any form of Literal value from the OclNode.
static class XpathConstraintNode.Logic
          This class stands for logical operations AND, OR, XOR and EQV.
static class XpathConstraintNode.Matches
          This class stands for matches operation, which this implemention added to OCL's core functions.
static class XpathConstraintNode.MessageComment
          This represents an error message comment.
static class XpathConstraintNode.Select
          This class represents the Select iterator filter.
static class XpathConstraintNode.Size
          This class represents an OCL invocation of the size operation.
static class XpathConstraintNode.Substring
          This class stands for an OCL substring operation.
static class XpathConstraintNode.Unique
          This class represents the isUnique iterator predicate.
static class XpathConstraintNode.Variable
          This class represents an OCL variable.
static class XpathConstraintNode.XpathFragment
          This auxiliary class encapsulates an Xpath expression, which can be formulated using variables defined using <let> expressions of a Schematron <rule>.
protected static class XpathConstraintNode.XpathType
          Types of XPath
 
Field Summary
protected  ArrayList<XpathConstraintNode> children
          The children of the XpathConstraintNode
protected  boolean negated
          General negation flag for all nodes
protected  XpathConstraintNode parent
          The parent reference
protected  XpathHelper xpathHelper
          Link back to XpathHelper object
 
Constructor Summary
XpathConstraintNode()
           
 
Method Summary
 void addChild(XpathConstraintNode child)
          Method to add children to a node and at the same time establish the node as parent of the child to be added.
 boolean bindsVariable(OclNode.Declaration vardecl)
          This method determines whether the node binds the given variable declaration.
 boolean containsError()
          Find out whether this construct contains a node of type XpathConstraintNode.Error.
 XpathConstraintNode.Attribute generatingAttribute()
          By means of this function you can inquire which Attribute node is generating the objects represented by this node.
 boolean hasIdentity()
          This predicate finds out whether the given node is realized by means of a class, which conceptually has identity.
 boolean hasSimpleType()
          This predicate finds out whether the given node is realized by means of a simple XML schema type.
 boolean isAndOrLogic(boolean isAnd)
          Method to inquire whether the the node inquired is a Logic node AND this logic node has the same isAnd polarity as specified in the parameter.
 boolean isDependentOn(OclNode.Declaration vardecl)
          This method determines whether the given expression depends on the Variable passed as argument.
 boolean isMultiple()
          This predicate finds out whether the given node may produce a set.
 boolean isVarOrAttribBased(OclNode.Declaration vardecl)
          This method determines whether the given expression is a Variable or an Attribute based on a Variable, which is identical to the one passed as argument.
abstract  XpathConstraintNode.XpathFragment translate(XpathConstraintNode.BindingContext ctx)
          This abstract method compiles a node to an XPath expression fragment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

children

protected ArrayList<XpathConstraintNode> children
The children of the XpathConstraintNode


negated

protected boolean negated
General negation flag for all nodes


parent

protected XpathConstraintNode parent
The parent reference


xpathHelper

protected XpathHelper xpathHelper
Link back to XpathHelper object

Constructor Detail

XpathConstraintNode

public XpathConstraintNode()
Method Detail

addChild

public void addChild(XpathConstraintNode child)
Method to add children to a node and at the same time establish the node as parent of the child to be added.

Parameters:
child - The Child node to be added

isAndOrLogic

public boolean isAndOrLogic(boolean isAnd)

Method to inquire whether the the node inquired is a Logic node AND this logic node has the same isAnd polarity as specified in the parameter.

This implementation installs the default for all derivations except Logic.

Parameters:
isAnd - Flag: Are we an AND? (not an OR)?
Returns:
True if this is Logic with the same polarity

isDependentOn

public boolean isDependentOn(OclNode.Declaration vardecl)

This method determines whether the given expression depends on the Variable passed as argument.

This implementation defines the default behavior: Descend down and try to find the variable somewhere.

Parameters:
vardecl - The Declaration of the variable
Returns:
Flag indicating the inquired dependency

bindsVariable

public boolean bindsVariable(OclNode.Declaration vardecl)
This method determines whether the node binds the given variable declaration. This can only happen for iterators.

Parameters:
vardecl - The variable Declaration object
Returns:
Flag indicating the requested property

isVarOrAttribBased

public boolean isVarOrAttribBased(OclNode.Declaration vardecl)

This method determines whether the given expression is a Variable or an Attribute based on a Variable, which is identical to the one passed as argument.

This implementation defines the default behavior.

Parameters:
vardecl - The Declaration of the variable
Returns:
Flag indicating the inquired property

generatingAttribute

public XpathConstraintNode.Attribute generatingAttribute()

By means of this function you can inquire which Attribute node is generating the objects represented by this node. Note that invocation is only sensible for iterators and attributes.

Returns:
The retrieved Attribute node if there is such a thing

isMultiple

public boolean isMultiple()

This predicate finds out whether the given node may produce a set.

This is the default implementation providing the value false.

Returns:
Flag indicating whether the node can return multiple values

hasSimpleType

public boolean hasSimpleType()

This predicate finds out whether the given node is realized by means of a simple XML schema type.

Returns:
Flag indicating whether the node has a simple type

hasIdentity

public boolean hasIdentity()

This predicate finds out whether the given node is realized by means of a class, which conceptually has identity.

Returns:
Flag indicating whether the node is an identity carrying type

containsError

public boolean containsError()

Find out whether this construct contains a node of type XpathConstraintNode.Error. In this case the whole tree is in error.

Returns:
Error flag

translate

public abstract XpathConstraintNode.XpathFragment translate(XpathConstraintNode.BindingContext ctx)

This abstract method compiles a node to an XPath expression fragment.

Parameters:
ctx - BindingContext this node shall be compiled in
Returns:
Object containing the Xpath fragment


Copyright © 2015. All rights reserved.