// Make sure the constraints are the same.
StringBuffer constraintsDescription = new StringBuffer();
try {
Iterator constraintIterator = constraints.iterator();
while (constraintIterator.hasNext()) {
Inequality constraint = (Inequality) constraintIterator
.next();
constraintsDescription
.append(constraint.toString());
}
} catch (Throwable throwable) {
throw new IllegalActionException(actor, throwable,
"Failed to iterate through constraints.");
}
StringBuffer cloneConstraintsDescription = new StringBuffer();
Iterator cloneConstraintIterator = cloneConstraints
.iterator();
while (cloneConstraintIterator.hasNext()) {
Inequality constraint = (Inequality) cloneConstraintIterator
.next();
cloneConstraintsDescription.append(constraint
.toString());
}
if (!constraintsDescription.toString().equals(
cloneConstraintsDescription.toString())) {
results
.append(actor.getFullName()
+ " and its clone do "
+ "not have the same constraints:\n"
+ constraintsDescription.toString()
+ "\nClone:\n"
+ cloneConstraintsDescription
.toString() + "\n");
}
// Check that the type constraint is between ports
// and Parameters of the same object.
cloneConstraintIterator = cloneConstraints.iterator();
while (cloneConstraintIterator.hasNext()) {
Inequality constraint = (Inequality) cloneConstraintIterator
.next();
InequalityTerm greaterTerm = constraint
.getGreaterTerm();
InequalityTerm lesserTerm = constraint.getLesserTerm();
Object greaterAssociatedObject = greaterTerm
.getAssociatedObject();
Object lesserAssociatedObject = lesserTerm
.getAssociatedObject();