List of usage examples for com.google.common.collect Multimap putAll
boolean putAll(@Nullable K key, Iterable<? extends V> values);
From source file:com.palantir.atlasdb.sweep.SweepTaskRunner.java
private Multimap<Cell, Long> getCellTsPairsToSweep(Multimap<Cell, Long> cellTsMappings, PeekingIterator<RowResult<Value>> values, long sweepTimestamp, SweepStrategy sweepStrategy, @Output Set<Cell> sentinelsToAdd) { Multimap<Cell, Long> cellTsMappingsToSweep = HashMultimap.create(); Map<Long, Long> startTsToCommitTs = transactionService.get(cellTsMappings.values()); for (Map.Entry<Cell, Collection<Long>> entry : cellTsMappings.asMap().entrySet()) { Cell cell = entry.getKey();// w ww . j av a 2 s. c om Collection<Long> timestamps = entry.getValue(); boolean sweepLastCommitted = isLatestValueEmpty(cell, values); Iterable<? extends Long> timestampsToSweep = getTimestampsToSweep(cell, timestamps, startTsToCommitTs, sentinelsToAdd, sweepTimestamp, sweepLastCommitted, sweepStrategy); cellTsMappingsToSweep.putAll(entry.getKey(), timestampsToSweep); } return cellTsMappingsToSweep; }
From source file:org.summer.ss.core.dispatch.DispatchingSupport.java
public Multimap<JvmOperation, JvmOperation> getDispatcher2dispatched(XtendClass clazz, boolean isLocalOnly) { final JvmGenericType type = associations.getInferredType(clazz); Multimap<Pair<String, Integer>, JvmOperation> dispatchMethods = LinkedHashMultimap.create(); collectDispatchMethods(type, dispatchMethods); Multimap<JvmOperation, JvmOperation> dispatcher2dispatched = LinkedHashMultimap.create(); for (final Pair<String, Integer> signature : dispatchMethods.keySet()) { JvmOperation localDispatcher = findSyntheticDispatchMethod(clazz, signature); if (localDispatcher != null) { Iterable<JvmOperation> dispatched = dispatchMethods.get(signature); if (isLocalOnly) dispatched = filter(dispatched, new Predicate<JvmOperation>() { public boolean apply(JvmOperation input) { return input.getDeclaringType() == type; }/*w w w. j a va 2s.c o m*/ }); dispatcher2dispatched.putAll(localDispatcher, dispatched); } else if (!isLocalOnly) { Iterator<JvmOperation> iterator = filter(filter(type.getAllFeatures(), JvmOperation.class), new Predicate<JvmOperation>() { public boolean apply(JvmOperation input) { return visibilityService.isVisible(input, type) && input.getParameters().size() == signature.getSecond() && input.getSimpleName().equals(signature.getFirst()); } }).iterator(); if (iterator.hasNext()) { dispatcher2dispatched.putAll(iterator.next(), dispatchMethods.get(signature)); } } } return dispatcher2dispatched; }
From source file:org.sosy_lab.cpachecker.cpa.value.symbolic.refiner.delegation.SymbolicPrecisionRefinementStrategy.java
@Override protected void finishRefinementOfPath(ARGState pUnreachableState, List<ARGState> pAffectedStates, ARGReachedSet pReached, boolean pRepeatedCounterexample) throws CPAException { final Pair<PredicatePrecision, ARGState> newPrecAndRefinementRoot = computeNewPrecision(pUnreachableState, pAffectedStates, pReached, pRepeatedCounterexample); final PredicatePrecision newPrecision = newPrecAndRefinementRoot.getFirst(); final ARGState refinementRoot = newPrecAndRefinementRoot.getSecond(); assert newPrecision.getFunctionPredicates() .isEmpty() : "Only local predicates allowed, but function predicate exists"; assert newPrecision.getGlobalPredicates() .isEmpty() : "Only local predicates allowed, but global predicate exists"; final Map<CFANode, Collection<AbstractionPredicate>> localPrec = newPrecision.getLocalPredicates().asMap(); Multimap<CFANode, MemoryLocation> valuePrecInc = HashMultimap.create(); Builder constrPrecInc = Increment.builder(); for (Map.Entry<CFANode, Collection<AbstractionPredicate>> entry : localPrec.entrySet()) { // this is actually the predecessor of a node we will use for precision adjustment CFANode currNode = entry.getKey(); Collection<MemoryLocation> locations = new HashSet<>(); for (AbstractionPredicate p : entry.getValue()) { for (String varName : formulaManager.extractVariableNames(p.getSymbolicAtom())) { String nameWithoutIndex = FormulaManagerView.parseName(varName).getFirst(); locations.add(MemoryLocation.valueOf(nameWithoutIndex)); }/*from w w w . java2 s. c o m*/ } valuePrecInc.putAll(currNode, locations); constrPrecInc.locallyTracked(currNode, (Constraint) null); // we only need the node } updateARGTree(pReached, refinementRoot, valuePrecInc, constrPrecInc.build()); }
From source file:io.redlink.sdk.impl.analysis.model.Enhancements.java
/** * Returns the best {@link EntityAnnotation}s (those with the highest confidence value) for each extracted {@link TextAnnotation} * * @return best annotations// w ww . j a v a 2s. c o m */ public Multimap<TextAnnotation, EntityAnnotation> getBestAnnotations() { Ordering<EntityAnnotation> o = new Ordering<EntityAnnotation>() { @Override public int compare(EntityAnnotation left, EntityAnnotation right) { return Doubles.compare(left.confidence, right.confidence); } }.reverse(); Multimap<TextAnnotation, EntityAnnotation> result = ArrayListMultimap.create(); for (TextAnnotation ta : getTextAnnotations()) { List<EntityAnnotation> eas = o.sortedCopy(getEntityAnnotations(ta)); if (!eas.isEmpty()) { Collection<EntityAnnotation> highest = new HashSet<>(); Double confidence = eas.get(0).getConfidence(); for (EntityAnnotation ea : eas) { if (ea.confidence < confidence) { break; } else { highest.add(ea); } } result.putAll(ta, highest); } } return result; }
From source file:org.opencms.ade.containerpage.CmsAddDialogTypeHelper.java
/** * Precomputes type lists for multiple views.<p> * * @param cms the CMS context//w w w . ja v a2 s .c o m * @param folderRootPath the current folder * @param checkViewableReferenceUri the reference uri to use for viewability check * @param views the views for which to generate the type lists * @param check object to check whether resource types should be enabled */ public void precomputeTypeLists(CmsObject cms, String folderRootPath, String checkViewableReferenceUri, List<CmsElementView> views, I_CmsResourceTypeEnabledCheck check) { Multimap<CmsUUID, CmsResourceTypeBean> result = ArrayListMultimap.create(); // Sort list to make sure that 'Other types' view is processed last, because we may need to display // types filtered / removed from other views, which we only know once we have processed these views Collections.sort(views, new Comparator<CmsElementView>() { public int compare(CmsElementView view0, CmsElementView view1) { return ComparisonChain.start().compareFalseFirst(view0.isOther(), view1.isOther()).result(); } }); for (CmsElementView view : views) { try { result.putAll(view.getId(), getResourceTypes(cms, folderRootPath, checkViewableReferenceUri, view, check)); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); } } m_cachedTypes = result; }
From source file:io.takari.maven.plugins.compile.AbstractCompileMojo.java
private Proc getEffectiveProc(List<File> classpath) { Proc proc = this.proc; if (proc == null) { Multimap<File, String> processors = TreeMultimap.create(); for (File jar : classpath) { if (jar.isFile()) { try (ZipFile zip = new ZipFile(jar)) { ZipEntry entry = zip.getEntry("META-INF/services/javax.annotation.processing.Processor"); if (entry != null) { try (Reader r = new InputStreamReader(zip.getInputStream(entry), Charsets.UTF_8)) { processors.putAll(jar, CharStreams.readLines(r)); }//from w w w . j a va 2 s. c o m } } catch (IOException e) { // ignore, compiler won't be able to use this jar either } } else if (jar.isDirectory()) { try { processors.putAll(jar, Files.readLines( new File(jar, "META-INF/services/javax.annotation.processing.Processor"), Charsets.UTF_8)); } catch (IOException e) { // ignore, compiler won't be able to use this jar either } } } if (!processors.isEmpty()) { StringBuilder msg = new StringBuilder( "<proc> must be one of 'none', 'only' or 'proc'. Processors found: "); for (File jar : processors.keySet()) { msg.append("\n ").append(jar).append(" ").append(processors.get(jar)); } throw new IllegalArgumentException(msg.toString()); } proc = Proc.none; } return proc; }
From source file:org.apache.cassandra.service.PendingRangeCalculatorService.java
/** * Calculate pending ranges according to bootsrapping and leaving nodes. Reasoning is: * * (1) When in doubt, it is better to write too much to a node than too little. That is, if * there are multiple nodes moving, calculate the biggest ranges a node could have. Cleaning * up unneeded data afterwards is better than missing writes during movement. * (2) When a node leaves, ranges for other nodes can only grow (a node might get additional * ranges, but it will not lose any of its current ranges as a result of a leave). Therefore * we will first remove _all_ leaving tokens for the sake of calculation and then check what * ranges would go where if all nodes are to leave. This way we get the biggest possible * ranges with regard current leave operations, covering all subsets of possible final range * values.//from w ww . ja v a 2 s.co m * (3) When a node bootstraps, ranges of other nodes can only get smaller. Without doing * complex calculations to see if multiple bootstraps overlap, we simply base calculations * on the same token ring used before (reflecting situation after all leave operations have * completed). Bootstrapping nodes will be added and removed one by one to that metadata and * checked what their ranges would be. This will give us the biggest possible ranges the * node could have. It might be that other bootstraps make our actual final ranges smaller, * but it does not matter as we can clean up the data afterwards. * * NOTE: This is heavy and ineffective operation. This will be done only once when a node * changes state in the cluster, so it should be manageable. */ // public & static for testing purposes public static void calculatePendingRanges(AbstractReplicationStrategy strategy, String keyspaceName) { TokenMetadata tm = StorageService.instance.getTokenMetadata(); Multimap<Range<Token>, InetAddress> pendingRanges = HashMultimap.create(); BiMultiValMap<Token, InetAddress> bootstrapTokens = tm.getBootstrapTokens(); Set<InetAddress> leavingEndpoints = tm.getLeavingEndpoints(); if (bootstrapTokens.isEmpty() && leavingEndpoints.isEmpty() && tm.getMovingEndpoints().isEmpty()) { if (logger.isDebugEnabled()) logger.debug( "No bootstrapping, leaving or moving nodes, and no relocating tokens -> empty pending ranges for {}", keyspaceName); tm.setPendingRanges(keyspaceName, pendingRanges); return; } Multimap<InetAddress, Range<Token>> addressRanges = strategy.getAddressRanges(); // Copy of metadata reflecting the situation after all leave operations are finished. TokenMetadata allLeftMetadata = tm.cloneAfterAllLeft(); // get all ranges that will be affected by leaving nodes Set<Range<Token>> affectedRanges = new HashSet<Range<Token>>(); for (InetAddress endpoint : leavingEndpoints) affectedRanges.addAll(addressRanges.get(endpoint)); // for each of those ranges, find what new nodes will be responsible for the range when // all leaving nodes are gone. TokenMetadata metadata = tm.cloneOnlyTokenMap(); // don't do this in the loop! #7758 for (Range<Token> range : affectedRanges) { Set<InetAddress> currentEndpoints = ImmutableSet .copyOf(strategy.calculateNaturalEndpoints(range.right, metadata)); Set<InetAddress> newEndpoints = ImmutableSet .copyOf(strategy.calculateNaturalEndpoints(range.right, allLeftMetadata)); pendingRanges.putAll(range, Sets.difference(newEndpoints, currentEndpoints)); } // At this stage pendingRanges has been updated according to leave operations. We can // now continue the calculation by checking bootstrapping nodes. // For each of the bootstrapping nodes, simply add and remove them one by one to // allLeftMetadata and check in between what their ranges would be. Multimap<InetAddress, Token> bootstrapAddresses = bootstrapTokens.inverse(); for (InetAddress endpoint : bootstrapAddresses.keySet()) { Collection<Token> tokens = bootstrapAddresses.get(endpoint); allLeftMetadata.updateNormalTokens(tokens, endpoint); for (Range<Token> range : strategy.getAddressRanges(allLeftMetadata).get(endpoint)) pendingRanges.put(range, endpoint); allLeftMetadata.removeEndpoint(endpoint); } // At this stage pendingRanges has been updated according to leaving and bootstrapping nodes. // We can now finish the calculation by checking moving and relocating nodes. // For each of the moving nodes, we do the same thing we did for bootstrapping: // simply add and remove them one by one to allLeftMetadata and check in between what their ranges would be. for (Pair<Token, InetAddress> moving : tm.getMovingEndpoints()) { InetAddress endpoint = moving.right; // address of the moving node // moving.left is a new token of the endpoint allLeftMetadata.updateNormalToken(moving.left, endpoint); for (Range<Token> range : strategy.getAddressRanges(allLeftMetadata).get(endpoint)) { pendingRanges.put(range, endpoint); } allLeftMetadata.removeEndpoint(endpoint); } tm.setPendingRanges(keyspaceName, pendingRanges); if (logger.isDebugEnabled()) logger.debug("Pending ranges:\n" + (pendingRanges.isEmpty() ? "<empty>" : tm.printPendingRanges())); }
From source file:com.tinspx.util.collect.CollectUtils.java
/** * Adds all {@code key/value} entries from {@code map} to {@code map}. * /* w w w. ja v a 2 s.c o m*/ * @return {@code true} if {@code multimap} was modified */ public static <K, V> boolean putAll(@lombok.NonNull Multimap<K, V> multimap, @lombok.NonNull Map<? extends K, ? extends Iterable<? extends V>> map) { boolean changed = false; for (Map.Entry<? extends K, ? extends Iterable<? extends V>> e : map.entrySet()) { if (multimap.putAll(e.getKey(), e.getValue())) { changed = true; } } return changed; }
From source file:com.google.devtools.build.lib.rules.android.AndroidBinary.java
private static RuleConfiguredTargetBuilder init(RuleContext ruleContext, NestedSetBuilder<Artifact> filesBuilder, ResourceDependencies resourceDeps, JavaCommon javaCommon, AndroidCommon androidCommon, JavaSemantics javaSemantics, AndroidSemantics androidSemantics) throws InterruptedException, RuleErrorException { if (getMultidexMode(ruleContext) != MultidexMode.LEGACY && ruleContext.attributes().isAttributeValueExplicitlySpecified("main_dex_proguard_specs")) { ruleContext.throwWithAttributeError("main_dex_proguard_specs", "The " + "'main_dex_proguard_specs' attribute is only allowed if 'multidex' is set to 'legacy'"); }// w w w.j ava2s . com if (ruleContext.attributes().isAttributeValueExplicitlySpecified("proguard_apply_mapping") && ruleContext.attributes().get(ProguardHelper.PROGUARD_SPECS, BuildType.LABEL_LIST).isEmpty()) { ruleContext.throwWithAttributeError("proguard_apply_mapping", "'proguard_apply_mapping' can only be used when 'proguard_specs' is also set"); } if (ruleContext.attributes().isAttributeValueExplicitlySpecified("rex_package_map") && !ruleContext.attributes().get("rewrite_dexes_with_rex", Type.BOOLEAN)) { ruleContext.throwWithAttributeError("rex_package_map", "'rex_package_map' can only be used when 'rewrite_dexes_with_rex' is also set"); } if (ruleContext.attributes().isAttributeValueExplicitlySpecified("rex_package_map") && ruleContext.attributes().get(ProguardHelper.PROGUARD_SPECS, BuildType.LABEL_LIST).isEmpty()) { ruleContext.throwWithAttributeError("rex_package_map", "'rex_package_map' can only be used when 'proguard_specs' is also set"); } // TODO(bazel-team): Find a way to simplify this code. // treeKeys() means that the resulting map sorts the entries by key, which is necessary to // ensure determinism. Multimap<String, TransitiveInfoCollection> depsByArchitecture = MultimapBuilder.treeKeys().arrayListValues() .build(); AndroidConfiguration androidConfig = ruleContext.getFragment(AndroidConfiguration.class); for (Map.Entry<Optional<String>, ? extends List<? extends TransitiveInfoCollection>> entry : ruleContext .getSplitPrerequisites("deps").entrySet()) { String cpu = entry.getKey().or(androidConfig.getCpu()); depsByArchitecture.putAll(cpu, entry.getValue()); } Map<String, BuildConfiguration> configurationMap = new LinkedHashMap<>(); Map<String, CcToolchainProvider> toolchainMap = new LinkedHashMap<>(); for (Map.Entry<Optional<String>, ? extends List<? extends TransitiveInfoCollection>> entry : ruleContext .getSplitPrerequisites(":cc_toolchain_split").entrySet()) { String cpu = entry.getKey().or(androidConfig.getCpu()); TransitiveInfoCollection dep = Iterables.getOnlyElement(entry.getValue()); CcToolchainProvider toolchain = CppHelper.getToolchain(ruleContext, dep); configurationMap.put(cpu, dep.getConfiguration()); toolchainMap.put(cpu, toolchain); } NativeLibs nativeLibs = NativeLibs.fromLinkedNativeDeps(ruleContext, androidSemantics.getNativeDepsFileName(), depsByArchitecture, toolchainMap, configurationMap); // TODO(bazel-team): Resolve all the different cases of resource handling so this conditional // can go away: recompile from android_resources, and recompile from android_binary attributes. ApplicationManifest applicationManifest; ResourceApk resourceApk; ResourceApk incrementalResourceApk; ResourceApk instantRunResourceApk; ResourceApk splitResourceApk; if (LocalResourceContainer.definesAndroidResources(ruleContext.attributes())) { // Retrieve and compile the resources defined on the android_binary rule. LocalResourceContainer.validateRuleContext(ruleContext); ApplicationManifest ruleManifest = androidSemantics.getManifestForRule(ruleContext); applicationManifest = ruleManifest.mergeWith(ruleContext, resourceDeps); resourceApk = applicationManifest.packWithDataAndResources( ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_RESOURCES_APK), ruleContext, false, /* isLibrary */ resourceDeps, ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_R_TXT), null, /* Artifact symbolsTxt */ ruleContext.getTokenizedStringListAttr("resource_configuration_filters"), ruleContext.getTokenizedStringListAttr("nocompress_extensions"), ruleContext.attributes().get("crunch_png", Type.BOOLEAN), ruleContext.getTokenizedStringListAttr("densities"), false, /* incremental */ ProguardHelper.getProguardConfigArtifact(ruleContext, ""), createMainDexProguardSpec(ruleContext), ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_PROCESSED_MANIFEST), ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_RESOURCES_ZIP), DataBinding.isEnabled(ruleContext) ? DataBinding.getLayoutInfoFile(ruleContext) : null); ruleContext.assertNoErrors(); incrementalResourceApk = applicationManifest.addMobileInstallStubApplication(ruleContext) .packWithDataAndResources( ruleContext.getImplicitOutputArtifact( AndroidRuleClasses.ANDROID_INCREMENTAL_RESOURCES_APK), ruleContext, false, /* isLibrary */ resourceDeps, null, /* Artifact rTxt */ null, /* Artifact symbolsTxt */ ruleContext.getTokenizedStringListAttr("resource_configuration_filters"), ruleContext.getTokenizedStringListAttr("nocompress_extensions"), ruleContext.attributes().get("crunch_png", Type.BOOLEAN), ruleContext.getTokenizedStringListAttr("densities"), true, /* incremental */ ProguardHelper.getProguardConfigArtifact(ruleContext, "incremental"), null, /* mainDexProguardCfg */ null, /* manifestOut */ null, /* mergedResourcesOut */ null /* dataBindingInfoZip */); ruleContext.assertNoErrors(); instantRunResourceApk = applicationManifest.addInstantRunStubApplication(ruleContext) .packWithDataAndResources(getDxArtifact(ruleContext, "android_instant_run.ap_"), ruleContext, false, /* isLibrary */ resourceDeps, null, /* Artifact rTxt */ null, /* Artifact symbolsTxt */ ruleContext.getTokenizedStringListAttr("resource_configuration_filters"), ruleContext.getTokenizedStringListAttr("nocompress_extensions"), ruleContext.attributes().get("crunch_png", Type.BOOLEAN), ruleContext.getTokenizedStringListAttr("densities"), true, /* incremental */ ProguardHelper.getProguardConfigArtifact(ruleContext, "instant_run"), null, /* mainDexProguardCfg */ null, /* manifestOut */ null /* mergedResourcesOut */, null /* dataBindingInfoZip */); ruleContext.assertNoErrors(); splitResourceApk = applicationManifest.createSplitManifest(ruleContext, "android_resources", false) .packWithDataAndResources(getDxArtifact(ruleContext, "android_resources.ap_"), ruleContext, false, /* isLibrary */ resourceDeps, null, /* Artifact rTxt */ null, /* Artifact symbolsTxt */ ruleContext.getTokenizedStringListAttr("resource_configuration_filters"), ruleContext.getTokenizedStringListAttr("nocompress_extensions"), ruleContext.attributes().get("crunch_png", Type.BOOLEAN), ruleContext.getTokenizedStringListAttr("densities"), true, /* incremental */ ProguardHelper.getProguardConfigArtifact(ruleContext, "incremental_split"), null, /* mainDexProguardCfg */ null, /* manifestOut */ null /* mergedResourcesOut */, null /* dataBindingInfoZip */); ruleContext.assertNoErrors(); } else { if (!ruleContext.attributes().get("crunch_png", Type.BOOLEAN)) { ruleContext.throwWithRuleError("Setting crunch_png = 0 is not supported for android_binary" + " rules which depend on android_resources rules."); } // Retrieve the resources from the resources attribute on the android_binary rule // and recompile them if necessary. ApplicationManifest resourcesManifest = ApplicationManifest.fromResourcesRule(ruleContext); if (resourcesManifest == null) { throw new RuleErrorException(); } applicationManifest = resourcesManifest.mergeWith(ruleContext, resourceDeps); // Always recompiling resources causes AndroidTest to fail in certain circumstances. if (shouldRegenerate(ruleContext, resourceDeps)) { resourceApk = applicationManifest.packWithResources( ruleContext.getImplicitOutputArtifact(AndroidRuleClasses.ANDROID_RESOURCES_APK), ruleContext, resourceDeps, true, /* createSource */ ProguardHelper.getProguardConfigArtifact(ruleContext, ""), createMainDexProguardSpec(ruleContext)); ruleContext.assertNoErrors(); } else { resourceApk = applicationManifest.useCurrentResources(ruleContext, ProguardHelper.getProguardConfigArtifact(ruleContext, ""), createMainDexProguardSpec(ruleContext)); ruleContext.assertNoErrors(); } incrementalResourceApk = applicationManifest.addMobileInstallStubApplication(ruleContext) .packWithResources( ruleContext.getImplicitOutputArtifact( AndroidRuleClasses.ANDROID_INCREMENTAL_RESOURCES_APK), ruleContext, resourceDeps, false, /* createSource */ ProguardHelper.getProguardConfigArtifact(ruleContext, "incremental"), null /* mainDexProguardConfig */); ruleContext.assertNoErrors(); instantRunResourceApk = applicationManifest.addInstantRunStubApplication(ruleContext).packWithResources( getDxArtifact(ruleContext, "android_instant_run.ap_"), ruleContext, resourceDeps, false, /* createSource */ ProguardHelper.getProguardConfigArtifact(ruleContext, "instant_run"), null /* mainDexProguardConfig */); ruleContext.assertNoErrors(); splitResourceApk = applicationManifest.createSplitManifest(ruleContext, "android_resources", false) .packWithResources(getDxArtifact(ruleContext, "android_resources.ap_"), ruleContext, resourceDeps, false, /* createSource */ ProguardHelper.getProguardConfigArtifact(ruleContext, "incremental_split"), null /* mainDexProguardConfig */); ruleContext.assertNoErrors(); } boolean shrinkResources = shouldShrinkResources(ruleContext); JavaTargetAttributes resourceClasses = androidCommon.init(javaSemantics, androidSemantics, resourceApk, ruleContext.getConfiguration().isCodeCoverageEnabled(), true /* collectJavaCompilationArgs */, true /* isBinary */); ruleContext.assertNoErrors(); Function<Artifact, Artifact> derivedJarFunction = collectDesugaredJars(ruleContext, androidCommon, androidSemantics, resourceClasses); Artifact deployJar = createDeployJar(ruleContext, javaSemantics, androidCommon, resourceClasses, derivedJarFunction); Artifact proguardMapping = ruleContext.getPrerequisiteArtifact("proguard_apply_mapping", Mode.TARGET); return createAndroidBinary(ruleContext, filesBuilder, deployJar, derivedJarFunction, /* isBinaryJarFiltered */ false, javaCommon, androidCommon, javaSemantics, androidSemantics, nativeLibs, applicationManifest, resourceApk, incrementalResourceApk, instantRunResourceApk, splitResourceApk, shrinkResources, resourceClasses, ImmutableList.<Artifact>of(), ImmutableList.<Artifact>of(), proguardMapping); }
From source file:com.ardor3d.extension.model.collada.jdom.ColladaImporter.java
/** * Reads a Collada file from the given resource and returns it as a ColladaStorage object. * /*from ww w . j a va 2 s . c o m*/ * @param resource * the name of the resource to find. * @param geometryTool * the geometry tool used to minimize the vertex count. * @return a ColladaStorage data object containing the Collada scene and other useful elements. * @throws IOException * if the resource can not be loaded for some reason. */ public ColladaStorage load(final ResourceSource resource, final GeometryTool geometryTool) throws IOException { final ColladaStorage colladaStorage = new ColladaStorage(); final DataCache dataCache = new DataCache(); if (_externalJointMapping != null) { dataCache.getExternalJointMapping().putAll(_externalJointMapping); } final ColladaDOMUtil colladaDOMUtil = new ColladaDOMUtil(dataCache); final ColladaMaterialUtils colladaMaterialUtils = new ColladaMaterialUtils(this, dataCache, colladaDOMUtil); final ColladaMeshUtils colladaMeshUtils = new ColladaMeshUtils(dataCache, colladaDOMUtil, colladaMaterialUtils, _optimizeMeshes, _optimizeSettings, geometryTool); final ColladaAnimUtils colladaAnimUtils = new ColladaAnimUtils(colladaStorage, dataCache, colladaDOMUtil, colladaMeshUtils); final ColladaNodeUtils colladaNodeUtils = new ColladaNodeUtils(dataCache, colladaDOMUtil, colladaMaterialUtils, colladaMeshUtils, colladaAnimUtils); try { // Pull in the DOM tree of the Collada resource. final Element collada = readCollada(resource, dataCache); // if we don't specify a texture locator, add a temporary texture locator at the location of this model // resource.. final boolean addLocator = _textureLocator == null; final RelativeResourceLocator loc; if (addLocator) { loc = new RelativeResourceLocator(resource); ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE, loc); } else { loc = null; } final AssetData assetData = colladaNodeUtils.parseAsset(collada.getChild("asset")); // Collada may or may not have a scene, so this can return null. final Node scene = colladaNodeUtils.getVisualScene(collada); if (_loadAnimations) { colladaAnimUtils.parseLibraryAnimations(collada); } // reattach attachments to scene if (scene != null) { colladaNodeUtils.reattachAttachments(scene); } // set our scene into storage colladaStorage.setScene(scene); // set our asset data into storage colladaStorage.setAssetData(assetData); // drop our added locator if needed. if (addLocator) { ResourceLocatorTool.removeResourceLocator(ResourceLocatorTool.TYPE_TEXTURE, loc); } // copy across our mesh colors - only for objects with multiple channels final Multimap<MeshData, FloatBuffer> colors = ArrayListMultimap.create(); final Multimap<MeshData, FloatBuffer> temp = dataCache.getParsedVertexColors(); for (final MeshData key : temp.keySet()) { // only copy multiple channels since their data is lost final Collection<FloatBuffer> val = temp.get(key); if (val != null && val.size() > 1) { colors.putAll(key, val); } } colladaStorage.setParsedVertexColors(colors); // copy across our mesh material info colladaStorage.setMeshMaterialInfo(dataCache.getMeshMaterialMap()); colladaStorage.setMaterialMap(dataCache.getMaterialInfoMap()); // return storage return colladaStorage; } catch (final Exception e) { throw new IOException("Unable to load collada resource from URL: " + resource, e); } }