当前位置: 首页>>代码示例>>Java>>正文


Java TypeSet类代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet的典型用法代码示例。如果您正苦于以下问题:Java TypeSet类的具体用法?Java TypeSet怎么用?Java TypeSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TypeSet类属于org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets包,在下文中一共展示了TypeSet类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: chooseTypes

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet; //导入依赖的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: chooseTypes

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet; //导入依赖的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

示例3: createInitialEstimate

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet; //导入依赖的package包/类
private TypeSet createInitialEstimate(ConstraintVariable2 cv) {
  // TODO: check assumption: only immutable CVs have a type
  //		ParametricStructure parametricStructure= fElemStructureEnv.elemStructure(cv);
  //		if (parametricStructure != null && parametricStructure !=
  // ParametricStructureComputer.ParametricStructure.NONE) {
  //			return SubTypesOfSingleton.create(parametricStructure.getBase());
  //		}

  TType type = cv.getType();
  if (type == null) {
    return fTypeSetEnvironment.getUniverseTypeSet();

  } else if (cv instanceof IndependentTypeVariable2) {
    return fTypeSetEnvironment.getUniverseTypeSet();
    // TODO: solve problem with recursive bounds
    //			TypeVariable tv= (TypeVariable) type;
    //			TType[] bounds= tv.getBounds();
    //			TypeSet result= SubTypesOfSingleton.create(bounds[0].getErasure());
    //			for (int i= 1; i < bounds.length; i++) {
    //				result= result.intersectedWith(SubTypesOfSingleton.create(bounds[i].getErasure()));
    //			}
    //			return result;

  } else if (cv instanceof ArrayTypeVariable2) {
    return fTypeSetEnvironment.getUniverseTypeSet();
  } else if (cv instanceof ArrayElementVariable2) {
    if (cv.getType() != null && cv.getType().isTypeVariable()) {
      return fTypeSetEnvironment.getUniverseTypeSet();
    } else {
      return new SingletonTypeSet(type, fTypeSetEnvironment);
    }

  } else if (type.isVoidType()) {
    return fTypeSetEnvironment.getEmptyTypeSet();
  } else {
    return new SingletonTypeSet(type, fTypeSetEnvironment);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:39,代码来源:InferTypeArgumentsConstraintsSolver.java

示例4: chooseSingleType

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet; //导入依赖的package包/类
private TType chooseSingleType(TypeSet typeEstimate) {
  if (typeEstimate.isUniverse() || typeEstimate.isEmpty()) {
    return null;

  } else if (typeEstimate.hasUniqueLowerBound()) {
    return typeEstimate.uniqueLowerBound();

  } else {
    EnumeratedTypeSet lowerBound = typeEstimate.lowerBound().enumerate();
    ArrayList<TType> interfaceCandidates = null;
    for (Iterator<TType> iter = lowerBound.iterator(); iter.hasNext(); ) {
      TType type = iter.next();
      if (!type.isInterface()) {
        return type;
      } else {
        if (interfaceCandidates == null) interfaceCandidates = new ArrayList<TType>(2);
        interfaceCandidates.add(type);
      }
    }

    if (interfaceCandidates == null || interfaceCandidates.size() == 0) {
      return null;
    } else if (interfaceCandidates.size() == 1) {
      return interfaceCandidates.get(0);
    } else {
      ArrayList<TType> nontaggingCandidates = getNonTaggingInterfaces(interfaceCandidates);
      if (nontaggingCandidates.size() != 0) {
        return Collections.min(nontaggingCandidates, TTypeComparator.INSTANCE);
      } else {
        return Collections.min(interfaceCandidates, TTypeComparator.INSTANCE);
      }
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:35,代码来源:InferTypeArgumentsConstraintsSolver.java

示例5: createInitialEstimate

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet; //导入依赖的package包/类
private TypeSet createInitialEstimate(ConstraintVariable2 cv) {
		// TODO: check assumption: only immutable CVs have a type
//		ParametricStructure parametricStructure= fElemStructureEnv.elemStructure(cv);
//		if (parametricStructure != null && parametricStructure != ParametricStructureComputer.ParametricStructure.NONE) {
//			return SubTypesOfSingleton.create(parametricStructure.getBase());
//		}

		TType type= cv.getType();
		if (type == null) {
			return fTypeSetEnvironment.getUniverseTypeSet();

		} else if (cv instanceof IndependentTypeVariable2) {
			return fTypeSetEnvironment.getUniverseTypeSet();
			//TODO: solve problem with recursive bounds
//			TypeVariable tv= (TypeVariable) type;
//			TType[] bounds= tv.getBounds();
//			TypeSet result= SubTypesOfSingleton.create(bounds[0].getErasure());
//			for (int i= 1; i < bounds.length; i++) {
//				result= result.intersectedWith(SubTypesOfSingleton.create(bounds[i].getErasure()));
//			}
//			return result;

		} else if (cv instanceof ArrayTypeVariable2) {
			return fTypeSetEnvironment.getUniverseTypeSet();
		} else if (cv instanceof ArrayElementVariable2) {
			if (cv.getType() != null && cv.getType().isTypeVariable()) {
				return fTypeSetEnvironment.getUniverseTypeSet();
			} else {
				return new SingletonTypeSet(type, fTypeSetEnvironment);
			}

		} else if (type.isVoidType()) {
			return fTypeSetEnvironment.getEmptyTypeSet();
		} else {
			return new SingletonTypeSet(type, fTypeSetEnvironment);
		}
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:38,代码来源:InferTypeArgumentsConstraintsSolver.java

示例6: chooseSingleType

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet; //导入依赖的package包/类
private TType chooseSingleType(TypeSet typeEstimate) {
	if (typeEstimate.isUniverse() || typeEstimate.isEmpty()) {
		return null;

	} else if (typeEstimate.hasUniqueLowerBound()) {
		return typeEstimate.uniqueLowerBound();

	} else {
		EnumeratedTypeSet lowerBound= typeEstimate.lowerBound().enumerate();
		ArrayList<TType> interfaceCandidates= null;
		for (Iterator<TType> iter= lowerBound.iterator(); iter.hasNext();) {
			TType type= iter.next();
			if (! type.isInterface()) {
				return type;
			} else {
				if (interfaceCandidates == null)
					interfaceCandidates= new ArrayList<TType>(2);
				interfaceCandidates.add(type);
			}
		}

		if (interfaceCandidates == null || interfaceCandidates.size() == 0) {
			return null;
		} else if (interfaceCandidates.size() == 1) {
			return interfaceCandidates.get(0);
		} else {
			ArrayList<TType> nontaggingCandidates= getNonTaggingInterfaces(interfaceCandidates);
			if (nontaggingCandidates.size() != 0) {
				return Collections.min(nontaggingCandidates, TTypeComparator.INSTANCE);
			} else {
				return Collections.min(interfaceCandidates, TTypeComparator.INSTANCE);
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:36,代码来源:InferTypeArgumentsConstraintsSolver.java

示例7: clearGlobalState

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet; //导入依赖的package包/类
private void clearGlobalState() {
  TypeSet.resetCount();
  EnumeratedTypeSet.resetCount();
  fTCModel = null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:6,代码来源:InferTypeArgumentsRefactoring.java

示例8: clearGlobalState

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet; //导入依赖的package包/类
private void clearGlobalState() {
	TypeSet.resetCount();
	EnumeratedTypeSet.resetCount();
	fTCModel= null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:6,代码来源:InferTypeArgumentsRefactoring.java


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