|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.llnl.babel.symbols.ASTNode
gov.llnl.babel.symbols.Assertion
public class Assertion
Field Summary | |
---|---|
static int |
ENSURE
|
static int |
ENSURE_THEN
|
static int |
INVARIANT
|
static int |
REQUIRE
|
static int |
REQUIRE_ELSE
|
static java.lang.String[] |
s_names
|
static int |
UNKNOWN
|
Fields inherited from class gov.llnl.babel.symbols.ASTNode |
---|
d_frozen |
Constructor Summary | |
---|---|
Assertion(int type,
java.lang.String source,
java.lang.String tag,
Comment comment)
Create a new object. |
Method Summary | |
---|---|
java.lang.String |
cExpression(java.lang.String epvVar,
int[] startInd)
Return the C version of the expression used to check for violation. |
protected void |
ensureNoPostAssertions(AssertionExpression expr)
Ensure the expression does not contain any (sub)expressions specifically for post-condition assertions. |
java.lang.String |
errorMessage()
Return the error message associated with a failure of this assertion. |
void |
freeze()
|
java.util.ArrayList |
getArrayIterMacros(java.lang.String epvVar,
int[] startInd)
Return the list of array iteration macro messages, if any. |
Comment |
getComment()
Return the comment, if any, associated with this list of object states. |
protected java.lang.String |
getExceptionPrefix(Extendable ext,
Method m)
Return the prefix for exception messages based on the specified extendable and method. |
AssertionExpression |
getExpression()
Return the assertion expression. |
int |
getNumArrayIterMacrosByType(char type)
Returns the number of macros supported by this assertion of the specified type. |
java.lang.String |
getSource()
Return the source associated with this assertion. |
java.lang.String |
getTag()
Return the tag associated with this list of object states. |
int |
getType()
Return the type of the assertion. |
int |
getType(java.lang.String name)
Return the type of the assertion specified by name. |
java.lang.String |
getTypeName()
Return the name of the type of the assertion. |
boolean |
hasMethodCall()
Return TRUE if a method call is found within the expression; otherwise, return FALSE. |
boolean |
hasPureClause()
Return TRUE if a pure clause is found within the expression; otherwise, return FALSE. |
boolean |
hasReservedMethod(int type)
Return TRUE if the specified reserved method call is found within the expression; otherwise, return FALSE. |
boolean |
hasResult()
Return TRUE if a result clause is found within the expression; otherwise, return FALSE. |
boolean |
hasUnreservedMethod(boolean any)
Return TRUE if the method is any unreserved method (when any is TRUE) or it is an unreserved method with a throws clause (if any is FALSE); otherwise, return FALSE. |
boolean |
isInvariant()
Return TRUE if an invariant; otherwise, returns FALSE. |
boolean |
isPostcondition()
Return TRUE if a postcondition; otherwise, returns FALSE. |
boolean |
isPrecondition()
Return TRUE if a precondition; otherwise, returns FALSE. |
boolean |
isValid()
Return TRUE if the expression has been validated; otherwise, return FALSE. |
void |
setExpression(AssertionExpression expr)
Set the assertion expression. |
java.lang.String |
toString()
Return the stringified version of the expression (in SIDL form) BUT without the comment. |
void |
validateExpression(Extendable ext,
Method m,
boolean skip)
Validate the assertion expression within the context of the given extendable and optional method. |
Methods inherited from class gov.llnl.babel.symbols.ASTNode |
---|
checkFrozen, clone, protectCollection, protectList, protectMap, protectSet |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int UNKNOWN
public static final int INVARIANT
public static final int REQUIRE
public static final int REQUIRE_ELSE
public static final int ENSURE
public static final int ENSURE_THEN
public static final java.lang.String[] s_names
Constructor Detail |
---|
public Assertion(int type, java.lang.String source, java.lang.String tag, Comment comment) throws AssertionException
type
- The type of the assertion.source
- The owning interface or class. For use in generated
debug messages.tag
- The tag, if any, associated with the assertion. For
use in generated debug messags.comment
- The comment, if any, associated with the assertion.
AssertionException
- The exception raised if assertion type is invalid.Method Detail |
---|
public int getType()
public int getType(java.lang.String name)
name
- The name of the type of assertion whose type is to be
returned.public boolean isPrecondition()
public boolean isPostcondition()
public boolean isInvariant()
public java.lang.String getTypeName()
public java.lang.String getSource()
public java.lang.String getTag()
public Comment getComment()
protected java.lang.String getExceptionPrefix(Extendable ext, Method m)
ext
- The interface or class that owns this expression.m
- The method that owns this expression.protected void ensureNoPostAssertions(AssertionExpression expr) throws AssertionException
expr
- The assertion expression being checked.
AssertionException
- The exception raised if post-condition assertions present.public void setExpression(AssertionExpression expr) throws AssertionException
expr
- The assertion expression being checked.
AssertionException
- The exception raised if type validation fails.public AssertionExpression getExpression()
public boolean isValid()
public void validateExpression(Extendable ext, Method m, boolean skip) throws AssertionException
ext
- The interface or class that owns this expression.m
- The method that owns this expression.skip
- If TRUE, will skip the validation process if the
expression has already been marked as being valid.
AssertionException
- The exception that can be raised during the validation.public boolean hasPureClause()
public boolean hasResult()
public boolean hasMethodCall()
public boolean hasReservedMethod(int type)
public boolean hasUnreservedMethod(boolean any)
public java.lang.String errorMessage()
public java.util.ArrayList getArrayIterMacros(java.lang.String epvVar, int[] startInd)
public int getNumArrayIterMacrosByType(char type)
public java.lang.String cExpression(java.lang.String epvVar, int[] startInd)
public java.lang.String toString()
toString
in class java.lang.Object
public void freeze()
freeze
in class ASTNode
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |