/* (non-Javadoc) * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#enumerate() */ public EnumeratedTypeSet enumerate() { if (fEnumCache == null) { EnumeratedTypeSet lhsSet = fLHS.enumerate(); EnumeratedTypeSet rhsSet = fRHS.enumerate(); fEnumCache = lhsSet.intersectedWith(rhsSet).enumerate(); } return fEnumCache; }
/* (non-Javadoc) * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#upperBound() */ public TypeSet upperBound() { if (fLHS.contains(getJavaLangObject()) && fRHS.contains(getJavaLangObject())) return new SingletonTypeSet( getTypeSetEnvironment().getJavaLangObject(), getTypeSetEnvironment()); if (fEnumCache != null) return fEnumCache.upperBound(); EnumeratedTypeSet lhsSet = fLHS.enumerate(); EnumeratedTypeSet rhsSet = fRHS.enumerate(); TypeSet xsect = lhsSet.intersectedWith(rhsSet); return xsect.upperBound(); }
/* (non-Javadoc) * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#enumerate() */ @Override public EnumeratedTypeSet enumerate() { if (fEnumCache == null) { fEnumCache = new EnumeratedTypeSet(getTypeSetEnvironment()); for (Iterator<TType> iter = fElemTypeSet.iterator(); iter.hasNext(); ) { TType t = iter.next(); fEnumCache.add(TTypes.createArrayType(t, 1)); } fEnumCache.initComplete(); } return fEnumCache; }
/* (non-Javadoc) * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#enumerate() */ @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; }
/* (non-Javadoc) * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#lowerBound() */ 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(); }