use of org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ConstraintVariable2 in project che by eclipse.
the class ParametricStructureComputer method updateElementVarStructureFromParent.
/**
* Updates the structure of any subsidiary element variables (if any) for
* the given ConstraintVariable2 (if it is in fact a container).
*/
private void updateElementVarStructureFromParent(ConstraintVariable2 v) {
// Propagate structure from container variable to any subsidiary element variables
if (elemStructure(v) != ParametricStructure.NONE && fTCModel.getElementVariables(v).size() > 0) {
ParametricStructure t = elemStructure(v);
for (Iterator<CollectionElementVariable2> iterator = fTCModel.getElementVariables(v).values().iterator(); iterator.hasNext(); ) {
CollectionElementVariable2 typeVar = iterator.next();
int declarationTypeVariableIndex = typeVar.getDeclarationTypeVariableIndex();
if (declarationTypeVariableIndex != CollectionElementVariable2.NOT_DECLARED_TYPE_VARIABLE_INDEX)
updateStructureOfVar(typeVar, t.getParameters()[declarationTypeVariableIndex], TypeOperator.Equals);
}
}
}
use of org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ConstraintVariable2 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();
}
use of org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ConstraintVariable2 in project che by eclipse.
the class InferTypeArgumentsTCModel method pruneUnusedCuScopedCvs.
private void pruneUnusedCuScopedCvs() {
for (Iterator<ConstraintVariable2> iter = fCuScopedConstraintVariables.iterator(); iter.hasNext(); ) {
ConstraintVariable2 cv = iter.next();
pruneCvIfUnused(cv);
}
}
use of org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ConstraintVariable2 in project che by eclipse.
the class InferTypeArgumentsTCModel method makeParameterizedTypeVariable.
private ParameterizedTypeVariable2 makeParameterizedTypeVariable(TType type) {
Assert.isTrue(isAGenericType(type));
ParameterizedTypeVariable2 cv = new ParameterizedTypeVariable2(type);
ParameterizedTypeVariable2 storedCv = (ParameterizedTypeVariable2) storedCv(cv);
if (cv == storedCv) {
fCuScopedConstraintVariables.add(storedCv);
makeElementVariables(storedCv, type);
if (fStoreToString)
//$NON-NLS-1$ //$NON-NLS-2$
storedCv.setData(ConstraintVariable2.TO_STRING, "ParameterizedType(" + type.getPrettySignature() + ")");
}
return storedCv;
}
use of org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ConstraintVariable2 in project che by eclipse.
the class InferTypeArgumentsTCModel method makeVariableVariable.
public VariableVariable2 makeVariableVariable(IVariableBinding variableBinding) {
if (variableBinding == null)
return null;
TType type = getBoxedType(variableBinding.getType(), /*no boxing*/
null);
if (type == null)
return null;
VariableVariable2 cv = new VariableVariable2(type, variableBinding);
VariableVariable2 storedCv = (VariableVariable2) storedCv(cv);
if (storedCv == cv) {
if (!variableBinding.isField() || Modifier.isPrivate(variableBinding.getModifiers()))
fCuScopedConstraintVariables.add(storedCv);
makeElementVariables(storedCv, type);
makeArrayElementVariable(storedCv);
if (fStoreToString)
storedCv.setData(ConstraintVariable2.TO_STRING, '[' + variableBinding.getName() + ']');
}
return storedCv;
}
Aggregations