List of usage examples for com.google.common.collect ImmutableMap get
V get(Object key);
From source file:com.google.caliper.config.CaliperConfig.java
public InstrumentConfig getInstrumentConfig(String name) { checkNotNull(name);/*from w ww. j ava 2 s .co m*/ ImmutableMap<String, String> instrumentGroupMap = subgroupMap(properties, "instrument"); ImmutableMap<String, String> insrumentMap = subgroupMap(instrumentGroupMap, name); @Nullable String className = insrumentMap.get("class"); checkArgument(className != null, "no instrument configured named %s", name); return new InstrumentConfig.Builder().className(className) .addAllOptions(subgroupMap(insrumentMap, "options")).build(); }
From source file:org.grycap.gpf4med.DocumentManager.java
public @Nullable Document getDocument(final ConceptName conceptName) { checkArgument(conceptName != null, "Unninitialized or invalid concept name"); final ImmutableMap<String, Document> documents = documents(-1, null); return documents != null ? documents.get(Id.getId(conceptName)) : null; }
From source file:com.qubole.quark.plugins.qubole.QuboleDB.java
private Integer getType(String dataType) throws QuarkException { if (DATA_TYPES.containsKey(dataType)) { return DATA_TYPES.get(dataType); } else {//from ww w. j a va 2 s . com ImmutableMap<String, Integer> dataTypes = this.getDataTypes(); for (String key : dataTypes.keySet()) { if (dataType.matches(key)) { return dataTypes.get(key); } } } throw new QuarkException("Unknown DataType `" + dataType + "`"); }
From source file:com.romainpiel.svgtoandroid.SvgLeafNode.java
private String getAttributeValues(ImmutableMap<String, String> presentationMap) { StringBuilder sb = new StringBuilder("/>\n"); for (String key : mVdAttributesMap.keySet()) { String vectorDrawableAttr = presentationMap.get(key); String svgValue = mVdAttributesMap.get(key); String vdValue = svgValue.trim(); // There are several cases we need to convert from SVG format to // VectorDrawable format. Like "none", "3px" or "rgb(255, 0, 0)" if ("none".equals(vdValue)) { vdValue = "#00000000"; } else if (vdValue.endsWith("px")) { vdValue = vdValue.substring(0, vdValue.length() - 2); } else if (vdValue.startsWith("rgb")) { vdValue = vdValue.substring(3, vdValue.length()); vdValue = convertRGBToHex(vdValue); if (vdValue == null) { getTree().logErrorLine("Unsupported Color format " + vdValue, getDocumentNode(), SvgTree.SvgLogLevel.ERROR); }//w w w . j ava 2s. c om } String attr = "\n " + vectorDrawableAttr + "=\"" + vdValue + "\""; sb.insert(0, attr); } return sb.toString(); }
From source file:com.facebook.buck.android.exopackage.NativeExoHelper.java
/** @return a mapping from destinationPathOnDevice -> localPath */ public ImmutableMap<Path, Path> getFilesToInstall() throws IOException { ImmutableMap.Builder<Path, Path> filesToInstallBuilder = ImmutableMap.builder(); ImmutableMap<String, ImmutableMultimap<String, Path>> filesByHashForAbis = getFilesByHashForAbis(); for (String abi : filesByHashForAbis.keySet()) { ImmutableMultimap<String, Path> filesByHash = Objects.requireNonNull(filesByHashForAbis.get(abi)); Path abiDir = NATIVE_LIBS_DIR.resolve(abi); for (Entry<Path, Collection<Path>> entry : ExopackageUtil .applyFilenameFormat(filesByHash, abiDir, "native-%s.so").asMap().entrySet()) { // The files in the getValue collection should all be identical // (because the key in their hash), so just pick the first one. filesToInstallBuilder.put(entry.getKey(), entry.getValue().iterator().next()); }/*from ww w .j a v a 2 s . c om*/ } return filesToInstallBuilder.build(); }
From source file:com.android.ide.common.vectordrawable.SvgLeafNode.java
private String getAttributeValues(ImmutableMap<String, String> presentationMap) { StringBuilder sb = new StringBuilder("/>\n"); for (String key : mVdAttributesMap.keySet()) { String vectorDrawableAttr = presentationMap.get(key); String svgValue = mVdAttributesMap.get(key); String vdValue = svgValue.trim(); // There are several cases we need to convert from SVG format to // VectorDrawable format. Like "none", "3px" or "rgb(255, 0, 0)" if ("none".equals(vdValue)) { vdValue = "#00000000"; } else if (vdValue.endsWith("px")) { vdValue = vdValue.substring(0, vdValue.length() - 2); } else if (vdValue.startsWith("rgb")) { vdValue = vdValue.substring(3, vdValue.length()); vdValue = convertRGBToHex(vdValue); if (vdValue == null) { getTree().logErrorLine("Unsupported Color format " + vdValue, getDocumentNode(), SvgTree.SvgLogLevel.ERROR); }/* ww w . ja v a 2s. co m*/ } String attr = "\n " + vectorDrawableAttr + "=\"" + vdValue + "\""; sb.insert(0, attr); } return sb.toString(); }
From source file:com.google.caliper.runner.config.CaliperConfig.java
public InstrumentConfig getInstrumentConfig(String name) { checkNotNull(name);//from ww w . ja v a 2 s . co m ImmutableMap<String, String> instrumentGroupMap = subgroupMap(properties, "instrument"); ImmutableMap<String, String> instrumentMap = subgroupMap(instrumentGroupMap, name); @Nullable String className = instrumentMap.get("class"); checkArgument(className != null, "no instrument configured named %s", name); return new InstrumentConfig.Builder().className(className) .addAllOptions(subgroupMap(instrumentMap, "options")).build(); }
From source file:com.facebook.buck.ide.intellij.IjModuleGraph.java
public ImmutableMap<IjModule, DependencyType> getDependentModulesFor(IjModule source) { final ImmutableMap<IjProjectElement, DependencyType> deps = getDepsFor(source); return deps.keySet().stream().filter(dep -> dep instanceof IjModule).map(module -> (IjModule) module) .collect(MoreCollectors.toImmutableMap(k -> k, input -> Preconditions.checkNotNull(deps.get(input)))); }
From source file:com.facebook.buck.ide.intellij.IjModuleGraph.java
public ImmutableMap<IjLibrary, DependencyType> getDependentLibrariesFor(IjModule source) { final ImmutableMap<IjProjectElement, DependencyType> deps = getDepsFor(source); return deps.keySet().stream().filter(dep -> dep instanceof IjLibrary).map(library -> (IjLibrary) library) .collect(MoreCollectors.toImmutableMap(k -> k, input -> Preconditions.checkNotNull(deps.get(input)))); }
From source file:org.apache.cloudstack.outofbandmanagement.driver.nestedcloudstack.NestedCloudStackOutOfBandManagementDriver.java
protected void ensureOptionExists(final ImmutableMap<OutOfBandManagement.Option, String> options, final OutOfBandManagement.Option option) { if (options != null && option != null && options.containsKey(option) && !Strings.isNullOrEmpty(options.get(option))) { return;// ww w . ja v a 2 s .c o m } throw new CloudRuntimeException( "Invalid out-of-band management configuration detected for the nested-cloudstack driver"); }