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


Java TType.isArrayType方法代码示例

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


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

示例1: findCastsToRemove

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

示例2: upperBound

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType; //导入方法依赖的package包/类
@Override
public TypeSet upperBound() {
  if (fMembers.size() == 1)
    return new SingletonTypeSet(fMembers.iterator().next(), getTypeSetEnvironment());
  if (fMembers.contains(getJavaLangObject()))
    return new SingletonTypeSet(getJavaLangObject(), getTypeSetEnvironment());

  EnumeratedTypeSet result = new EnumeratedTypeSet(getTypeSetEnvironment());

  // Add to result each element of fMembers that has no proper supertype in fMembers
  result.fMembers.addAll(fMembers);
  for (Iterator<TType> iter = fMembers.iterator(); iter.hasNext(); ) {
    TType t = iter.next();

    if (t.isArrayType()) {
      ArrayType at = (ArrayType) t;
      int numDims = at.getDimensions();
      for (Iterator<TType> subIter = TTypes.getAllSubTypesIterator(at.getElementType());
          subIter.hasNext(); ) {
        result.fMembers.remove(TTypes.createArrayType(subIter.next(), numDims));
      }
    } else {
      for (Iterator<TType> iterator = TTypes.getAllSubTypesIterator(t); iterator.hasNext(); ) {
        result.fMembers.remove(iterator.next());
      }
    }
  }
  result.initComplete();
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:31,代码来源:EnumeratedTypeSet.java


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