Exemple #1
0
 private void addConstraint(Collection4 col, Object obj) {
   if (attachToExistingConstraints(col, obj, true)) {
     return;
   }
   if (attachToExistingConstraints(col, obj, false)) {
     return;
   }
   QConObject newConstraint = new QConObject(_trans, null, null, obj);
   addConstraint(newConstraint);
   col.add(newConstraint);
 }
Exemple #2
0
 private Collection4 introduceClassConstrain(ReflectClass claxx) {
   final Collection4 newConstraints = new Collection4();
   final Iterator4 existingConstraints = iterateConstraints();
   while (existingConstraints.moveNext()) {
     final QCon existingConstraint = (QConObject) existingConstraints.current();
     final BooleanByRef removeExisting = new BooleanByRef(false);
     final QCon newConstraint = existingConstraint.shareParentForClass(claxx, removeExisting);
     if (newConstraint != null) {
       newConstraints.add(newConstraint);
       addConstraint(newConstraint);
       if (removeExisting.value) {
         removeConstraint(existingConstraint);
       }
     }
   }
   return newConstraints;
 }
Exemple #3
0
  public Iterator4 executeSnapshot() {
    final CreateCandidateCollectionResult r = createCandidateCollection();

    final Collection4 executionPath = executionPath(r);

    Iterator4 candidatesIterator = new Iterator4Impl(r.candidateCollection);

    Collection4 snapshots = new Collection4();
    while (candidatesIterator.moveNext()) {
      QCandidates candidates = (QCandidates) candidatesIterator.current();
      snapshots.add(candidates.executeSnapshot(executionPath));
    }

    Iterator4 snapshotsIterator = snapshots.iterator();
    final CompositeIterator4 resultingIDs = new CompositeIterator4(snapshotsIterator);

    if (!r.checkDuplicates) {
      return resultingIDs;
    }

    return checkDuplicates(resultingIDs);
  }
Exemple #4
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;
 }
Exemple #5
0
 void addConstraint(QCon a_constraint) {
   i_constraints.add(a_constraint);
 }