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


Java ArrayType类代码示例

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


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

示例1: contains

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

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.ArrayType; //导入依赖的package包/类
@Override
public EnumeratedTypeSet enumerate() {
  if (fEnumCache == null) {
    if (fLowerBound instanceof ArrayType) {
      ArrayType at = (ArrayType) fLowerBound;
      fEnumCache =
          EnumeratedTypeSet.makeArrayTypesForElements(
              TTypes.getAllSuperTypesIterator(at.getComponentType()), getTypeSetEnvironment());
      fEnumCache.add(getJavaLangObject());
    } else
      fEnumCache =
          new EnumeratedTypeSet(
              TTypes.getAllSuperTypesIterator(fLowerBound), getTypeSetEnvironment());

    fEnumCache.add(fLowerBound);
    fEnumCache.initComplete();
  }
  return fEnumCache;
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:SuperTypesOfSingleton.java

示例3: enumerate

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.ArrayType; //导入依赖的package包/类
@Override
public EnumeratedTypeSet enumerate() {
  if (fEnumCache == null) {
    fEnumCache = new EnumeratedTypeSet(getTypeSetEnvironment());

    for (Iterator<TType> iter = fUpperBounds.iterator(); iter.hasNext(); ) {
      TType ub = iter.next();

      if (ub instanceof ArrayType) {
        ArrayType at = (ArrayType) ub;
        int numDims = at.getDimensions();
        for (Iterator<TType> elemSubIter = TTypes.getAllSubTypesIterator(at.getElementType());
            elemSubIter.hasNext(); )
          fEnumCache.add(TTypes.createArrayType(elemSubIter.next(), numDims));
      } else {
        for (Iterator<TType> iterator = TTypes.getAllSubTypesIterator(ub); iterator.hasNext(); ) {
          fEnumCache.fMembers.add(iterator.next());
        }
      }
      fEnumCache.add(ub);
    }
    //			fEnumCache.initComplete();
  }
  return fEnumCache;
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:SubTypesSet.java

示例4: enumerate

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.ArrayType; //导入依赖的package包/类
@Override
public EnumeratedTypeSet enumerate() {
  if (fEnumCache == null) {
    if (fUpperBound instanceof ArrayType) {
      ArrayType at = (ArrayType) fUpperBound;
      fEnumCache =
          EnumeratedTypeSet.makeArrayTypesForElements(
              TTypes.getAllSubTypesIterator(at.getComponentType()), getTypeSetEnvironment());
    } else
      fEnumCache =
          new EnumeratedTypeSet(
              TTypes.getAllSubTypesIterator(fUpperBound), getTypeSetEnvironment());

    fEnumCache.add(fUpperBound);
    fEnumCache.initComplete();
  }
  return fEnumCache;
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:SubTypesOfSingleton.java

示例5: contains

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

示例6: enumerate

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.ArrayType; //导入依赖的package包/类
@Override
	public EnumeratedTypeSet enumerate() {
		if (fEnumCache == null) {
			fEnumCache= new EnumeratedTypeSet(getTypeSetEnvironment());

			for(Iterator<TType> iter= fUpperBounds.iterator(); iter.hasNext(); ) {
				TType ub= iter.next();

				if (ub instanceof ArrayType) {
					ArrayType at= (ArrayType) ub;
					int numDims= at.getDimensions();
					for(Iterator<TType> elemSubIter=TTypes.getAllSubTypesIterator(at.getElementType()); elemSubIter.hasNext(); )
						fEnumCache.add(TTypes.createArrayType(elemSubIter.next(), numDims));
				} else {
					for (Iterator<TType> iterator= TTypes.getAllSubTypesIterator(ub); iterator.hasNext();) {
						fEnumCache.fMembers.add(iterator.next());
					}
				}
				fEnumCache.add(ub);
			}
//			fEnumCache.initComplete();
		}
		return fEnumCache;
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:SubTypesSet.java

示例7: enumerate

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.ArrayType; //导入依赖的package包/类
@Override
public EnumeratedTypeSet enumerate() {
	if (fEnumCache == null) {
		fEnumCache= new EnumeratedTypeSet(getTypeSetEnvironment());
		boolean anyLBIsIntfOrArray= false;

		for(Iterator<TType> iter= fLowerBounds.iterator(); iter.hasNext(); ) {
			TType lb= iter.next();

			if (lb instanceof ArrayType) {
				ArrayType at= (ArrayType) lb;
				int numDims= at.getDimensions();
				for(Iterator<TType> elemSuperIter=TTypes.getAllSuperTypesIterator(at.getElementType()); elemSuperIter.hasNext(); )
					fEnumCache.add(TTypes.createArrayType(elemSuperIter.next(), numDims));
				anyLBIsIntfOrArray= true;
			} else {
				for (Iterator<TType> iterator= TTypes.getAllSuperTypesIterator(lb); iterator.hasNext(); )
				fEnumCache.fMembers.add(iterator.next());
			}
			fEnumCache.add(lb);
		}
		if (anyLBIsIntfOrArray) fEnumCache.add(getJavaLangObject());
		//fEnumCache.initComplete();
	}
	return fEnumCache;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:SuperTypesSet.java

示例8: makeArrayTypeVariable

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.ArrayType; //导入依赖的package包/类
private ArrayTypeVariable2 makeArrayTypeVariable(ArrayType type) {
  ArrayTypeVariable2 cv = new ArrayTypeVariable2(type);
  ArrayTypeVariable2 storedCv = (ArrayTypeVariable2) storedCv(cv);
  if (cv == storedCv) {
    fCuScopedConstraintVariables.add(storedCv);
    makeArrayElementVariable(storedCv);
    if (fStoreToString)
      storedCv.setData(
          ConstraintVariable2.TO_STRING,
          "ArrayType(" + type.getPrettySignature() + ")"); // $NON-NLS-1$ //$NON-NLS-2$
  }
  return storedCv;
}
 
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:InferTypeArgumentsTCModel.java

示例9: findCastsToRemove

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

示例10: enumerate

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.ArrayType; //导入依赖的package包/类
@Override
public EnumeratedTypeSet enumerate() {
  if (fEnumCache == null) {
    fEnumCache = new EnumeratedTypeSet(getTypeSetEnvironment());
    boolean anyLBIsIntfOrArray = false;

    for (Iterator<TType> iter = fLowerBounds.iterator(); iter.hasNext(); ) {
      TType lb = iter.next();

      if (lb instanceof ArrayType) {
        ArrayType at = (ArrayType) lb;
        int numDims = at.getDimensions();
        for (Iterator<TType> elemSuperIter = TTypes.getAllSuperTypesIterator(at.getElementType());
            elemSuperIter.hasNext(); )
          fEnumCache.add(TTypes.createArrayType(elemSuperIter.next(), numDims));
        anyLBIsIntfOrArray = true;
      } else {
        for (Iterator<TType> iterator = TTypes.getAllSuperTypesIterator(lb); iterator.hasNext(); )
          fEnumCache.fMembers.add(iterator.next());
      }
      fEnumCache.add(lb);
    }
    if (anyLBIsIntfOrArray) fEnumCache.add(getJavaLangObject());
    // fEnumCache.initComplete();
  }
  return fEnumCache;
}
 
开发者ID:eclipse,项目名称:che,代码行数:28,代码来源:SuperTypesSet.java

示例11: upperBound

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

示例12: lowerBound

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

  EnumeratedTypeSet result = new EnumeratedTypeSet(getTypeSetEnvironment());

  // Add to result each element of fMembers that has no proper subtype in fMembers
  result.fMembers.addAll(fMembers);

  for (Iterator<TType> iter = fMembers.iterator(); iter.hasNext(); ) {
    TType t = iter.next();

    // java.lang.Object is only in the lower bound if fMembers consists
    // of only java.lang.Object, but that case is handled above.
    if (t.equals(getJavaLangObject())) {
      result.fMembers.remove(t);
      continue;
    }

    if (t instanceof ArrayType) {
      ArrayType at = (ArrayType) t;
      int numDims = at.getDimensions();
      for (Iterator<TType> superIter = TTypes.getAllSuperTypesIterator(at.getElementType());
          superIter.hasNext(); ) {
        result.fMembers.remove(TTypes.createArrayType(superIter.next(), numDims));
      }
    } else {
      for (Iterator<TType> iterator = TTypes.getAllSuperTypesIterator(t); iterator.hasNext(); ) {
        result.fMembers.remove(iterator.next());
      }
    }
  }
  if (result.size() > 0) return result;
  else return getTypeSetEnvironment().getEmptyTypeSet();
}
 
开发者ID:eclipse,项目名称:che,代码行数:37,代码来源:EnumeratedTypeSet.java

示例13: makeArrayTypeVariable

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.ArrayType; //导入依赖的package包/类
private ArrayTypeVariable2 makeArrayTypeVariable(ArrayType type) {
	ArrayTypeVariable2 cv= new ArrayTypeVariable2(type);
	ArrayTypeVariable2 storedCv= (ArrayTypeVariable2) storedCv(cv);
	if (cv == storedCv) {
		fCuScopedConstraintVariables.add(storedCv);
		makeArrayElementVariable(storedCv);
		if (fStoreToString)
			storedCv.setData(ConstraintVariable2.TO_STRING, "ArrayType(" + type.getPrettySignature() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
	}
	return storedCv;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:InferTypeArgumentsTCModel.java

示例14: findCastsToRemove

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

示例15: enumerate

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.ArrayType; //导入依赖的package包/类
@Override
public EnumeratedTypeSet enumerate() {
	if (fEnumCache == null) {
		if (fLowerBound instanceof ArrayType) {
			ArrayType at= (ArrayType) fLowerBound;
			fEnumCache= EnumeratedTypeSet.makeArrayTypesForElements(TTypes.getAllSuperTypesIterator(at.getComponentType()), getTypeSetEnvironment());
			fEnumCache.add(getJavaLangObject());
		} else
			fEnumCache= new EnumeratedTypeSet(TTypes.getAllSuperTypesIterator(fLowerBound), getTypeSetEnvironment());

		fEnumCache.add(fLowerBound);
		fEnumCache.initComplete();
	}
	return fEnumCache;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:SuperTypesOfSingleton.java


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