Search in sources :

Example 6 with TypeEquivalenceSet

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

the class InferTypeArgumentsConstraintsSolver method getChosenType.

public static TType getChosenType(ConstraintVariable2 cv) {
    TType type = (TType) cv.getData(CHOSEN_TYPE);
    if (type != null)
        return type;
    TypeEquivalenceSet set = cv.getTypeEquivalenceSet();
    if (set == null) {
        //TODO: should not have to set this here. Clean up when caching chosen type
        return null;
    //			// no representative == no restriction
    //			set= new TypeEquivalenceSet(cv);
    //			set.setTypeEstimate(TypeUniverseSet.create());
    //			cv.setTypeEquivalenceSet(set);
    }
    return cv.getTypeEstimate().chooseSingleType();
}
Also used : TType(org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType) TypeEquivalenceSet(org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TypeEquivalenceSet)

Example 7 with TypeEquivalenceSet

use of org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TypeEquivalenceSet 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)

Aggregations

TypeEquivalenceSet (org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TypeEquivalenceSet)7 ConstraintVariable2 (org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ConstraintVariable2)5 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)2 TType (org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType)2 EnumeratedTypeSet (org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.EnumeratedTypeSet)2 SingletonTypeSet (org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.SingletonTypeSet)2 TypeSet (org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet)2 CollectionElementVariable2 (org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.CollectionElementVariable2)2 ITypeConstraint2 (org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ITypeConstraint2)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 SubProgressMonitor (org.eclipse.core.runtime.SubProgressMonitor)1 TypeSetEnvironment (org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSetEnvironment)1 SubTypeConstraint2 (org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.SubTypeConstraint2)1