List of usage examples for com.google.common.collect ImmutableSortedSet of
@SuppressWarnings("unchecked") public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E e1, E e2)
From source file:org.pantsbuild.testproject.deployexcludes.DeployExcludesMain.java
public static void main(String[] args) { Set values = ImmutableSortedSet.of("Hello", "World"); System.out.println("DeployExcludes " + Joiner.on(" ").join(values)); }
From source file:com.facebook.buck.distributed.testutil.CustomActiongGraphBuilderFactory.java
public static ActionGraphBuilder createSimpleBuilder() throws NoSuchBuildTargetException { ActionGraphBuilder graphBuilder = new TestActionGraphBuilder(); ImmutableSortedSet<BuildRule> buildRules = ImmutableSortedSet.of( JavaLibraryBuilder.createBuilder(BuildTargetFactory.newInstance(ROOT_TARGET)).build(graphBuilder), JavaLibraryBuilder.createBuilder(BuildTargetFactory.newInstance("//foo:two")).build(graphBuilder)); buildRules.forEach(graphBuilder::addToIndex); return graphBuilder; }
From source file:com.facebook.buck.distributed.testutil.CustomActionGraphBuilderFactory.java
public static ActionGraphBuilder createSimpleBuilder() throws NoSuchBuildTargetException { ActionGraphBuilder graphBuilder = new TestActionGraphBuilder(); ImmutableSortedSet<BuildRule> buildRules = ImmutableSortedSet.of( FakeTargetNodeBuilder.newBuilder(BuildTargetFactory.newInstance(ROOT_TARGET)).build(graphBuilder), FakeTargetNodeBuilder.newBuilder(BuildTargetFactory.newInstance("//foo:two")).build(graphBuilder)); buildRules.forEach(graphBuilder::addToIndex); return graphBuilder; }
From source file:com.facebook.buck.cxx.CxxLibraryImplicitFlavors.java
public ImmutableSortedSet<Flavor> addImplicitFlavorsForRuleTypes(ImmutableSortedSet<Flavor> argDefaultFlavors, RuleType... types) {// www . j av a 2s. c om Optional<Flavor> typeFlavor = CxxLibraryDescription.LIBRARY_TYPE.getFlavor(argDefaultFlavors); CxxPlatformsProvider cxxPlatformsProvider = getCxxPlatformsProvider(); Optional<Flavor> platformFlavor = cxxPlatformsProvider.getUnresolvedCxxPlatforms() .getFlavor(argDefaultFlavors); LOG.debug("Got arg default type %s platform %s", typeFlavor, platformFlavor); for (RuleType type : types) { ImmutableMap<String, Flavor> libraryDefaults = cxxBuckConfig.getDefaultFlavorsForRuleType(type); if (!typeFlavor.isPresent()) { typeFlavor = Optional.ofNullable(libraryDefaults.get(CxxBuckConfig.DEFAULT_FLAVOR_LIBRARY_TYPE)); } if (!platformFlavor.isPresent()) { platformFlavor = Optional.ofNullable(libraryDefaults.get(CxxBuckConfig.DEFAULT_FLAVOR_PLATFORM)); } } ImmutableSortedSet<Flavor> result = ImmutableSortedSet.of( // Default to static if not otherwise specified. typeFlavor.orElse(CxxDescriptionEnhancer.STATIC_FLAVOR), platformFlavor.orElse(cxxPlatformsProvider.getDefaultUnresolvedCxxPlatform().getFlavor())); LOG.debug("Got default flavors %s for rule types %s", result, Arrays.toString(types)); return result; }
From source file:org.caleydo.core.util.color.AlexColorPalette.java
@Override public SortedSet<Integer> getSizes() { return ImmutableSortedSet.of(colors.get(0).size(), colors.size()); }
From source file:fi.hsl.parkandride.back.Dummies.java
@TransactionalWrite public Facility createFacility(Long operatorId, FacilityContacts contacts) { Facility facility = new Facility(); facility.id = 0L;/*from w w w .ja va2 s. c o m*/ facility.name = new MultilingualString("Facility " + uniqueNumber()); facility.location = (Polygon) Spatial.fromWkt("POLYGON((" + "25.010822 60.25054, " + "25.010822 60.250023, " + "25.012479 60.250337, " + "25.011449 60.250885, " + "25.010822 60.25054))"); facility.operatorId = operatorId; facility.status = EXCEPTIONAL_SITUATION; facility.pricingMethod = PricingMethod.CUSTOM; facility.statusDescription = new MultilingualString("Status description"); facility.aliases = ImmutableSortedSet.of("alias", "blias"); facility.ports = ImmutableList.of(new Port((Point) Spatial.fromWkt("POINT(25.010822 60.25054)"), true, false, true, false, "street", "00100", "city", "info")); facility.services = new NullSafeSortedSet<>(asList(ELEVATOR, TOILETS, ACCESSIBLE_TOILETS)); facility.contacts = contacts; facility.builtCapacity = ImmutableMap.of(CAR, 50, ELECTRIC_CAR, 2); // pricing in wrong order should be sorted on load facility.pricing.add(new Pricing(CAR, PARK_AND_RIDE, 50, SUNDAY, "8", "18", "1 EUR/H")); facility.pricing.add(new Pricing(CAR, PARK_AND_RIDE, 50, SATURDAY, "8", "18", "2 EUR/H")); facility.unavailableCapacities = Arrays.asList(new UnavailableCapacity(CAR, PARK_AND_RIDE, 1)); facility.openingHours.info = new MultilingualString("Opening Hours"); facility.openingHours.url = new MultilingualUrl("http://www.hsl.fi"); facility.paymentInfo.detail = new MultilingualString("Payment details"); facility.paymentInfo.url = new MultilingualUrl("http://www.hsl.fi"); return facility; }
From source file:com.facebook.buck.js.JsBundleDescription.java
private static JsBundleAndroid createAndroidBundle(BuildRuleParams params, BuildRuleResolver resolver, JsBundle jsBundle) throws NoSuchBuildTargetException { final BuildTarget resourceTarget = params.getBuildTarget().withAppendedFlavors(JsFlavors.ANDROID_RESOURCES); final BuildRule resource = resolver.requireRule(resourceTarget); return new JsBundleAndroid( params.copyReplacingDeclaredAndExtraDeps(ImmutableSortedSet::of, () -> ImmutableSortedSet.of(jsBundle, resource)), jsBundle, resolver.getRuleWithType(resourceTarget, AndroidResource.class)); }
From source file:com.facebook.buck.jvm.java.DefaultJavaLibraryRules.java
@Nullable private <T extends BuildRule & CalculateAbi, U extends BuildRule & CalculateAbi> CompareAbis buildCompareAbisRule( @Nullable T correctAbi, @Nullable U experimentalAbi) { if (!willProduceCompareAbis()) { return null; }//from w w w . j ava 2 s . c o m Objects.requireNonNull(correctAbi); Objects.requireNonNull(experimentalAbi); BuildTarget compareAbisTarget = JavaAbis.getVerifiedSourceAbiJar(getLibraryTarget()); return getActionGraphBuilder().addToIndex(new CompareAbis(compareAbisTarget, getProjectFilesystem(), getInitialParams().withDeclaredDeps(ImmutableSortedSet.of(correctAbi, experimentalAbi)) .withoutExtraDeps(), correctAbi.getSourcePathToOutput(), experimentalAbi.getSourcePathToOutput(), Objects.requireNonNull(getJavaBuckConfig()).getSourceAbiVerificationMode())); }
From source file:com.facebook.buck.cxx.AbstractCxxSourceRuleFactory.java
private CxxPrecompiledHeader buildPrecompiledHeaderFromPrefixHeader( PreprocessorDelegateCacheValue preprocessorDelegateCacheValue, CxxSource source, DepsBuilder depsBuilder, SourcePath headerPath) { CxxSource.Type sourceType = source.getType(); CxxToolFlags compilerFlags = computeCompilerFlags(sourceType, source.getFlags()); // Language needs to be part of the key, PCHs built under a different language are incompatible. // (Replace `c++` with `cxx`; avoid default scrubbing which would make it the cryptic `c__`.) final String langCode = sourceType.getLanguage().replaceAll("c\\+\\+", "cxx"); final String pchBaseID = "pch-" + langCode + "-" + preprocessorDelegateCacheValue.getBaseHash(compilerFlags); final String pchFullID = pchBaseID + "-" + preprocessorDelegateCacheValue.getFullHash(compilerFlags); return buildPrecompiledHeader(preprocessorDelegateCacheValue.getPreprocessorDelegate(), sourceType, compilerFlags, headerPath, depsBuilder, getParams().getBuildTarget().getUnflavoredBuildTarget(), ImmutableSortedSet.of(getCxxPlatform().getFlavor(), ImmutableFlavor.of(Flavor.replaceInvalidCharacters(pchFullID)))); }
From source file:com.facebook.buck.cxx.AbstractCxxSourceRuleFactory.java
/** * Build a PCH rule, given a {@code cxx_precompiled_header} rule. * * <p>// ww w . ja v a2 s .c om * We'll "instantiate" this PCH from this template, using the parameters (src, dependencies) * from the template itself, plus the build flags that are used in the current build rule * (so that this instantiated version uses compatible build flags and thus the PCH is guaranteed * usable with this rule). * </p> */ private CxxPrecompiledHeader buildPrecompiledHeaderFromTemplateRule( PreprocessorDelegateCacheValue preprocessorDelegateCacheValue, CxxSource source, DepsBuilder depsBuilder, SourcePath headerTargetPath) { PreprocessorDelegate preprocessorDelegate = preprocessorDelegateCacheValue.getPreprocessorDelegate(); CxxToolFlags compilerFlags = CxxToolFlags.concat( preprocessorDelegate.getNonIncludePathFlags(/* no pch */ Optional.empty()), computeCompilerFlags(source.getType(), source.getFlags())); BuildTarget pchTemplateTarget = ((BuildTargetSourcePath) headerTargetPath).getTarget(); Optional<CxxPrecompiledHeaderTemplate> pchTemplateRuleOpt = getResolver() .getRuleOptionalWithType(pchTemplateTarget, CxxPrecompiledHeaderTemplate.class); Preconditions.checkState(pchTemplateRuleOpt.isPresent()); CxxPrecompiledHeaderTemplate pchTemplate = pchTemplateRuleOpt.get(); SourcePath headerPath = pchTemplate.sourcePath; // Language needs to be part of the key, PCHs built under a different language are incompatible. // (Replace `c++` with `cxx`; avoid default scrubbing which would make it the cryptic `c__`.) final String langCode = source.getType().getLanguage().replaceAll("c\\+\\+", "cxx"); final String pchBaseID = "pch-" + langCode + "-" + preprocessorDelegateCacheValue.getBaseHash(compilerFlags); for (BuildRule rule : pchTemplate.getDeps()) { depsBuilder.add(rule); } return buildPrecompiledHeader(preprocessorDelegateCacheValue.getPreprocessorDelegate(), source.getType(), compilerFlags, headerPath, depsBuilder, pchTemplateTarget.getUnflavoredBuildTarget(), ImmutableSortedSet.of(getCxxPlatform().getFlavor(), ImmutableFlavor.of(Flavor.replaceInvalidCharacters(pchBaseID)))); }