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

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

Introduction

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

Prototype

public static <K, V> ImmutableBiMap<K, V> of(K k1, V v1) 

Source Link

Usage

From source file:com.facebook.buck.android.NdkCxxPlatform.java

public NdkCxxPlatform(Flavor flavor, Platform platform, Path ndkRoot, TargetConfiguration targetConfiguration) {

    Preconditions.checkArgument(platform.equals(Platform.MACOS) || platform.equals(Platform.LINUX),
            "NDKCxxPlatform can only currently run on MacOS or Linux.");
    Host host = Preconditions.checkNotNull(BUILD_PLATFORMS.get(platform));

    this.flavor = Preconditions.checkNotNull(flavor);

    this.as = getTool(ndkRoot, targetConfiguration, host, "as");

    // Default assembler flags added by the NDK to enforce the NX (no execute) security feature.
    this.asflags = ImmutableList.of("--noexecstack");

    this.aspp = getTool(ndkRoot, targetConfiguration, host, "gcc");
    this.asppflags = ImmutableList.of();
    this.cc = getTool(ndkRoot, targetConfiguration, host, "gcc");
    this.cflags = getCflagsInternal(targetConfiguration);
    this.cpp = getTool(ndkRoot, targetConfiguration, host, "gcc");
    this.cppflags = getCppflags(ndkRoot, targetConfiguration, host);
    this.cxx = getTool(ndkRoot, targetConfiguration, host, "g++");
    this.cxxflags = getCxxflagsInternal(targetConfiguration);
    this.cxxpp = getTool(ndkRoot, targetConfiguration, host, "g++");
    this.cxxppflags = getCxxppflags(ndkRoot, targetConfiguration, host);
    this.cxxld = getTool(ndkRoot, targetConfiguration, host, "g++");
    this.cxxldflags = getCxxldflags(ndkRoot, targetConfiguration);
    this.ld = new GnuLinker(getTool(ndkRoot, targetConfiguration, host, "ld.gold"));

    // Default linker flags added by the NDK to enforce the NX (no execute) security feature.
    this.ldflags = ImmutableList.of("-z", "noexecstack");

    this.ar = getTool(ndkRoot, targetConfiguration, host, "ar");
    this.arflags = ImmutableList.of();

    this.debugPathSanitizer = Optional.of(new DebugPathSanitizer(250, File.separatorChar, Paths.get("."),
            ImmutableBiMap.of(ndkRoot, Paths.get("./."))));
}

From source file:org.apache.uima.lucas.indexer.analysis.AnnotationTokenStream.java

/**
 * Creates a TokenStream which extracts all feature values of a given feature name from
 * annotations with a given type from a given JCas object. Each token has the start and end offset
 * of the annotation and uses the feature value as term text.
 * /*ww  w  .j a  v  a  2 s .  co  m*/
 * @param jCas
 *          the JCas object
 * @param sofaName the name of the subject of analysis (sofa)
 * @param typeName
 *          the type of the annotation
 * @param featureName
 *          the name of the feature from which the token text is build
 * @param featureFormat
 *          optional format object to convert feature values to strings
 * @throws InvalidTokenSourceException
 */

public AnnotationTokenStream(JCas jCas, String sofaName, String typeName, String featureName,
        Format featureFormat) throws InvalidTokenSourceException {
    this(jCas, sofaName, typeName, null, Lists.newArrayList(featureName), null,
            featureFormat != null ? ImmutableBiMap.of(featureName, featureFormat)
                    : Collections.<String, Format>emptyMap());
}

From source file:com.isotrol.impe3.pms.core.obj.PortalObject.java

private static ImmutableMap<UUID, DiPObj> deviceMap(DeviceEntity entity) {
    return ImmutableBiMap.of(entity.getId(), new DiPObj(entity));
}

From source file:org.opendaylight.yangtools.yang.parser.stmt.rfc6020.Utils.java

static RevisionAwareXPath parseXPath(final StmtContext<?, ?, ?> ctx, final String path) {
    final XPath xPath = XPATH_FACTORY.get().newXPath();
    xPath.setNamespaceContext(StmtNamespaceContext.create(ctx,
            ImmutableBiMap.of(RFC6020_YANG_NAMESPACE.toString(), YANG_XPATH_FUNCTIONS_PREFIX)));

    final String trimmed = trimSingleLastSlashFromXPath(path);
    try {/*from   w  w w.  j  av  a 2  s. c o  m*/
        // XPath extension functions have to be prefixed
        // yang-specific XPath functions are in fact extended functions, therefore we have to add
        // "yang" prefix to them so that they can be properly validated with the XPath.compile() method
        // the "yang" prefix is bound to RFC6020 YANG namespace
        final String prefixedXPath = addPrefixToYangXPathFunctions(trimmed, ctx);
        // TODO: we could capture the result and expose its 'evaluate' method
        xPath.compile(prefixedXPath);
    } catch (final XPathExpressionException e) {
        LOG.warn("Argument \"{}\" is not valid XPath string at \"{}\"", path, ctx.getStatementSourceReference(),
                e);
    }

    return new RevisionAwareXPathImpl(path, PATH_ABS.matcher(path).matches());
}