Example #1
0
 private boolean attachToExistingConstraints(
     Collection4 newConstraintsCollector, Object obj, boolean onlyForPaths) {
   boolean found = false;
   final Iterator4 j = iterateConstraints();
   while (j.moveNext()) {
     QCon existingConstraint = (QCon) j.current();
     final BooleanByRef removeExisting = new BooleanByRef(false);
     if (!onlyForPaths || (existingConstraint instanceof QConPath)) {
       QCon newConstraint = existingConstraint.shareParent(obj, removeExisting);
       if (newConstraint != null) {
         newConstraintsCollector.add(newConstraint);
         addConstraint(newConstraint);
         if (removeExisting.value) {
           removeConstraint(existingConstraint);
         }
         found = true;
         if (!onlyForPaths) {
           break;
         }
       }
     }
   }
   return found;
 }