public List verify(YExternalNetElement caller) {
List messages = new Vector();
if (_priorElement == null || _nextElement == null) {
if (_priorElement == null) {
messages.add(new YVerificationMessage(caller, caller + " [error] null prior element", YVerificationMessage.ERROR_STATUS));
}
if (_nextElement == null) {
messages.add(new YVerificationMessage(caller, caller + " [error] null next element", YVerificationMessage.ERROR_STATUS));
}
} else if (_priorElement._net != _nextElement._net) {
messages.add(new YVerificationMessage(caller, caller
+ " any flow from any Element (" + _priorElement +
") to any Element (" + _nextElement + ") " +
"must occur with the bounds of the same net.", YVerificationMessage.ERROR_STATUS));
}
if (_priorElement instanceof YTask) {
YTask priorElement = (YTask) _priorElement;
int priorElementSplitType = priorElement.getSplitType();
if (priorElementSplitType == YTask._AND) {
if (_xpathPredicate != null) {
messages.add(new YVerificationMessage(caller, caller
+ " any flow from any AND-split (" + _priorElement
+ ") may not have an xpath predicate.", YVerificationMessage.ERROR_STATUS));
}
if (_isDefaultFlow) {
messages.add(new YVerificationMessage(caller, caller
+ " any flow from any AND-split (" + _priorElement
+ ") may not have a default flow.", YVerificationMessage.ERROR_STATUS));
}
}
//AND-split or OR-split
if (priorElementSplitType != YTask._XOR) {
if (_evalOrdering != null) {
messages.add(new YVerificationMessage(caller, caller
+ " any flow from any non XOR-split (" + _priorElement
+ ") may not have an eval ordering.", YVerificationMessage.ERROR_STATUS));
}
}
//OR-split or XOR-split
if (priorElementSplitType != YTask._AND) {
//both must have at least one
if (_xpathPredicate == null && !_isDefaultFlow) {
messages.add(new YVerificationMessage(caller, caller
+ " any flow from any XOR/OR-split (" + _priorElement
+ ") must have either a predicate or be a default flow.", YVerificationMessage.ERROR_STATUS));
}
//check XOR-split
if (priorElementSplitType == YTask._XOR) {
//has predicate XOR isDefault
if (_xpathPredicate != null && _isDefaultFlow) {
messages.add(new YVerificationMessage(caller, caller
+ " any flow from any XOR-split (" + _priorElement
+ ") must have either a predicate or " +
"be a default flow (cannot be both).", YVerificationMessage.ERROR_STATUS));
}
//has predicate implies has ordering
if (_xpathPredicate != null && _evalOrdering == null) {
messages.add(new YVerificationMessage(caller, caller
+ " any flow from any XOR-split (" + _priorElement
+ ") that has a predicate, must have an eval ordering.", YVerificationMessage.ERROR_STATUS));
}
}
//check OR-split
else {
//must have predicates
if (_xpathPredicate == null) {
messages.add(new YVerificationMessage(caller, caller
+ " any flow from any OR-split (" + _priorElement
+ ") must have a predicate.", YVerificationMessage.ERROR_STATUS));
}
//must not have ordering
else if (_evalOrdering != null) {
messages.add(new YVerificationMessage(caller, caller
+ " any flow from any OR-split (" + _priorElement
+ ") must not have an ordering.", YVerificationMessage.ERROR_STATUS));
}
}
}
} else {
if (_xpathPredicate != null) {
messages.add(new YVerificationMessage(caller, caller
+ " [error] any flow from any condition (" + _priorElement
+ ") may not contain a predicate.", YVerificationMessage.ERROR_STATUS));
}
if (_evalOrdering != null) {
messages.add(new YVerificationMessage(caller, caller
+ " [error] any flow from any condition (" + _priorElement
+ ") may not contain an eval ordering.", YVerificationMessage.ERROR_STATUS));
}
if (_isDefaultFlow) {
messages.add(new YVerificationMessage(caller, caller
+ " [error] any flow from any condition (" + _priorElement
+ ") may not be a default flow.", YVerificationMessage.ERROR_STATUS));
}
if (_nextElement instanceof YCondition) {
messages.add(new YVerificationMessage(caller, caller
+ " [error] any flow from any condition (" + _priorElement
+ ") to any other YConditionInterface (" + _nextElement + ") is not allowed.", YVerificationMessage.ERROR_STATUS));
}
}
if (_priorElement instanceof YOutputCondition) {
messages.add(new YVerificationMessage(caller, caller
+ " [error] any flow from an OutputCondition (" + _priorElement
+ ") is not allowed.", YVerificationMessage.ERROR_STATUS));
}
if (_nextElement instanceof YInputCondition) {
messages.add(new YVerificationMessage(caller, caller
+ " [error] any flow into an InputCondition (" + _nextElement
+ ") is not allowed.", YVerificationMessage.ERROR_STATUS));
}
return messages;
}