/** Returns a feature set combining all the features from {@code this} and {@code other}. */ public FeatureSet require(FeatureSet other) { if (other.number > number || (other.unsupported && !unsupported) || (other.es6Modules && !es6Modules) || (other.typeScript && !typeScript)) { return new FeatureSet( Math.max(number, other.number), unsupported || other.unsupported, es6Modules || other.es6Modules, typeScript || other.typeScript); } return this; }
/** Returns a feature set combining all the features from {@code this} and {@code newFeatures}. */ @VisibleForTesting public FeatureSet with(Set<Feature> newFeatures) { return new FeatureSet(union(features, newFeatures)); }
/** * Returns a new {@link FeatureSet} including all features of both {@code this} and {@code other}. */ public FeatureSet union(FeatureSet other) { return new FeatureSet(union(features, other.features)); }
/** Returns a feature set combining all the features from {@code this} and {@code newFeatures}. */ @VisibleForTesting public FeatureSet with(FeatureSet newFeatures) { return new FeatureSet(union(features, newFeatures.features)); }
/** Returns a feature set combining all the features from {@code this} and {@code newFeatures}. */ @VisibleForTesting public FeatureSet with(Feature... newFeatures) { return new FeatureSet(union(features, ImmutableSet.copyOf(newFeatures))); }
/** Returns a feature set combining all the features from {@code this} and {@code feature}. */ public FeatureSet with(Feature feature) { if (features.contains(feature)) { return this; } return new FeatureSet(add(features, feature)); }
public FeatureSet without(Feature featureToRemove, Feature... moreFeaturesToRemove) { return new FeatureSet(difference(features, EnumSet.of(featureToRemove, moreFeaturesToRemove))); }
public FeatureSet without(FeatureSet other) { return new FeatureSet(difference(features, other.features)); }
public FeatureSet withoutTypes() { return new FeatureSet(difference(features, LangVersion.TYPESCRIPT.features())); }