Search in sources :

Example 1 with SubTypeConstraint2

use of org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.SubTypeConstraint2 in project che by eclipse.

the class ParametricStructureComputer method computeContainerStructure.

private void computeContainerStructure() {
    if (DEBUG_INITIALIZATION)
        //$NON-NLS-1$
        System.out.println("\n*** Computing Container Structure ***\n");
    initializeContainerStructure();
    if (DEBUG_INITIALIZATION)
        dumpContainerStructure();
    while (!fWorkList2.isEmpty()) {
        ConstraintVariable2 v = fWorkList2.pop();
        List<ITypeConstraint2> usedIn = fTCModel.getUsedIn(v);
        for (Iterator<ITypeConstraint2> iter = usedIn.iterator(); iter.hasNext(); ) {
            SubTypeConstraint2 stc = (SubTypeConstraint2) iter.next();
            ConstraintVariable2 lhs = stc.getLeft();
            ConstraintVariable2 rhs = stc.getRight();
            unifyContainerStructure(lhs, rhs);
        }
        TypeEquivalenceSet typeEquivalenceSet = v.getTypeEquivalenceSet();
        if (typeEquivalenceSet != null) {
            ConstraintVariable2[] contributingVariables = typeEquivalenceSet.getContributingVariables();
            for (int i = 0; i + 1 < contributingVariables.length; i++) {
                ConstraintVariable2 first = contributingVariables[i];
                ConstraintVariable2 second = contributingVariables[i + 1];
                unifyContainerStructure(first, second);
            }
        }
    }
    if (DEBUG_INITIALIZATION)
        dumpContainerStructure();
}
Also used : TypeEquivalenceSet(org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TypeEquivalenceSet) ConstraintVariable2(org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ConstraintVariable2) ITypeConstraint2(org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ITypeConstraint2) SubTypeConstraint2(org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.SubTypeConstraint2)

Example 2 with SubTypeConstraint2

use of org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.SubTypeConstraint2 in project che by eclipse.

the class InferTypeArgumentsTCModel method createSubtypeConstraint.

public void createSubtypeConstraint(ConstraintVariable2 cv1, ConstraintVariable2 cv2) {
    if (!keep(cv1, cv2))
        return;
    ConstraintVariable2 storedCv1 = storedCv(cv1);
    ConstraintVariable2 storedCv2 = storedCv(cv2);
    ITypeConstraint2 typeConstraint = new SubTypeConstraint2(storedCv1, storedCv2);
    Object storedTc = fTypeConstraints.get(typeConstraint);
    if (storedTc == null) {
        fTypeConstraints.put(typeConstraint, typeConstraint);
    } else {
        typeConstraint = (ITypeConstraint2) storedTc;
    }
    registerCvWithTc(storedCv1, typeConstraint);
    registerCvWithTc(storedCv2, typeConstraint);
}
Also used : ConstraintVariable2(org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ConstraintVariable2) ITypeConstraint2(org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ITypeConstraint2) SubTypeConstraint2(org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.SubTypeConstraint2)

Aggregations

ConstraintVariable2 (org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ConstraintVariable2)2 ITypeConstraint2 (org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ITypeConstraint2)2 SubTypeConstraint2 (org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.SubTypeConstraint2)2 TypeEquivalenceSet (org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TypeEquivalenceSet)1