• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TypeEquivalenceSet类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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();
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:InferTypeArgumentsConstraintsSolver.java


示例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()));
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:SuperTypeConstraintsSolver.java


示例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();
}
 
开发者ID:eclipse,项目名称:che,代码行数:35,代码来源:ParametricStructureComputer.java


示例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);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:29,代码来源:InferTypeArgumentsTCModel.java


示例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();
}
 
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:InferTypeArgumentsConstraintsSolver.java


示例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);
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:35,代码来源:SuperTypeConstraintsModel.java


示例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();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:37,代码来源:ParametricStructureComputer.java


示例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);
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:30,代码来源:InferTypeArgumentsTCModel.java


示例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



注:本文中的org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TypeEquivalenceSet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java R类代码示例发布时间:2022-05-16
下一篇:
Java IntWrapper类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap