Example usage for com.google.common.collect ImmutableMultimap of

List of usage examples for com.google.common.collect ImmutableMultimap of

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableMultimap of.

Prototype

public static <K, V> ImmutableMultimap<K, V> of() 

Source Link

Document

Returns an empty multimap.

Usage

From source file:org.apache.calcite.adapter.jdbc.JdbcSchema.java

protected Multimap<String, Function> getFunctions() {
    // TODO: populate map from JDBC metadata
    return ImmutableMultimap.of();
}

From source file:uk.ac.open.kmi.iserve.sal.manager.impl.ServiceManagerIndexRdf.java

/**
 * Given an operation, this method obtains the list of output URIs mapped to their annotated types (i.e., modelReferences).
 * Note that the same input may have several annotations indicating the type.
 *
 * @param operationUri the URI for which we want to obtain the outputs and their annotated types
 * @return a Multimap with the outputs and their corresponding types.
 *//*from  w w w  . jav a 2  s  .  c  o m*/
@Override
public Multimap<URI, URI> listTypedOutputs(URI operationUri) {
    if (operationUri == null) {
        return ImmutableMultimap.of();
    }

    ImmutableMultimap.Builder<URI, URI> result = ImmutableMultimap.builder();
    for (URI output : this.opOutputMap.get(operationUri)) {
        result.putAll(output, this.modelReferencesMap.get(output));
    }

    return result.build();
}

From source file:com.isotrol.impe3.nr.api.Node.java

public Multimap<String, String> getHighlight() {
    if (highlight == null) {
        if (highlightMap != null) {
            ImmutableMultimap.Builder<String, String> b = ImmutableMultimap.builder();
            for (Entry<String, Collection<String>> entry : highlightMap.entrySet()) {
                final Collection<String> values = entry.getValue();
                if (values != null) {
                    b.putAll(entry.getKey(), values);
                }/*from ww  w  .  j  a  v  a 2  s.com*/
            }
            highlight = b.build();
        } else {
            highlight = ImmutableMultimap.of();
        }
    }
    return highlight;
}

From source file:org.apache.brooklyn.core.mgmt.rebind.dto.AbstractMemento.java

protected <K, V> Multimap<K, V> fromPersistedMultimap(Multimap<K, V> m) {
    if (m == null)
        return ImmutableMultimap.of();
    return ImmutableMultimap.copyOf(m);
}

From source file:com.facebook.buck.features.d.DDescriptionUtils.java

public static SymlinkTree createSourceSymlinkTree(BuildTarget target, ProjectFilesystem projectFilesystem,
        SourcePathResolver pathResolver, SourcePathRuleFinder ruleFinder, SourceSortedSet sources) {
    Preconditions.checkState(target.getFlavors().contains(SOURCE_LINK_TREE));
    return new SymlinkTree("d_src", target, projectFilesystem,
            BuildTargetPaths.getGenPath(projectFilesystem, target, "%s"),
            MoreMaps.transformKeys(sources.toNameMap(target, pathResolver, "srcs"),
                    MorePaths.toPathFn(projectFilesystem.getRootPath().getFileSystem())),
            ImmutableMultimap.of(), ruleFinder);
}

From source file:com.facebook.buck.lua.AbstractNativeExecutableStarter.java

