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


Java TTypes.canAssignTo方法代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TTypes.canAssignTo方法的典型用法代码示例。如果您正苦于以下问题:Java TTypes.canAssignTo方法的具体用法?Java TTypes.canAssignTo怎么用?Java TTypes.canAssignTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TTypes的用法示例。


在下文中一共展示了TTypes.canAssignTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: contains

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TTypes; //导入方法依赖的package包/类
@Override
public boolean contains(TType t) {
  if (t.equals(getJavaLangObject())) return true;
  if (!(t instanceof ArrayType)) return false;

  ArrayType at = (ArrayType) t;
  TType atElemType = at.getComponentType();

  if (fElemTypeSet.contains(atElemType)) // try to avoid enumeration
  return true;

  for (Iterator<TType> iter = fElemTypeSet.iterator(); iter.hasNext(); ) {
    TType elemType = iter.next();

    if (TTypes.canAssignTo(elemType, atElemType)) return true;
  }
  return false;
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:ArraySuperTypeSet.java

示例2: lowerBound

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TTypes; //导入方法依赖的package包/类
@Override
public TypeSet lowerBound() {
  if (fLHS.hasUniqueLowerBound() && fRHS.hasUniqueLowerBound()) {
    TType lhsBound = fLHS.uniqueLowerBound();
    TType rhsBound = fRHS.uniqueLowerBound();

    if (lhsBound.equals(rhsBound)) return new SingletonTypeSet(lhsBound, getTypeSetEnvironment());
    else if (TTypes.canAssignTo(lhsBound, rhsBound))
      return new SingletonTypeSet(rhsBound, getTypeSetEnvironment());
    else if (TTypes.canAssignTo(rhsBound, lhsBound))
      return new SingletonTypeSet(lhsBound, getTypeSetEnvironment());
  }
  if (fEnumCache != null) return fEnumCache.lowerBound();

  EnumeratedTypeSet lhsSet = fLHS.enumerate();
  EnumeratedTypeSet rhsSet = fRHS.enumerate();
  TypeSet xsect = lhsSet.intersectedWith(rhsSet);

  return xsect.lowerBound();
}
 
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:TypeSetIntersection.java

示例3: contains

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TTypes; //导入方法依赖的package包/类
@Override
public boolean contains(TType t) {
  if (fEnumCache != null) return fEnumCache.contains(t);

  if (fUpperBounds.contains(t)) return true;

  // Find the "upper frontier", i.e. the upper bound, and see whether
  // the given type is a subtype of any of those.
  Iterator<TType> ubIter = fUpperBounds.upperBound().iterator();

  for (; ubIter.hasNext(); ) {
    TType ub = ubIter.next();

    if (TTypes.canAssignTo(t, ub)) return true;
  }
  return false;
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:SubTypesSet.java

示例4: containsAll

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TTypes; //导入方法依赖的package包/类
@Override
public boolean containsAll(TypeSet s) {
  if (fEnumCache != null) return fEnumCache.containsAll(s);

  if (fUpperBounds.containsAll(s)) return true;

  // Make sure all elements of s are contained in this set
  for (Iterator<TType> sIter = s.iterator(); sIter.hasNext(); ) {
    TType t = sIter.next();
    boolean found = false;

    // Scan the "upper frontier", i.e. the upper bound set, and see whether
    // 't' is a subtype of any of those.
    for (Iterator<TType> ubIter = fUpperBounds /*.upperBound() */.iterator();
        ubIter.hasNext(); ) {
      TType ub = ubIter.next();

      if (TTypes.canAssignTo(t, ub)) {
        found = true;
        break;
      }
    }
    if (!found) return false;
  }
  return true;
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:SubTypesSet.java

示例5: contains

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TTypes; //导入方法依赖的package包/类
@Override
public boolean contains(TType t) {
  if (fEnumCache != null) return fEnumCache.contains(t);

  if (t.equals(getJavaLangObject())) return true;
  if (fLowerBounds.contains(t)) return true;

  // Find the "lower frontier", i.e. the lower bound, and see whether
  // the given type is a supertype of any of those.
  for (Iterator<TType> lbIter = fLowerBounds /*.lowerBound() */.iterator(); lbIter.hasNext(); ) {
    TType lb = lbIter.next();

    if (TTypes.canAssignTo(lb, t)) return true;
  }
  return false;
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:SuperTypesSet.java

示例6: contains

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TTypes; //导入方法依赖的package包/类
@Override
public boolean contains(TType t) {
	if (t.equals(getJavaLangObject())) return true;
	if (!(t instanceof ArrayType))
		return false;

	ArrayType at= (ArrayType) t;
	TType atElemType= at.getComponentType();

	if (fElemTypeSet.contains(atElemType)) // try to avoid enumeration
		return true;

	for(Iterator<TType> iter= fElemTypeSet.iterator(); iter.hasNext(); ) {
		TType elemType= iter.next();

		if (TTypes.canAssignTo(elemType, atElemType))
			return true;
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:ArraySuperTypeSet.java

示例7: lowerBound

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TTypes; //导入方法依赖的package包/类
@Override
public TypeSet lowerBound() {
	if (fLHS.hasUniqueLowerBound() && fRHS.hasUniqueLowerBound()) {
		TType lhsBound= fLHS.uniqueLowerBound();
		TType rhsBound= fRHS.uniqueLowerBound();

		if (lhsBound.equals(rhsBound))
			return new SingletonTypeSet(lhsBound, getTypeSetEnvironment());
		else if (TTypes.canAssignTo(lhsBound, rhsBound))
			return new SingletonTypeSet(rhsBound, getTypeSetEnvironment());
		else if (TTypes.canAssignTo(rhsBound, lhsBound))
			return new SingletonTypeSet(lhsBound, getTypeSetEnvironment());
	}
	if (fEnumCache != null) return fEnumCache.lowerBound();

	EnumeratedTypeSet lhsSet= fLHS.enumerate();
	EnumeratedTypeSet rhsSet= fRHS.enumerate();
	TypeSet xsect= lhsSet.intersectedWith(rhsSet);

	return xsect.lowerBound();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:TypeSetIntersection.java

示例8: contains

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TTypes; //导入方法依赖的package包/类
@Override
public boolean contains(TType t) {
	if (fEnumCache != null) return fEnumCache.contains(t);

	if (fUpperBounds.contains(t))
		return true;

	// Find the "upper frontier", i.e. the upper bound, and see whether
	// the given type is a subtype of any of those.
	Iterator<TType> ubIter= fUpperBounds.upperBound().iterator();

	for(; ubIter.hasNext(); ) {
		TType ub= ubIter.next();

		if (TTypes.canAssignTo(t, ub))
			return true;
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:SubTypesSet.java

示例9: containsAll

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TTypes; //导入方法依赖的package包/类
@Override
public boolean containsAll(TypeSet s) {
	if (fEnumCache != null) return fEnumCache.containsAll(s);

	if (fUpperBounds.containsAll(s))
		return true;

	// Make sure all elements of s are contained in this set
	for(Iterator<TType> sIter= s.iterator(); sIter.hasNext(); ) {
		TType t= sIter.next();
		boolean found= false;

		// Scan the "upper frontier", i.e. the upper bound set, and see whether
		// 't' is a subtype of any of those.
		for(Iterator<TType> ubIter= fUpperBounds /*.upperBound() */.iterator(); ubIter.hasNext(); ) {
			TType ub= ubIter.next();

			if (TTypes.canAssignTo(t, ub)) {
				found= true;
				break;
			}
		}
		if (!found) return false;
	}
	return true;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:SubTypesSet.java

示例10: contains

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TTypes; //导入方法依赖的package包/类
@Override
public boolean contains(TType t) {
	if (fEnumCache != null) return fEnumCache.contains(t);

	if (t.equals(getJavaLangObject()))
		return true;
	if (fLowerBounds.contains(t))
		return true;

	// Find the "lower frontier", i.e. the lower bound, and see whether
	// the given type is a supertype of any of those.
	for(Iterator<TType> lbIter= fLowerBounds /*.lowerBound() */.iterator(); lbIter.hasNext(); ) {
		TType lb= lbIter.next();

		if (TTypes.canAssignTo(lb, t))
			return true;
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:SuperTypesSet.java

示例11: findCastsToRemove

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TTypes; //导入方法依赖的package包/类
private void findCastsToRemove(CastVariable2[] castVariables) {
  for (int i = 0; i < castVariables.length; i++) {
    CastVariable2 castCv = castVariables[i];
    ConstraintVariable2 expressionVariable = castCv.getExpressionVariable();
    TType chosenType = InferTypeArgumentsConstraintsSolver.getChosenType(expressionVariable);
    TType castType = castCv.getType();
    TType expressionType = expressionVariable.getType();
    if (chosenType != null && TTypes.canAssignTo(chosenType, castType)) {
      if (chosenType.equals(expressionType))
        continue; // The type has not changed. Don't remove the cast, since it could be
      // there to get access to default-visible members or to
      // unify types of conditional expressions.
      fUpdate.addCastToRemove(castCv);

    } else if (expressionVariable instanceof ArrayTypeVariable2
        && castType.isArrayType()) { // bug 97258
      ArrayElementVariable2 arrayElementCv = fTCModel.getArrayElementVariable(expressionVariable);
      if (arrayElementCv == null) continue;
      TType chosenArrayElementType =
          InferTypeArgumentsConstraintsSolver.getChosenType(arrayElementCv);
      if (chosenArrayElementType != null
          && TTypes.canAssignTo(
              chosenArrayElementType, ((ArrayType) castType).getComponentType())) {
        if (expressionType instanceof ArrayType
            && chosenArrayElementType.equals(((ArrayType) expressionType).getComponentType()))
          continue; // The type has not changed. Don't remove the cast, since it could be
        // there to unify types of conditional expressions.
        fUpdate.addCastToRemove(castCv);
      }
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:33,代码来源:InferTypeArgumentsConstraintsSolver.java

示例12: specialCasesIntersectedWith

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TTypes; //导入方法依赖的package包/类
@Override
protected TypeSet specialCasesIntersectedWith(TypeSet other) {
  if (other.isSingleton() && other.anyMember().equals(fLowerBound))
    return other; // xsect(superTypes(A),A) = A

  if (other instanceof SuperTypesOfSingleton) {
    SuperTypesOfSingleton otherSuper = (SuperTypesOfSingleton) other;

    if (TTypes.canAssignTo(otherSuper.fLowerBound, fLowerBound)) return this;
    if (TTypes.canAssignTo(fLowerBound, otherSuper.fLowerBound)) return otherSuper;
  } else if (other.hasUniqueUpperBound()) {
    TType otherUpper = other.uniqueUpperBound();

    if (otherUpper.equals(fLowerBound))
      return new SingletonTypeSet(fLowerBound, getTypeSetEnvironment());
    if ((otherUpper != fLowerBound && TTypes.canAssignTo(otherUpper, fLowerBound))
        || !TTypes.canAssignTo(fLowerBound, otherUpper))
      return getTypeSetEnvironment().getEmptyTypeSet();
  }
  //		else if (other instanceof SuperTypesSet) {
  //			SuperTypesSet otherSub= (SuperTypesSet) other;
  //			TypeSet otherLowers= otherSub.lowerBound();
  //
  //			for(Iterator iter= otherLowers.iterator(); iter.hasNext(); ) {
  //				TType t= (TType) iter.next();
  //
  //				if ()
  //			}
  //		}
  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:32,代码来源:SuperTypesOfSingleton.java

示例13: specialCasesIntersectedWith

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TTypes; //导入方法依赖的package包/类
@Override
public TypeSet specialCasesIntersectedWith(TypeSet other) {
  if (other.isSingleton() && other.anyMember().equals(fUpperBound))
    return other; // xsect(subTypes(A),A) = A

  if (other instanceof SubTypesOfSingleton) {
    SubTypesOfSingleton otherSub = (SubTypesOfSingleton) other;

    if (TTypes.canAssignTo(otherSub.fUpperBound, fUpperBound)) return otherSub; // .makeClone();
    if (TTypes.canAssignTo(fUpperBound, otherSub.fUpperBound)) return this; // makeClone();
  } else if (other.hasUniqueLowerBound()) {
    TType otherLower = other.uniqueLowerBound();

    if (otherLower.equals(fUpperBound))
      return new SingletonTypeSet(fUpperBound, getTypeSetEnvironment());
    if (otherLower != fUpperBound && TTypes.canAssignTo(fUpperBound, otherLower)
        || !TTypes.canAssignTo(otherLower, fUpperBound))
      return getTypeSetEnvironment().getEmptyTypeSet();
  }
  //		else if (other instanceof SubTypesSet) {
  //			SubTypesSet otherSub= (SubTypesSet) other;
  //			TypeSet otherUppers= otherSub.upperBound();
  //
  //			for(Iterator iter= otherUppers.iterator(); iter.hasNext(); ) {
  //				TType t= (TType) iter.next();
  //
  //				if ()
  //			}
  //		}
  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:32,代码来源:SubTypesOfSingleton.java

示例14: containsAll

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TTypes; //导入方法依赖的package包/类
@Override
public boolean containsAll(TypeSet s) {
  if (fEnumCache != null) return fEnumCache.containsAll(s);

  if (!isUniverse()
      && s.isUniverse()) // this is more general than just SuperTypesSet; probably belongs in
    // TypeSet
    return false;
  if (equals(s)) return true;
  if (fLowerBounds.containsAll(s)) return true;

  // Make sure all elements of s are contained in this set
  for (Iterator<TType> sIter = s.iterator(); sIter.hasNext(); ) {
    TType t = sIter.next();
    boolean found = false;

    // Scan the "lower frontier", i.e. the lower bound set, and see whether
    // 't' is a supertype of any of those.
    for (Iterator<TType> lbIter = fLowerBounds /*.lowerBound()*/.iterator(); lbIter.hasNext(); ) {
      TType lb = lbIter.next();

      if (TTypes.canAssignTo(lb, t)) {
        found = true;
        break;
      }
    }
    if (!found) return false;
  }
  return true;
}
 
开发者ID:eclipse,项目名称:che,代码行数:31,代码来源:SuperTypesSet.java

示例15: findCastsToRemove

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TTypes; //导入方法依赖的package包/类
private void findCastsToRemove(CastVariable2[] castVariables) {
	for (int i= 0; i < castVariables.length; i++) {
		CastVariable2 castCv= castVariables[i];
		ConstraintVariable2 expressionVariable= castCv.getExpressionVariable();
		TType chosenType= InferTypeArgumentsConstraintsSolver.getChosenType(expressionVariable);
		TType castType= castCv.getType();
		TType expressionType= expressionVariable.getType();
		if (chosenType != null && TTypes.canAssignTo(chosenType, castType)) {
			if (chosenType.equals(expressionType))
				continue; // The type has not changed. Don't remove the cast, since it could be
						   // there to get access to default-visible members or to
						   // unify types of conditional expressions.
			fUpdate.addCastToRemove(castCv);

		} else if (expressionVariable instanceof ArrayTypeVariable2 && castType.isArrayType()) { // bug 97258
			ArrayElementVariable2 arrayElementCv= fTCModel.getArrayElementVariable(expressionVariable);
			if (arrayElementCv == null)
				continue;
			TType chosenArrayElementType= InferTypeArgumentsConstraintsSolver.getChosenType(arrayElementCv);
			if (chosenArrayElementType != null && TTypes.canAssignTo(chosenArrayElementType, ((ArrayType) castType).getComponentType())) {
				if (expressionType instanceof ArrayType && chosenArrayElementType.equals(((ArrayType) expressionType).getComponentType()))
					continue; // The type has not changed. Don't remove the cast, since it could be
							   // there to unify types of conditional expressions.
				fUpdate.addCastToRemove(castCv);
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:29,代码来源:InferTypeArgumentsConstraintsSolver.java


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