本文整理汇总了Java中org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TypeEquivalenceSet类的典型用法代码示例。如果您正苦于以下问题:Java TypeEquivalenceSet类的具体用法?Java TypeEquivalenceSet怎么用?Java TypeEquivalenceSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TypeEquivalenceSet类属于org.eclipse.jdt.internal.corext.refactoring.typeconstraints2包,在下文中一共展示了TypeEquivalenceSet类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: chooseTypes
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TypeEquivalenceSet; //导入依赖的package包/类
private void chooseTypes(ConstraintVariable2[] allConstraintVariables, SubProgressMonitor pm) {
pm.beginTask("", allConstraintVariables.length); // $NON-NLS-1$
for (int i = 0; i < allConstraintVariables.length; i++) {
ConstraintVariable2 cv = allConstraintVariables[i];
TypeEquivalenceSet set = cv.getTypeEquivalenceSet();
if (set == null)
continue; // TODO: should not happen iff all unused constraint variables got pruned
// TODO: should calculate only once per EquivalenceRepresentative; can throw away estimate
// TypeSet afterwards
TType type =
chooseSingleType((TypeSet) cv.getTypeEstimate()); // TODO: is null for Universe TypeSet
setChosenType(cv, type);
if (cv instanceof CollectionElementVariable2) {
CollectionElementVariable2 elementCv = (CollectionElementVariable2) cv;
fUpdate.addDeclaration(elementCv);
}
pm.worked(1);
if (pm.isCanceled()) throw new OperationCanceledException();
}
pm.done();
}
示例2: processConstraints
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TypeEquivalenceSet; //导入依赖的package包/类
/**
* Processes the given constraints on the constraint variable and propagates it.
*
* @param constraints the type constraints to process (element type: <code>ITypeConstraint2</code>)
*/
private void processConstraints(final Collection<ITypeConstraint2> constraints) {
final int level= fModel.getCompliance();
ITypeConstraint2 constraint= null;
for (final Iterator<ITypeConstraint2> iterator= constraints.iterator(); iterator.hasNext();) {
constraint= iterator.next();
if ((level == 3 || !(constraint instanceof CovariantTypeConstraint)) && !(constraint instanceof ConditionalTypeConstraint)) {
final ConstraintVariable2 leftVariable= constraint.getLeft();
final ITypeSet leftEstimate= leftVariable.getTypeEstimate();
final TypeEquivalenceSet set= leftVariable.getTypeEquivalenceSet();
final ITypeSet newEstimate= leftEstimate.restrictedTo(constraint.getRight().getTypeEstimate());
if (leftEstimate != newEstimate) {
set.setTypeEstimate(newEstimate);
fProcessable.addAll(Arrays.asList(set.getContributingVariables()));
}
}
}
}
示例3: chooseTypes
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TypeEquivalenceSet; //导入依赖的package包/类
private void chooseTypes(ConstraintVariable2[] allConstraintVariables, SubProgressMonitor pm) {
pm.beginTask("", allConstraintVariables.length); //$NON-NLS-1$
for (int i= 0; i < allConstraintVariables.length; i++) {
ConstraintVariable2 cv= allConstraintVariables[i];
TypeEquivalenceSet set= cv.getTypeEquivalenceSet();
if (set == null)
continue; //TODO: should not happen iff all unused constraint variables got pruned
//TODO: should calculate only once per EquivalenceRepresentative; can throw away estimate TypeSet afterwards
TType type= chooseSingleType((TypeSet) cv.getTypeEstimate()); //TODO: is null for Universe TypeSet
setChosenType(cv, type);
if (cv instanceof CollectionElementVariable2) {
CollectionElementVariable2 elementCv= (CollectionElementVariable2) cv;
fUpdate.addDeclaration(elementCv);
}
pm.worked(1);
if (pm.isCanceled())
throw new OperationCanceledException();
}
pm.done();
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:InferTypeArgumentsConstraintsSolver.java
示例4: computeContainerStructure
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TypeEquivalenceSet; //导入依赖的package包/类
private void computeContainerStructure() {
if (DEBUG_INITIALIZATION)
System.out.println("\n*** Computing Container Structure ***\n"); // $NON-NLS-1$
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();
}
示例5: createEqualsConstraint
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TypeEquivalenceSet; //导入依赖的package包/类
public void createEqualsConstraint(
ConstraintVariable2 leftElement, ConstraintVariable2 rightElement) {
if (leftElement == null || rightElement == null) return;
TypeEquivalenceSet leftSet = leftElement.getTypeEquivalenceSet();
TypeEquivalenceSet rightSet = rightElement.getTypeEquivalenceSet();
if (leftSet == null) {
if (rightSet == null) {
TypeEquivalenceSet set = new TypeEquivalenceSet(leftElement, rightElement);
leftElement.setTypeEquivalenceSet(set);
rightElement.setTypeEquivalenceSet(set);
} else {
rightSet.add(leftElement);
leftElement.setTypeEquivalenceSet(rightSet);
}
} else {
if (rightSet == null) {
leftSet.add(rightElement);
rightElement.setTypeEquivalenceSet(leftSet);
} else if (leftSet == rightSet) {
return;
} else {
ConstraintVariable2[] cvs = rightSet.getContributingVariables();
leftSet.addAll(cvs);
for (int i = 0; i < cvs.length; i++) cvs[i].setTypeEquivalenceSet(leftSet);
}
}
}
示例6: getChosenType
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TypeEquivalenceSet; //导入依赖的package包/类
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();
}
示例7: createEqualityConstraint
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TypeEquivalenceSet; //导入依赖的package包/类
/**
* Creates an equality constraint.
*
* @param left the left typeconstraint variable
* @param right the right typeconstraint variable
*/
public final void createEqualityConstraint(final ConstraintVariable2 left, final ConstraintVariable2 right) {
if (left != null && right != null) {
final TypeEquivalenceSet first= left.getTypeEquivalenceSet();
final TypeEquivalenceSet second= right.getTypeEquivalenceSet();
if (first == null) {
if (second == null) {
final TypeEquivalenceSet set= new TypeEquivalenceSet(left, right);
left.setTypeEquivalenceSet(set);
right.setTypeEquivalenceSet(set);
} else {
second.add(left);
left.setTypeEquivalenceSet(second);
}
} else {
if (second == null) {
first.add(right);
right.setTypeEquivalenceSet(first);
} else if (first == second)
return;
else {
final ConstraintVariable2[] variables= second.getContributingVariables();
first.addAll(variables);
for (int index= 0; index < variables.length; index++)
variables[index].setTypeEquivalenceSet(first);
}
}
}
}
示例8: computeContainerStructure
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TypeEquivalenceSet; //导入依赖的package包/类
private void computeContainerStructure() {
if (DEBUG_INITIALIZATION)
System.out.println("\n*** Computing Container Structure ***\n"); //$NON-NLS-1$
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();
}
示例9: createEqualsConstraint
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TypeEquivalenceSet; //导入依赖的package包/类
public void createEqualsConstraint(ConstraintVariable2 leftElement, ConstraintVariable2 rightElement) {
if (leftElement == null || rightElement == null)
return;
TypeEquivalenceSet leftSet= leftElement.getTypeEquivalenceSet();
TypeEquivalenceSet rightSet= rightElement.getTypeEquivalenceSet();
if (leftSet == null) {
if (rightSet == null) {
TypeEquivalenceSet set= new TypeEquivalenceSet(leftElement, rightElement);
leftElement.setTypeEquivalenceSet(set);
rightElement.setTypeEquivalenceSet(set);
} else {
rightSet.add(leftElement);
leftElement.setTypeEquivalenceSet(rightSet);
}
} else {
if (rightSet == null) {
leftSet.add(rightElement);
rightElement.setTypeEquivalenceSet(leftSet);
} else if (leftSet == rightSet) {
return;
} else {
ConstraintVariable2[] cvs= rightSet.getContributingVariables();
leftSet.addAll(cvs);
for (int i= 0; i < cvs.length; i++)
cvs[i].setTypeEquivalenceSet(leftSet);
}
}
}
示例10: getChosenType
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TypeEquivalenceSet; //导入依赖的package包/类
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();
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:15,代码来源:InferTypeArgumentsConstraintsSolver.java