private NativeLinkableInput getNativeLinkableInput() throws NoSuchBuildTargetException {
    Iterable<? extends AbstractCxxLibrary> nativeStarterDeps = getNativeStarterDeps();
    ImmutableMap<CxxPreprocessAndCompile, SourcePath> objects = CxxSourceRuleFactory
            .requirePreprocessAndCompileRules(getBaseParams(), getRuleResolver(), getPathResolver(),
                    getRuleFinder(), getCxxBuckConfig(), getCxxPlatform(),
                    ImmutableList.<CxxPreprocessorInput>builder()
                            .add(CxxPreprocessorInput.builder()
                                    .putAllPreprocessorFlags(CxxSource.Type.CXX,
                                            getNativeStarterLibrary().isPresent() ? ImmutableList.of()
                                                    : ImmutableList.of("-DBUILTIN_NATIVE_STARTER"))
                                    .build())
                            .addAll(getTransitiveCxxPreprocessorInput(getCxxPlatform(), nativeStarterDeps))
                            .build(),// ww  w.  ja  v  a 2 s. c  o  m
                    ImmutableMultimap.of(), Optional.empty(), Optional.empty(),
                    ImmutableMap.of("native-starter.cpp", getNativeStarterCxxSource()),
                    CxxSourceRuleFactory.PicType.PDC, Optional.empty());
    return NativeLinkableInput.builder()
            .addAllArgs(getRelativeNativeLibsDir().isPresent() ? StringArg.from(Linkers.iXlinker("-rpath",
                    String.format("%s/%s", getCxxPlatform().getLd().resolve(getRuleResolver()).origin(),
                            getRelativeNativeLibsDir().get().toString())))
                    : ImmutableList.of())
            .addAllArgs(SourcePathArg.from(getPathResolver(), objects.values())).build();
}

From source file:com.facebook.buck.features.lua.AbstractNativeExecutableStarter.java

private NativeLinkableInput getNativeLinkableInput() {
    Iterable<? extends AbstractCxxLibrary> nativeStarterDeps = getNativeStarterDeps();
    ImmutableMap<CxxPreprocessAndCompile, SourcePath> objects = CxxSourceRuleFactory
            .of(getProjectFilesystem(), getBaseTarget(), getActionGraphBuilder(), getPathResolver(),
                    getRuleFinder(), getCxxBuckConfig(), getLuaPlatform().getCxxPlatform(),
                    ImmutableList.<CxxPreprocessorInput>builder()
                            .add(CxxPreprocessorInput.builder()
                                    .putAllPreprocessorFlags(CxxSource.Type.CXX,
                                            getNativeStarterLibrary().isPresent() ? ImmutableList.of()
                                                    : StringArg.from("-DBUILTIN_NATIVE_STARTER"))
                                    .build())
                            .addAll(getTransitiveCxxPreprocessorInput(getLuaPlatform().getCxxPlatform(),
                                    nativeStarterDeps))
                            .build(),/*w  w  w .jav a2s  .  co  m*/
                    ImmutableMultimap.of(), Optional.empty(), Optional.empty(), PicType.PDC)
            .requirePreprocessAndCompileRules(
                    ImmutableMap.of("native-starter.cpp", getNativeStarterCxxSource()));
    return NativeLinkableInput.builder()
            .addAllArgs(getRelativeNativeLibsDir().isPresent()
                    ? StringArg.from(Linkers.iXlinker("-rpath",
                            String.format("%s/%s",
                                    getLuaPlatform().getCxxPlatform().getLd().resolve(getActionGraphBuilder())
                                            .origin(),
                                    getRelativeNativeLibsDir().get().toString())))
                    : ImmutableList.of())
            .addAllArgs(SourcePathArg.from(objects.values())).build();
}

From source file:com.facebook.buck.cxx.toolchain.DefaultCxxPlatforms.java

