ValidationListener
public class LoggingValidationContext extends ValidationContext implements ValidationListener
ValidationContext
which implements the
ValidationListener
interface to track his own validation process.
An instance of this class creates an SBMLErrorLog
which contains some
SBMLError
object for every broken constraint.
The level and version parameter are used to determine which rules will be checked.
For more informations about the SBML specifications look up sbml.org .
Constructor | Description |
---|---|
LoggingValidationContext(int level,
int version) |
Creates a new
LoggingValidationContext instance. |
LoggingValidationContext(int level,
int version,
AnyConstraint<java.lang.Object> rootConstraint,
java.util.Set<SBMLValidator.CHECK_CATEGORY> categories) |
Creates a new
LoggingValidationContext instance. |
Modifier and Type | Method | Description |
---|---|---|
static java.util.Set<java.lang.String> |
analyseSBMLerrorLog(java.util.List<SBMLError> validationErrors) |
Goes through the list of
SBMLError given to determined which
check categories should be ignored. |
void |
clear() |
Clears the loaded constraints
|
void |
clearErrorLog() |
Clears the error log.
|
void |
didValidate(ValidationContext ctx,
AnyConstraint<?> c,
java.lang.Object o,
boolean success) |
Invoked after the constraint has validated the object.
|
SBMLErrorLog |
getErrorLog() |
Gets the
SBMLErrorLog of this context. |
static SBase |
getParentSBase(TreeNodeWithChangeSupport o) |
|
void |
logFailure(int id,
java.lang.Object o) |
Logs an
SBMLError into the SBMLErrorLog . |
void |
logFailure(SBMLError error) |
Logs an
SBMLError into the SBMLErrorLog . |
boolean |
validate(java.lang.Object o,
boolean clearMap) |
Validates the object with the loaded constraints and clears the HashMap
afterwards if the clearMap is set to
true . |
void |
willValidate(ValidationContext ctx,
AnyConstraint<?> c,
java.lang.Object o) |
Invoked before the constraint will validate the object.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addValidationListener, didValidate, enableCheckCategories, enableCheckCategory, getCheckCategories, getConstraintType, getHashMap, getLevel, getLevelAndVersion, getPackageVersion, getRootConstraint, getValidateRecursively, getVersion, isEnabledCategory, isLevelAndVersionEqualTo, isLevelAndVersionGreaterEqualThan, isLevelAndVersionGreaterThan, isLevelAndVersionLesserEqualThan, isLevelAndVersionLessThan, loadConstraints, loadConstraints, loadConstraints, loadConstraintsForAttribute, removeValidationListener, setLevel, setLevelAndVersion, setPackageVersion, setRootConstraint, setValidateRecursively, setVersion, validate, willValidate
public LoggingValidationContext(int level, int version)
LoggingValidationContext
instance.level
- the SBML levelversion
- the SBML versionpublic LoggingValidationContext(int level, int version, AnyConstraint<java.lang.Object> rootConstraint, java.util.Set<SBMLValidator.CHECK_CATEGORY> categories)
LoggingValidationContext
instance.level
- the SBML levelversion
- the SBML versionrootConstraint
- the root constraintcategories
- the set of SBMLValidator.CHECK_CATEGORY
to use during validationpublic void clear()
ValidationContext
clear
in class ValidationContext
public void clearErrorLog()
public SBMLErrorLog getErrorLog()
SBMLErrorLog
of this context.SBMLErrorLog
of this context.public void logFailure(SBMLError error)
SBMLError
into the SBMLErrorLog
.error
- the error to logpublic void logFailure(int id, java.lang.Object o)
SBMLError
into the SBMLErrorLog
.id
- the error id to logpublic static SBase getParentSBase(TreeNodeWithChangeSupport o)
o
- public void didValidate(ValidationContext ctx, AnyConstraint<?> c, java.lang.Object o, boolean success)
ValidationListener
didValidate
in interface ValidationListener
ctx
- the context which controls the validationc
- a constrainto
- the object which was checkedsuccess
- is false
when the constraint was brokenpublic boolean validate(java.lang.Object o, boolean clearMap)
ValidationContext
true
.validate
in class ValidationContext
o
- the object to validateclearMap
- boolean to indicate if we need to clear the context after validationtrue
if the object passed successfully validation.public void willValidate(ValidationContext ctx, AnyConstraint<?> c, java.lang.Object o)
ValidationListener
willValidate
in interface ValidationListener
ctx
- the context which controls the validationc
- a constrainto
- the object which will be checkedpublic static java.util.Set<java.lang.String> analyseSBMLerrorLog(java.util.List<SBMLError> validationErrors)
SBMLError
given to determined which
check categories should be ignored.
As soon as an error is detected in a check category, all the categories below it should be ignored. The order of the check category is:
validationErrors
- the list of SBMLError
to check