本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
}
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}