public static CxxPlatform build(Platform platform, CxxBuckConfig config) {
    String sharedLibraryExtension;
    String sharedLibraryVersionedExtensionFormat;
    String staticLibraryExtension;
    String objectFileExtension;/*from w w  w  . j  a va2  s  .  c  o m*/
    Path defaultCFrontend;
    Path defaultCxxFrontend;
    Path defaultLinker;
    LinkerProvider.Type linkerType;
    Archiver archiver;
    DebugPathSanitizer compilerSanitizer;
    Optional<String> binaryExtension;
    ImmutableMap<String, String> env = config.getEnvironment();
    Optional<CxxToolProvider.Type> defaultToolType = Optional.empty();
    Optional<ToolProvider> ranlib;
    PicType picTypeForSharedLinking;

    switch (platform) {
    case LINUX:
        sharedLibraryExtension = "so";
        sharedLibraryVersionedExtensionFormat = "so.%s";
        staticLibraryExtension = "a";
        objectFileExtension = "o";
        defaultCFrontend = getExecutablePath("gcc", DEFAULT_C_FRONTEND, env);
        defaultCxxFrontend = getExecutablePath("g++", DEFAULT_CXX_FRONTEND, env);
        defaultLinker = defaultCxxFrontend;
        linkerType = LinkerProvider.Type.GNU;
        archiver = new GnuArchiver(getHashedFileTool(config, "ar", DEFAULT_AR, env));
        compilerSanitizer = new PrefixMapDebugPathSanitizer(".", ImmutableBiMap.of());
        binaryExtension = Optional.empty();
        ranlib = Optional.of(
                new ConstantToolProvider(getHashedFileTool(config, DEFAULT_UNIX_RANLIB, DEFAULT_RANLIB, env)));
        picTypeForSharedLinking = PicType.PIC;
        break;
    case MACOS:
        sharedLibraryExtension = "dylib";
        sharedLibraryVersionedExtensionFormat = ".%s.dylib";
        staticLibraryExtension = "a";
        objectFileExtension = "o";
        defaultCFrontend = getExecutablePath("clang", DEFAULT_OSX_C_FRONTEND, env);
        defaultCxxFrontend = getExecutablePath("clang++", DEFAULT_OSX_CXX_FRONTEND, env);
        defaultLinker = defaultCxxFrontend;
        linkerType = LinkerProvider.Type.DARWIN;
        archiver = new BsdArchiver(getHashedFileTool(config, "ar", DEFAULT_AR, env));
        compilerSanitizer = new PrefixMapDebugPathSanitizer(".", ImmutableBiMap.of());
        binaryExtension = Optional.empty();
        ranlib = Optional.of(
                new ConstantToolProvider(getHashedFileTool(config, DEFAULT_UNIX_RANLIB, DEFAULT_RANLIB, env)));
        picTypeForSharedLinking = PicType.PIC;
        break;
    case WINDOWS:
        sharedLibraryExtension = "dll";
        sharedLibraryVersionedExtensionFormat = "dll";
        staticLibraryExtension = "lib";
        objectFileExtension = "obj";
        defaultCFrontend = getExecutablePath(DEFAULT_WINDOWS_CXX_FRONTEND,
                Paths.get(DEFAULT_WINDOWS_CXX_FRONTEND), env);
        defaultCxxFrontend = getExecutablePath(DEFAULT_WINDOWS_CXX_FRONTEND,
                Paths.get(DEFAULT_WINDOWS_CXX_FRONTEND), env);
        defaultLinker = getExecutablePath(DEFAULT_WINDOWS_LINK, Paths.get(DEFAULT_WINDOWS_LINK), env);
        linkerType = LinkerProvider.Type.WINDOWS;
        archiver = new WindowsArchiver(
                getHashedFileTool(config, DEFAULT_WINDOWS_LIB, Paths.get(DEFAULT_WINDOWS_LIB), env));
        compilerSanitizer = new PrefixMapDebugPathSanitizer(".", ImmutableBiMap.of());
        binaryExtension = Optional.of("exe");
        defaultToolType = Optional.of(CxxToolProvider.Type.WINDOWS);
        ranlib = Optional.empty();
        picTypeForSharedLinking = PicType.PDC;
        break;
    case FREEBSD:
        sharedLibraryExtension = "so";
        sharedLibraryVersionedExtensionFormat = "so.%s";
        staticLibraryExtension = "a";
        objectFileExtension = "o";
        defaultCFrontend = getExecutablePath("gcc", DEFAULT_C_FRONTEND, env);
        defaultCxxFrontend = getExecutablePath("g++", DEFAULT_CXX_FRONTEND, env);
        defaultLinker = defaultCxxFrontend;
        linkerType = LinkerProvider.Type.GNU;
        archiver = new BsdArchiver(getHashedFileTool(config, "ar", DEFAULT_AR, env));
        compilerSanitizer = new PrefixMapDebugPathSanitizer(".", ImmutableBiMap.of());
        binaryExtension = Optional.empty();
        ranlib = Optional.of(
                new ConstantToolProvider(getHashedFileTool(config, DEFAULT_UNIX_RANLIB, DEFAULT_RANLIB, env)));
        picTypeForSharedLinking = PicType.PIC;
        break;
    // $CASES-OMITTED$
    default:
        throw new RuntimeException(String.format("Unsupported platform: %s", platform));
    }

    // These are wrapped behind suppliers because config.getSourcePath() verifies that the path
    // exists and we only want to do that verification if the tool is actually needed.
    Supplier<PathSourcePath> cFrontendPath = MoreSuppliers
            .memoize(() -> config.getSourcePath(defaultCFrontend));
    ToolProvider defaultCFrontendSupplier = new ConstantToolProvider(getToolchainTool(cFrontendPath));
    Supplier<PathSourcePath> cxxFrontendPath = MoreSuppliers
            .memoize(() -> config.getSourcePath(defaultCxxFrontend));
    ToolProvider defaultCxxFrontendSupplier = new ConstantToolProvider(getToolchainTool(cxxFrontendPath));

    Optional<Type> finalDefaultToolType = defaultToolType;
    Supplier<Type> cFrontendType = MoreSuppliers.memoize(() -> finalDefaultToolType
            .orElseGet(() -> CxxToolTypeInferer.getTypeFromPath(cFrontendPath.get())));
    Supplier<Type> cxxFrontendType = MoreSuppliers.memoize(() -> finalDefaultToolType
            .orElseGet(() -> CxxToolTypeInferer.getTypeFromPath(cxxFrontendPath.get())));

    PreprocessorProvider aspp = new PreprocessorProvider(defaultCFrontendSupplier, cFrontendType);
    CompilerProvider as = new CompilerProvider(defaultCFrontendSupplier, cFrontendType,
            config.getUseDetailedUntrackedHeaderMessages());

    PreprocessorProvider cpp = new PreprocessorProvider(defaultCFrontendSupplier, cFrontendType);
    CompilerProvider cc = new CompilerProvider(defaultCFrontendSupplier, cFrontendType,
            config.getUseDetailedUntrackedHeaderMessages());

    PreprocessorProvider cxxpp = new PreprocessorProvider(defaultCxxFrontendSupplier, cxxFrontendType);
    CompilerProvider cxx = new CompilerProvider(defaultCxxFrontendSupplier, cxxFrontendType,
            config.getUseDetailedUntrackedHeaderMessages());

    return CxxPlatforms.build(FLAVOR, platform, config, as, aspp, cc, cxx, cpp, cxxpp,
            new DefaultLinkerProvider(linkerType,
                    new ConstantToolProvider(getToolchainTool(() -> config.getSourcePath(defaultLinker))),
                    config.shouldCacheLinks()),
            ImmutableList.of(), ImmutableMultimap.of(), getHashedFileTool(config, "strip", DEFAULT_STRIP, env),
            ArchiverProvider.from(archiver), ArchiveContents.NORMAL, ranlib,
            new PosixNmSymbolNameTool(getHashedFileTool(config, "nm", DEFAULT_NM, env)), ImmutableList.of(),
            ImmutableList.of(), ImmutableList.of(), ImmutableList.of(), ImmutableList.of(), ImmutableList.of(),
            sharedLibraryExtension, sharedLibraryVersionedExtensionFormat, staticLibraryExtension,
            objectFileExtension, compilerSanitizer,
            new MungingDebugPathSanitizer(config.getDebugPathSanitizerLimit(), File.separatorChar,
                    Paths.get("."), ImmutableBiMap.of()),
            ImmutableMap.of(), binaryExtension, config.getHeaderVerificationOrIgnore(),
            picTypeForSharedLinking);
}

From source file:org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiAnalysis.java

/**
 * Map of pre-defined charts, for every table class names.
 *
 * If a table class is not in this map then it means that table has no
 * predefined charts.//from  w  w  w.  ja  va  2 s.  c o  m
 *
 * @return The chart models, per table class names
 */
protected Multimap<String, LamiChartModel> getPredefinedCharts() {
    return ImmutableMultimap.of();
}

From source file:io.druid.sql.calcite.DruidSchema.java

@Override
protected Multimap<String, Function> getFunctionMultimap() {
    return ImmutableMultimap.of();
}