|
Dresden OCL Toolkit | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecttudresden.ocl.OclTree
| Field Summary | |
protected Start |
ast
|
protected HashSet |
invariants
|
protected String |
name
the name of the constraint, i.e. |
protected static String |
NAME_SEPARATOR
|
protected NameBoundQueryable |
nameBoundQueryable
|
protected NameCreator |
nameCreator
|
protected QueryableFactory |
qFactory
|
protected TypeFactory |
tFactory
|
protected TypeQueryable |
typeQueryable
|
| Constructor Summary | |
protected |
OclTree()
|
|
OclTree(Start ast)
|
| Method Summary | |
void |
apply(Switch s)
apply a tree traversal to the abstract syntax tree; see the SableCC documentation for tree traversals |
void |
applyDefaultNormalizations()
|
void |
applyGeneratedTests()
|
void |
assureInvariant(String oclConstraint)
By calling this method, a normalizer assures that the given OCL invariant holds for this AST. |
void |
assureTypes()
starts a type check if tree has not already been checked |
void |
breakInvariant(String oclConstraint)
A normalizer can use this method to notify the OclTree that the AST no longer fulfilles an invariant. |
void |
changeNotify()
|
void |
changeNotify(Node subtree)
notify the NameBoundQueryable that the ASTs subtree starting at the node given as parameter may have changed |
protected void |
checkNameBoundQueryable()
|
protected void |
checkTypeQueryable()
|
static OclTree |
createTree(String oclExpression,
ModelFacade mf)
creates an OclTree that uses a TypeChecker to acquire
type and name binding information |
static OclTree |
createTree(String oclExpression,
ModelFacade mf,
QueryableFactory qf)
|
protected static TypeFactory |
createTypeFactory(ModelFacade mf)
|
boolean |
equalsExpression(OclTree tree)
|
boolean |
fulfillsInvariant(String oclConstraint)
This method determines whether the AST fulfills a given OCL invariant. |
HashSet |
getBoundNames(Node n)
|
CodeFragment[] |
getCode(CodeGenerator cgen)
|
String |
getConstraintName()
|
String |
getDefaultContext(Node n)
|
String |
getExpression()
|
NameCreator |
getNameCreator()
|
Type |
getNodeType(Node n)
|
Start |
getRoot()
|
Type |
getTypeFor(String name,
Node node)
|
boolean |
isNameBound(String name,
Node node)
|
void |
requireInvariant(String oclConstraint)
|
void |
setNameCreator(NameCreator nc)
A NameCreator is created on demand when getNameCreator() is called for the first time; calling this operation is necessary only if you want several OCL trees to use the same NameCreator, which will then create unique names beyond the scope of a single OCL constraint. It is safe to first create the tree using createTree and afterwards set the NameCreator. |
void |
setQueryableFactory(QueryableFactory qf)
calling this method is only effective before checkNameBoundQueryable and checkTypeQueryable
are called for the first time |
String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected static final String NAME_SEPARATOR
ast,
Constant Field Valuesprotected Start ast
protected String name
NAME_SEPARATOR as separator
NAME_SEPARATORprotected HashSet invariants
protected NameCreator nameCreator
protected TypeQueryable typeQueryable
protected NameBoundQueryable nameBoundQueryable
protected QueryableFactory qFactory
protected TypeFactory tFactory
| Constructor Detail |
public OclTree(Start ast)
protected OclTree()
| Method Detail |
public static OclTree createTree(String oclExpression,
ModelFacade mf)
throws OclParserException,
IOException
TypeChecker to acquire
type and name binding information
OclParserException
IOException
public static OclTree createTree(String oclExpression,
ModelFacade mf,
QueryableFactory qf)
throws IOException
qf - may be null
IOExceptionprotected static TypeFactory createTypeFactory(ModelFacade mf)
public void assureTypes()
public void applyGeneratedTests()
public void applyDefaultNormalizations()
public boolean equalsExpression(OclTree tree)
public String getConstraintName()
public Start getRoot()
public String getExpression()
public void setNameCreator(NameCreator nc)
public NameCreator getNameCreator()
public void assureInvariant(String oclConstraint)
oclConstraint - the String representation of an OCL constraint;
it must contain exactly those ignored tokens
it would contain if it was parsed and then
retransformed into a Stringpublic boolean fulfillsInvariant(String oclConstraint)
oclConstraint - the String representation of an OCL constraint;
it must contain exactly those ignored tokens
it would contain if it was parsed and then
retransformed into a StringassureInvariant(String inv)
public void requireInvariant(String oclConstraint)
throws PreconditionViolatedException
PreconditionViolatedException - if the AST does not fulfill the given
preconditionassureInvariant(String inv)public void breakInvariant(String oclConstraint)
public String toString()
public void apply(Switch s)
apply in interface Switchablepublic CodeFragment[] getCode(CodeGenerator cgen)
public String getDefaultContext(Node n)
getDefaultContext in interface NameBoundQueryablepublic void changeNotify()
public void changeNotify(Node subtree)
NameBoundQueryable
changeNotify in interface NameBoundQueryable
public Type getTypeFor(String name,
Node node)
getTypeFor in interface TypeQueryablenull
if the name is not boundpublic Type getNodeType(Node n)
getNodeType in interface TypeQueryable
public boolean isNameBound(String name,
Node node)
isNameBound in interface NameBoundQueryablepublic HashSet getBoundNames(Node n)
getBoundNames in interface NameBoundQueryableprotected void checkNameBoundQueryable()
protected void checkTypeQueryable()
public void setQueryableFactory(QueryableFactory qf)
checkNameBoundQueryable and checkTypeQueryable
are called for the first time
|
Dresden OCL Toolkit | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||