List of usage examples for com.google.common.collect ImmutableBiMap builder
public static <K, V> Builder<K, V> builder()
From source file:com.google.security.zynamics.binnavi.Database.PostgreSQL.Loaders.PostgreSQLViewsLoader.java
/** * Loads the view -> function mapping from the database. * /* w w w. j a v a2 s . c o m*/ * @param provider The SQL provider that provides the connection. * @param flowgraphs List of all native Flow graph views of a module. * @param functions List of all functions of a module. * @param module The module from which to load the mapping. * * @return A view -> function mapping and a function -> view mapping. * * @throws CouldntLoadDataException Thrown if the mapping could not be loaded. */ public static final ImmutableBiMap<INaviView, INaviFunction> loadViewFunctionMapping( final AbstractSQLProvider provider, final List<IFlowgraphView> flowgraphs, final List<INaviFunction> functions, final CModule module) throws CouldntLoadDataException { checkArguments(provider, module, flowgraphs, functions); final HashMap<Integer, INaviView> viewmap = new HashMap<Integer, INaviView>(); for (final IFlowgraphView view : flowgraphs) { viewmap.put(view.getConfiguration().getId(), view); } final HashMap<IAddress, INaviFunction> functionMap = new HashMap<IAddress, INaviFunction>(); for (final INaviFunction function : functions) { functionMap.put(function.getAddress(), function); } final CConnection connection = provider.getConnection(); final String query = "SELECT view_id, function FROM " + CTableNames.FUNCTION_VIEWS_TABLE + " WHERE module_id = " + module.getConfiguration().getId(); final HashMap<INaviView, INaviFunction> viewFunctionMap = new HashMap<INaviView, INaviFunction>(); try { final ResultSet resultSet = connection.executeQuery(query, true); try { while (resultSet.next()) { final INaviView view = viewmap.get(resultSet.getInt("view_id")); final INaviFunction function = functionMap .get(PostgreSQLHelpers.loadAddress(resultSet, "function")); if ((view != null) && (function != null)) { viewFunctionMap.put(view, function); } } } finally { resultSet.close(); } return new ImmutableBiMap.Builder<INaviView, INaviFunction>().putAll(viewFunctionMap).build(); } catch (final SQLException e) { throw new CouldntLoadDataException(e); } }
From source file:ealvatag.tag.id3.ID3v24Frames.java
private ImmutableBiMap<FieldKey, ID3v24FieldKey> makeTagFieldToId3() { final ImmutableBiMap.Builder<FieldKey, ID3v24FieldKey> builder = ImmutableBiMap.builder(); builder.put(FieldKey.ACOUSTID_FINGERPRINT, ID3v24FieldKey.ACOUSTID_FINGERPRINT) .put(FieldKey.ACOUSTID_ID, ID3v24FieldKey.ACOUSTID_ID).put(FieldKey.ALBUM, ID3v24FieldKey.ALBUM) .put(FieldKey.ALBUM_ARTIST, ID3v24FieldKey.ALBUM_ARTIST) .put(FieldKey.ALBUM_ARTIST_SORT, ID3v24FieldKey.ALBUM_ARTIST_SORT) .put(FieldKey.ALBUM_ARTISTS, ID3v24FieldKey.ALBUM_ARTISTS) .put(FieldKey.ALBUM_ARTISTS_SORT, ID3v24FieldKey.ALBUM_ARTISTS_SORT) .put(FieldKey.ALBUM_SORT, ID3v24FieldKey.ALBUM_SORT) .put(FieldKey.AMAZON_ID, ID3v24FieldKey.AMAZON_ID).put(FieldKey.ARRANGER, ID3v24FieldKey.ARRANGER) .put(FieldKey.ARRANGER_SORT, ID3v24FieldKey.ARRANGER_SORT) .put(FieldKey.ARTIST, ID3v24FieldKey.ARTIST).put(FieldKey.ARTISTS, ID3v24FieldKey.ARTISTS) .put(FieldKey.ARTISTS_SORT, ID3v24FieldKey.ARTISTS_SORT) .put(FieldKey.ARTIST_SORT, ID3v24FieldKey.ARTIST_SORT).put(FieldKey.BARCODE, ID3v24FieldKey.BARCODE) .put(FieldKey.BPM, ID3v24FieldKey.BPM).put(FieldKey.CATALOG_NO, ID3v24FieldKey.CATALOG_NO) .put(FieldKey.CHOIR, ID3v24FieldKey.CHOIR).put(FieldKey.CHOIR_SORT, ID3v24FieldKey.CHOIR_SORT) .put(FieldKey.CLASSICAL_CATALOG, ID3v24FieldKey.CLASSICAL_CATALOG) .put(FieldKey.CLASSICAL_NICKNAME, ID3v24FieldKey.CLASSICAL_NICKNAME) .put(FieldKey.COMMENT, ID3v24FieldKey.COMMENT).put(FieldKey.COMPOSER, ID3v24FieldKey.COMPOSER) .put(FieldKey.COMPOSER_SORT, ID3v24FieldKey.COMPOSER_SORT) .put(FieldKey.CONDUCTOR, ID3v24FieldKey.CONDUCTOR) .put(FieldKey.CONDUCTOR_SORT, ID3v24FieldKey.CONDUCTOR_SORT) .put(FieldKey.COUNTRY, ID3v24FieldKey.COUNTRY).put(FieldKey.COVER_ART, ID3v24FieldKey.COVER_ART) .put(FieldKey.CUSTOM1, ID3v24FieldKey.CUSTOM1).put(FieldKey.CUSTOM2, ID3v24FieldKey.CUSTOM2) .put(FieldKey.CUSTOM3, ID3v24FieldKey.CUSTOM3).put(FieldKey.CUSTOM4, ID3v24FieldKey.CUSTOM4) .put(FieldKey.CUSTOM5, ID3v24FieldKey.CUSTOM5).put(FieldKey.DISC_NO, ID3v24FieldKey.DISC_NO) .put(FieldKey.DISC_SUBTITLE, ID3v24FieldKey.DISC_SUBTITLE) .put(FieldKey.DISC_TOTAL, ID3v24FieldKey.DISC_TOTAL).put(FieldKey.DJMIXER, ID3v24FieldKey.DJMIXER) .put(FieldKey.MOOD_ELECTRONIC, ID3v24FieldKey.MOOD_ELECTRONIC) .put(FieldKey.ENCODER, ID3v24FieldKey.ENCODER).put(FieldKey.ENGINEER, ID3v24FieldKey.ENGINEER) .put(FieldKey.ENSEMBLE, ID3v24FieldKey.ENSEMBLE) .put(FieldKey.ENSEMBLE_SORT, ID3v24FieldKey.ENSEMBLE_SORT).put(FieldKey.FBPM, ID3v24FieldKey.FBPM) .put(FieldKey.GENRE, ID3v24FieldKey.GENRE).put(FieldKey.GROUPING, ID3v24FieldKey.GROUPING) .put(FieldKey.MOOD_INSTRUMENTAL, ID3v24FieldKey.MOOD_INSTRUMENTAL) .put(FieldKey.INVOLVED_PERSON, ID3v24FieldKey.INVOLVED_PERSON) .put(FieldKey.ISRC, ID3v24FieldKey.ISRC).put(FieldKey.IS_CLASSICAL, ID3v24FieldKey.IS_CLASSICAL) .put(FieldKey.IS_COMPILATION, ID3v24FieldKey.IS_COMPILATION) .put(FieldKey.IS_SOUNDTRACK, ID3v24FieldKey.IS_SOUNDTRACK) .put(FieldKey.ITUNES_GROUPING, ID3v24FieldKey.ITUNES_GROUPING).put(FieldKey.KEY, ID3v24FieldKey.KEY) .put(FieldKey.LANGUAGE, ID3v24FieldKey.LANGUAGE).put(FieldKey.LYRICIST, ID3v24FieldKey.LYRICIST) .put(FieldKey.LYRICS, ID3v24FieldKey.LYRICS).put(FieldKey.MEDIA, ID3v24FieldKey.MEDIA) .put(FieldKey.MIXER, ID3v24FieldKey.MIXER).put(FieldKey.MOOD, ID3v24FieldKey.MOOD) .put(FieldKey.MOOD_ACOUSTIC, ID3v24FieldKey.MOOD_ACOUSTIC) .put(FieldKey.MOOD_AGGRESSIVE, ID3v24FieldKey.MOOD_AGGRESSIVE) .put(FieldKey.MOOD_AROUSAL, ID3v24FieldKey.MOOD_AROUSAL) .put(FieldKey.MOOD_DANCEABILITY, ID3v24FieldKey.MOOD_DANCEABILITY) .put(FieldKey.MOOD_HAPPY, ID3v24FieldKey.MOOD_HAPPY) .put(FieldKey.MOOD_PARTY, ID3v24FieldKey.MOOD_PARTY) .put(FieldKey.MOOD_RELAXED, ID3v24FieldKey.MOOD_RELAXED) .put(FieldKey.MOOD_SAD, ID3v24FieldKey.MOOD_SAD) .put(FieldKey.MOOD_VALENCE, ID3v24FieldKey.MOOD_VALENCE) .put(FieldKey.MOVEMENT, ID3v24FieldKey.MOVEMENT) .put(FieldKey.MOVEMENT_NO, ID3v24FieldKey.MOVEMENT_NO) .put(FieldKey.MOVEMENT_TOTAL, ID3v24FieldKey.MOVEMENT_TOTAL) .put(FieldKey.MUSICBRAINZ_ARTISTID, ID3v24FieldKey.MUSICBRAINZ_ARTISTID) .put(FieldKey.MUSICBRAINZ_DISC_ID, ID3v24FieldKey.MUSICBRAINZ_DISC_ID) .put(FieldKey.MUSICBRAINZ_ORIGINAL_RELEASE_ID, ID3v24FieldKey.MUSICBRAINZ_ORIGINAL_RELEASEID) .put(FieldKey.MUSICBRAINZ_RELEASEARTISTID, ID3v24FieldKey.MUSICBRAINZ_RELEASEARTISTID) .put(FieldKey.MUSICBRAINZ_RELEASEID, ID3v24FieldKey.MUSICBRAINZ_RELEASEID) .put(FieldKey.MUSICBRAINZ_RELEASE_COUNTRY, ID3v24FieldKey.MUSICBRAINZ_RELEASE_COUNTRY) .put(FieldKey.MUSICBRAINZ_RELEASE_GROUP_ID, ID3v24FieldKey.MUSICBRAINZ_RELEASE_GROUP_ID) .put(FieldKey.MUSICBRAINZ_RELEASE_STATUS, ID3v24FieldKey.MUSICBRAINZ_RELEASE_STATUS) .put(FieldKey.MUSICBRAINZ_RELEASE_TRACK_ID, ID3v24FieldKey.MUSICBRAINZ_RELEASE_TRACK_ID) .put(FieldKey.MUSICBRAINZ_RELEASE_TYPE, ID3v24FieldKey.MUSICBRAINZ_RELEASE_TYPE) .put(FieldKey.MUSICBRAINZ_TRACK_ID, ID3v24FieldKey.MUSICBRAINZ_TRACK_ID) .put(FieldKey.MUSICBRAINZ_WORK, ID3v24FieldKey.MUSICBRAINZ_WORK) .put(FieldKey.MUSICBRAINZ_WORK_ID, ID3v24FieldKey.MUSICBRAINZ_WORK_ID) .put(FieldKey.MUSICBRAINZ_WORK_COMPOSITION, ID3v24FieldKey.WORK_COMPOSITION) .put(FieldKey.MUSICBRAINZ_WORK_COMPOSITION_ID, ID3v24FieldKey.MUSICBRAINZ_WORK_COMPOSITION_ID) .put(FieldKey.MUSICBRAINZ_WORK_PART_LEVEL1_ID, ID3v24FieldKey.MUSICBRAINZ_WORK_PART_LEVEL1_ID) .put(FieldKey.MUSICBRAINZ_WORK_PART_LEVEL2_ID, ID3v24FieldKey.MUSICBRAINZ_WORK_PART_LEVEL2_ID) .put(FieldKey.MUSICBRAINZ_WORK_PART_LEVEL3_ID, ID3v24FieldKey.MUSICBRAINZ_WORK_PART_LEVEL3_ID) .put(FieldKey.MUSICBRAINZ_WORK_PART_LEVEL4_ID, ID3v24FieldKey.MUSICBRAINZ_WORK_PART_LEVEL4_ID) .put(FieldKey.MUSICBRAINZ_WORK_PART_LEVEL5_ID, ID3v24FieldKey.MUSICBRAINZ_WORK_PART_LEVEL5_ID) .put(FieldKey.MUSICBRAINZ_WORK_PART_LEVEL6_ID, ID3v24FieldKey.MUSICBRAINZ_WORK_PART_LEVEL6_ID) .put(FieldKey.MUSICIP_ID, ID3v24FieldKey.MUSICIP_ID).put(FieldKey.OCCASION, ID3v24FieldKey.OCCASION) .put(FieldKey.OPUS, ID3v24FieldKey.OPUS).put(FieldKey.ORCHESTRA, ID3v24FieldKey.ORCHESTRA) .put(FieldKey.ORCHESTRA_SORT, ID3v24FieldKey.ORCHESTRA_SORT) .put(FieldKey.ORIGINAL_ALBUM, ID3v24FieldKey.ORIGINAL_ALBUM) .put(FieldKey.ORIGINAL_ARTIST, ID3v24FieldKey.ORIGINAL_ARTIST) .put(FieldKey.ORIGINAL_LYRICIST, ID3v24FieldKey.ORIGINAL_LYRICIST) .put(FieldKey.ORIGINAL_YEAR, ID3v24FieldKey.ORIGINAL_YEAR).put(FieldKey.PART, ID3v24FieldKey.PART) .put(FieldKey.PART_NUMBER, ID3v24FieldKey.PART_NUMBER) .put(FieldKey.PART_TYPE, ID3v24FieldKey.PART_TYPE).put(FieldKey.PERFORMER, ID3v24FieldKey.PERFORMER) .put(FieldKey.PERFORMER_NAME, ID3v24FieldKey.PERFORMER_NAME) .put(FieldKey.PERFORMER_NAME_SORT, ID3v24FieldKey.PERFORMER_NAME_SORT) .put(FieldKey.PERIOD, ID3v24FieldKey.PERIOD).put(FieldKey.PRODUCER, ID3v24FieldKey.PRODUCER) .put(FieldKey.QUALITY, ID3v24FieldKey.QUALITY).put(FieldKey.RANKING, ID3v24FieldKey.RANKING) .put(FieldKey.RATING, ID3v24FieldKey.RATING).put(FieldKey.RECORD_LABEL, ID3v24FieldKey.RECORD_LABEL) .put(FieldKey.REMIXER, ID3v24FieldKey.REMIXER).put(FieldKey.SCRIPT, ID3v24FieldKey.SCRIPT) .put(FieldKey.SINGLE_DISC_TRACK_NO, ID3v24FieldKey.SINGLE_DISC_TRACK_NO) .put(FieldKey.SUBTITLE, ID3v24FieldKey.SUBTITLE).put(FieldKey.TAGS, ID3v24FieldKey.TAGS) .put(FieldKey.TEMPO, ID3v24FieldKey.TEMPO).put(FieldKey.TIMBRE, ID3v24FieldKey.TIMBRE) .put(FieldKey.TITLE, ID3v24FieldKey.TITLE) .put(FieldKey.TITLE_MOVEMENT, ID3v24FieldKey.TITLE_MOVEMENT) .put(FieldKey.TITLE_SORT, ID3v24FieldKey.TITLE_SORT).put(FieldKey.TONALITY, ID3v24FieldKey.TONALITY) .put(FieldKey.TRACK, ID3v24FieldKey.TRACK).put(FieldKey.TRACK_TOTAL, ID3v24FieldKey.TRACK_TOTAL) .put(FieldKey.URL_DISCOGS_ARTIST_SITE, ID3v24FieldKey.URL_DISCOGS_ARTIST_SITE) .put(FieldKey.URL_DISCOGS_RELEASE_SITE, ID3v24FieldKey.URL_DISCOGS_RELEASE_SITE) .put(FieldKey.URL_LYRICS_SITE, ID3v24FieldKey.URL_LYRICS_SITE) .put(FieldKey.URL_OFFICIAL_ARTIST_SITE, ID3v24FieldKey.URL_OFFICIAL_ARTIST_SITE) .put(FieldKey.URL_OFFICIAL_RELEASE_SITE, ID3v24FieldKey.URL_OFFICIAL_RELEASE_SITE) .put(FieldKey.URL_WIKIPEDIA_ARTIST_SITE, ID3v24FieldKey.URL_WIKIPEDIA_ARTIST_SITE) .put(FieldKey.URL_WIKIPEDIA_RELEASE_SITE, ID3v24FieldKey.URL_WIKIPEDIA_RELEASE_SITE) .put(FieldKey.WORK, ID3v24FieldKey.WORK) .put(FieldKey.MUSICBRAINZ_WORK_PART_LEVEL1, ID3v24FieldKey.WORK_PART_LEVEL1) .put(FieldKey.MUSICBRAINZ_WORK_PART_LEVEL1_TYPE, ID3v24FieldKey.WORK_PART_LEVEL1_TYPE) .put(FieldKey.MUSICBRAINZ_WORK_PART_LEVEL2, ID3v24FieldKey.WORK_PART_LEVEL2) .put(FieldKey.MUSICBRAINZ_WORK_PART_LEVEL2_TYPE, ID3v24FieldKey.WORK_PART_LEVEL2_TYPE) .put(FieldKey.MUSICBRAINZ_WORK_PART_LEVEL3, ID3v24FieldKey.WORK_PART_LEVEL3) .put(FieldKey.MUSICBRAINZ_WORK_PART_LEVEL3_TYPE, ID3v24FieldKey.WORK_PARTOF_LEVEL3_TYPE) .put(FieldKey.MUSICBRAINZ_WORK_PART_LEVEL4, ID3v24FieldKey.WORK_PART_LEVEL4) .put(FieldKey.MUSICBRAINZ_WORK_PART_LEVEL4_TYPE, ID3v24FieldKey.WORK_PART_LEVEL4_TYPE) .put(FieldKey.MUSICBRAINZ_WORK_PART_LEVEL5, ID3v24FieldKey.WORK_PART_LEVEL5) .put(FieldKey.MUSICBRAINZ_WORK_PART_LEVEL5_TYPE, ID3v24FieldKey.WORK_PART_LEVEL5_TYPE) .put(FieldKey.MUSICBRAINZ_WORK_PART_LEVEL6, ID3v24FieldKey.WORK_PART_LEVEL6) .put(FieldKey.MUSICBRAINZ_WORK_PART_LEVEL6_TYPE, ID3v24FieldKey.WORK_PART_LEVEL6_TYPE) .put(FieldKey.WORK_TYPE, ID3v24FieldKey.WORK_TYPE).put(FieldKey.YEAR, ID3v24FieldKey.YEAR); return builder.build(); }
From source file:com.facebook.buck.features.js.JsLibraryDescription.java
private static ImmutableBiMap<Either<SourcePath, Pair<SourcePath, String>>, Flavor> mapSourcesToFlavors( SourcePathResolver sourcePathResolver, ImmutableSet<Either<SourcePath, Pair<SourcePath, String>>> sources) { ImmutableBiMap.Builder<Either<SourcePath, Pair<SourcePath, String>>, Flavor> builder = ImmutableBiMap .builder();//from ww w.ja v a 2 s.c o m for (Either<SourcePath, Pair<SourcePath, String>> source : sources) { Path relativePath = source.transform(sourcePathResolver::getRelativePath, pair -> Paths.get(pair.getSecond())); builder.put(source, JsFlavors.fileFlavorForSourcePath(relativePath)); } return builder.build(); }
From source file:org.decisiondeck.jlp.utils.LpSolverUtils.java
static public <T> BiMap<T, Integer> getVariablesIds(LpProblem<T> problem, int startId) { Preconditions.checkNotNull(problem); final Builder<T, Integer> builder = ImmutableBiMap.builder(); {/*from ww w. j a va 2 s . co m*/ int i = startId; for (T variable : problem.getVariables()) { builder.put(variable, Integer.valueOf(i)); ++i; } } final ImmutableBiMap<T, Integer> variableIds = builder.build(); return variableIds; }
From source file:org.decisiondeck.jlp.cplex.SolverCPLEX.java
private void setVariables() throws IloException { final Builder<T, IloNumVar> variablesToCplexBuilder = ImmutableBiMap.builder(); for (T variable : getProblem().getVariables()) { final String varName = m_currentFormat == null ? getVariableName(variable) : getVariableName(variable, m_currentFormat); LpVariableType varType = getProblem().getVarType(variable); Number lowerBound = LpSolverUtils.getVarLowerBoundBounded(getProblem(), variable); Number upperBound = LpSolverUtils.getVarUpperBoundBounded(getProblem(), variable); final IloNumVar num; final double lb = (lowerBound != null ? lowerBound.doubleValue() : Double.NEGATIVE_INFINITY); final double ub = (upperBound != null ? upperBound.doubleValue() : Double.POSITIVE_INFINITY); final IloNumVarType type; switch (varType) { case BOOL: type = IloNumVarType.Bool;//from ww w. j a v a2 s . co m break; case INT: type = IloNumVarType.Int; break; case REAL: type = IloNumVarType.Float; break; default: throw new IllegalStateException("Unexpected type."); } num = m_cplex.numVar(lb, ub, type, varName); m_cplex.add(num); s_logger.debug( "Set variable {} with bounds " + lb + ", " + ub + ", type " + type + ", name " + varName + ".", variable); variablesToCplexBuilder.put(variable, num); } m_variablesToCplex = variablesToCplexBuilder.build(); // m_cplex.iterator(); // m_cplex.LPMatrixIterator(); }
From source file:com.facebook.buck.android.NdkCxxPlatforms.java
@VisibleForTesting static NdkCxxPlatform build(CxxBuckConfig config, ProjectFilesystem filesystem, Flavor flavor, Platform platform, Path ndkRoot, NdkCxxPlatformTargetConfiguration targetConfiguration, CxxRuntime cxxRuntime, ExecutableFinder executableFinder, boolean strictToolchainPaths) { // Create a version string to use when generating rule keys via the NDK tools we'll generate // below. This will be used in lieu of hashing the contents of the tools, so that builds from // different host platforms (which produce identical output) will share the cache with one // another.// ww w . j a v a 2 s. co m NdkCxxPlatformCompiler.Type compilerType = targetConfiguration.getCompiler().getType(); String version = Joiner.on('-') .join(ImmutableList.of(readVersion(ndkRoot), targetConfiguration.getToolchain(), targetConfiguration.getTargetAppPlatform(), compilerType, targetConfiguration.getCompiler().getVersion(), targetConfiguration.getCompiler().getGccVersion(), cxxRuntime)); Host host = Preconditions.checkNotNull(BUILD_PLATFORMS.get(platform)); NdkCxxToolchainPaths toolchainPaths = new NdkCxxToolchainPaths(filesystem, ndkRoot, targetConfiguration, host.toString(), cxxRuntime, strictToolchainPaths); // Sanitized paths will have magic placeholders for parts of the paths that // are machine/host-specific. See comments on ANDROID_NDK_ROOT and // BUILD_HOST_SUBST above. NdkCxxToolchainPaths sanitizedPaths = toolchainPaths.getSanitizedPaths(); // Build up the map of paths that must be sanitized. ImmutableBiMap.Builder<Path, Path> sanitizePathsBuilder = ImmutableBiMap.builder(); sanitizePathsBuilder.put(toolchainPaths.getNdkToolRoot(), sanitizedPaths.getNdkToolRoot()); if (compilerType != NdkCxxPlatformCompiler.Type.GCC) { sanitizePathsBuilder.put(toolchainPaths.getNdkGccToolRoot(), sanitizedPaths.getNdkGccToolRoot()); } sanitizePathsBuilder.put(ndkRoot, Paths.get(ANDROID_NDK_ROOT)); CxxToolProvider.Type type = compilerType == NdkCxxPlatformCompiler.Type.CLANG ? CxxToolProvider.Type.CLANG : CxxToolProvider.Type.GCC; ToolProvider ccTool = new ConstantToolProvider( getCTool(toolchainPaths, compilerType.getCc(), version, executableFinder)); ToolProvider cxxTool = new ConstantToolProvider( getCTool(toolchainPaths, compilerType.getCxx(), version, executableFinder)); CompilerProvider cc = new CompilerProvider(ccTool, type); PreprocessorProvider cpp = new PreprocessorProvider(ccTool, type); CompilerProvider cxx = new CompilerProvider(cxxTool, type); PreprocessorProvider cxxpp = new PreprocessorProvider(cxxTool, type); CxxPlatform.Builder cxxPlatformBuilder = CxxPlatform.builder(); ImmutableBiMap<Path, Path> sanitizePaths = sanitizePathsBuilder.build(); PrefixMapDebugPathSanitizer compilerDebugPathSanitizer = new PrefixMapDebugPathSanitizer( config.getDebugPathSanitizerLimit(), File.separatorChar, Paths.get("."), sanitizePaths, filesystem.getRootPath().toAbsolutePath(), type); MungingDebugPathSanitizer assemblerDebugPathSanitizer = new MungingDebugPathSanitizer( config.getDebugPathSanitizerLimit(), File.separatorChar, Paths.get("."), sanitizePaths); cxxPlatformBuilder.setFlavor(flavor).setAs(cc) .addAllAsflags(getAsflags(targetConfiguration, toolchainPaths)).setAspp(cpp).setCc(cc) .addAllCflags(getCflagsInternal(targetConfiguration, toolchainPaths)).setCpp(cpp) .addAllCppflags(getCppflags(targetConfiguration, toolchainPaths)).setCxx(cxx) .addAllCxxflags(getCxxflagsInternal(targetConfiguration, toolchainPaths)).setCxxpp(cxxpp) .addAllCxxppflags(getCxxppflags(targetConfiguration, toolchainPaths)) .setLd(new DefaultLinkerProvider(LinkerProvider.Type.GNU, new ConstantToolProvider(getCcLinkTool(targetConfiguration, toolchainPaths, compilerType.getCxx(), version, executableFinder)))) .addAllLdflags(targetConfiguration.getLinkerFlags(compilerType)) // Default linker flags added by the NDK .addLdflags( // Add a deterministic build ID to Android builds. // We use it to find symbols from arbitrary binaries. "-Wl,--build-id", // Enforce the NX (no execute) security feature "-Wl,-z,noexecstack", // Strip unused code "-Wl,--gc-sections", // Refuse to produce dynamic objects with undefined symbols "-Wl,-z,defs", // Forbid dangerous copy "relocations" "-Wl,-z,nocopyreloc", // We always pass the runtime library on the command line, so setting this flag // means the resulting link will only use it if it was actually needed it. "-Wl,--as-needed") .setStrip(getGccTool(toolchainPaths, "strip", version, executableFinder)) .setSymbolNameTool( new PosixNmSymbolNameTool(getGccTool(toolchainPaths, "nm", version, executableFinder))) .setAr(new GnuArchiver(getGccTool(toolchainPaths, "ar", version, executableFinder))) .setRanlib(getGccTool(toolchainPaths, "ranlib", version, executableFinder)) // NDK builds are cross compiled, so the header is the same regardless of the host platform. .setCompilerDebugPathSanitizer(compilerDebugPathSanitizer) .setAssemblerDebugPathSanitizer(assemblerDebugPathSanitizer).setSharedLibraryExtension("so") .setSharedLibraryVersionedExtensionFormat("so.%s").setStaticLibraryExtension("a") .setObjectFileExtension("o") .setSharedLibraryInterfaceFactory(config.shouldUseSharedLibraryInterfaces() ? Optional.of(ElfSharedLibraryInterfaceFactory.of(new ConstantToolProvider( getGccTool(toolchainPaths, "objcopy", version, executableFinder)))) : Optional.empty()) .setHeaderVerification(config.getHeaderVerification()); if (cxxRuntime != CxxRuntime.SYSTEM) { cxxPlatformBuilder.putRuntimeLdflags(Linker.LinkableDepType.SHARED, "-l" + cxxRuntime.getSharedName()); cxxPlatformBuilder.putRuntimeLdflags(Linker.LinkableDepType.STATIC, "-l" + cxxRuntime.getStaticName()); } CxxPlatform cxxPlatform = cxxPlatformBuilder.build(); return NdkCxxPlatform.builder().setCxxPlatform(cxxPlatform).setCxxRuntime(cxxRuntime) .setCxxSharedRuntimePath( toolchainPaths.getCxxRuntimeLibsDirectory().resolve(cxxRuntime.getSoname())) .setObjdump(getGccTool(toolchainPaths, "objdump", version, executableFinder)).build(); }
From source file:org.elasticsearch.transport.ActionNames.java
private static void addNodeAction(String name, String pre_14_name, ImmutableBiMap.Builder<String, String> builder) { builder.put(name, pre_14_name);//from w ww. j av a2 s .com builder.put(name + "[n]", pre_14_name + "/n"); }
From source file:com.qubole.quark.planner.QuarkCube.java
private ImmutableBiMap<Integer, Integer> getDimensionToCubeColumnMap(QuarkTable quarkTable, Lattice.Builder latticeBuilder) { ImmutableBiMap.Builder<Integer, Integer> builder = ImmutableBiMap.builder(); for (Dimension dimension : dimensions) { final Lattice.Column column = latticeBuilder.resolveColumn(dimension.qualifiedCol); builder.put(column.ordinal, quarkTable.getFieldOrdinal(dimension.cubeColumn)); }/*from www .j a va 2 s . c om*/ return builder.build(); }
From source file:org.elasticsearch.transport.ActionNames.java
private static void addShardAction(String name, String pre_14_name, ImmutableBiMap.Builder<String, String> builder) { builder.put(name, pre_14_name);// w ww. ja va 2 s. c om builder.put(name + "[s]", pre_14_name + "/s"); }
From source file:org.pircbotx.UserChannelDao.java
/** * Create an immutable snapshot (copy) of all of contained Users, Channels, * and mappings, VERY EXPENSIVE.//from w ww. j av a 2 s .c o m * * @return Copy of entire model */ @Synchronized("accessLock") public UserChannelDaoSnapshot createSnapshot() { //Create snapshots of all users and channels Map<U, UserSnapshot> userSnapshotMap = Maps.newHashMapWithExpectedSize(userNickMap.size()); for (U curUser : userNickMap.values()) userSnapshotMap.put(curUser, curUser.createSnapshot()); Map<C, ChannelSnapshot> channelSnapshotMap = Maps.newHashMapWithExpectedSize(channelNameMap.size()); for (C curChannel : channelNameMap.values()) channelSnapshotMap.put(curChannel, curChannel.createSnapshot()); //Make snapshots of the relationship maps using the above user and channel snapshots UserChannelMapSnapshot mainMapSnapshot = mainMap.createSnapshot(userSnapshotMap, channelSnapshotMap); EnumMap<UserLevel, UserChannelMap<UserSnapshot, ChannelSnapshot>> levelsMapSnapshot = Maps .newEnumMap(UserLevel.class); for (Map.Entry<UserLevel, UserChannelMap<U, C>> curLevel : levelsMap.entrySet()) levelsMapSnapshot.put(curLevel.getKey(), curLevel.getValue().createSnapshot(userSnapshotMap, channelSnapshotMap)); ImmutableBiMap.Builder<String, UserSnapshot> userNickMapSnapshotBuilder = ImmutableBiMap.builder(); for (Map.Entry<String, U> curNickEntry : userNickMap.entrySet()) userNickMapSnapshotBuilder.put(curNickEntry.getKey(), userSnapshotMap.get(curNickEntry.getValue())); ImmutableBiMap.Builder<String, ChannelSnapshot> channelNameMapSnapshotBuilder = ImmutableBiMap.builder(); for (Map.Entry<String, C> curName : channelNameMap.entrySet()) channelNameMapSnapshotBuilder.put(curName.getKey(), channelSnapshotMap.get(curName.getValue())); ImmutableBiMap.Builder<String, UserSnapshot> privateUserSnapshotBuilder = ImmutableBiMap.builder(); for (Map.Entry<String, U> curNickEntry : privateUsers.entrySet()) privateUserSnapshotBuilder.put(curNickEntry.getKey(), userSnapshotMap.get(curNickEntry.getValue())); //Finally can create the snapshot object UserChannelDaoSnapshot daoSnapshot = new UserChannelDaoSnapshot(bot, locale, mainMapSnapshot, levelsMapSnapshot, userNickMapSnapshotBuilder.build(), channelNameMapSnapshotBuilder.build(), privateUserSnapshotBuilder.build()); //Tell UserSnapshots and ChannelSnapshots what the new backing dao is for (UserSnapshot curUserSnapshot : userSnapshotMap.values()) curUserSnapshot.setDao(daoSnapshot); for (ChannelSnapshot curChannelSnapshot : channelSnapshotMap.values()) curChannelSnapshot.setDao(daoSnapshot); //Finally return daoSnapshot; }