Example usage for com.google.common.collect ImmutableSortedMap containsKey

List of usage examples for com.google.common.collect ImmutableSortedMap containsKey

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableSortedMap containsKey.

Prototype

boolean containsKey(Object key);

Source Link

Document

Returns true if this map contains a mapping for the specified key.

Usage

From source file:kr.co.bitnine.octopus.engine.calcite.SimpleCalciteSchema.java

protected void addImplicitSubSchemaToBuilder(ImmutableSortedMap.Builder<String, CalciteSchema> builder) {
    ImmutableSortedMap<String, CalciteSchema> explicitSubSchemas = builder.build();
    for (String schemaName : getSchema().getSubSchemaNames()) {
        if (explicitSubSchemas.containsKey(schemaName)) {
            // explicit subschema wins.
            continue;
        }/*from w w w  .  j a  va2 s. co  m*/
        Schema s = getSchema().getSubSchema(schemaName);
        if (s != null) {
            CalciteSchema calciteSchema = new SimpleCalciteSchema(this, s, schemaName);
            builder.put(schemaName, calciteSchema);
        }
    }
}

From source file:org.apache.calcite.jdbc.SimpleCalciteSchema.java

protected void addImplicitSubSchemaToBuilder(ImmutableSortedMap.Builder<String, CalciteSchema> builder) {
    ImmutableSortedMap<String, CalciteSchema> explicitSubSchemas = builder.build();
    for (String schemaName : schema.getSubSchemaNames()) {
        if (explicitSubSchemas.containsKey(schemaName)) {
            // explicit subschema wins.
            continue;
        }/*w  w  w .ja  v a  2 s .com*/
        Schema s = schema.getSubSchema(schemaName);
        if (s != null) {
            CalciteSchema calciteSchema = new SimpleCalciteSchema(this, s, schemaName);
            builder.put(schemaName, calciteSchema);
        }
    }
}

From source file:kr.co.bitnine.octopus.engine.calcite.SimpleCalciteSchema.java

protected void addImplicitTablesBasedOnNullaryFunctionsToBuilder(
        ImmutableSortedMap.Builder<String, Table> builder) {
    ImmutableSortedMap<String, Table> explicitTables = builder.build();

    for (String s : getSchema().getFunctionNames()) {
        // explicit table wins.
        if (explicitTables.containsKey(s)) {
            continue;
        }// w w w .j  av  a 2  s . co  m
        for (Function function : getSchema().getFunctions(s)) {
            if (function instanceof TableMacro && function.getParameters().isEmpty()) {
                final Table table = ((TableMacro) function).apply(ImmutableList.of());
                builder.put(s, table);
            }
        }
    }
}

From source file:org.apache.calcite.jdbc.SimpleCalciteSchema.java

protected void addImplicitTablesBasedOnNullaryFunctionsToBuilder(
        ImmutableSortedMap.Builder<String, Table> builder) {
    ImmutableSortedMap<String, Table> explicitTables = builder.build();

    for (String s : schema.getFunctionNames()) {
        // explicit table wins.
        if (explicitTables.containsKey(s)) {
            continue;
        }//from  w  w  w . j  a  v a 2 s.  c  o  m
        for (Function function : schema.getFunctions(s)) {
            if (function instanceof TableMacro && function.getParameters().isEmpty()) {
                final Table table = ((TableMacro) function).apply(ImmutableList.of());
                builder.put(s, table);
            }
        }
    }
}

From source file:com.facebook.buck.core.build.engine.buildinfo.DefaultOnDiskBuildInfo.java

@Override
public ImmutableSortedMap<String, String> getMetadataForArtifact() throws IOException {
    ImmutableSortedMap<String, String> metadata = ImmutableSortedMap
            .copyOf(buildInfoStore.getAllMetadata(buildTarget));

    Preconditions.checkState(metadata.containsKey(BuildInfo.MetadataKey.ORIGIN_BUILD_ID),
            "Cache artifact for build target %s is missing metadata %s.", buildTarget,
            BuildInfo.MetadataKey.ORIGIN_BUILD_ID);

    return metadata;
}

From source file:kr.co.bitnine.octopus.engine.calcite.CachingCalciteSchema.java

protected void addImplicitTablesBasedOnNullaryFunctionsToBuilder(
        ImmutableSortedMap.Builder<String, Table> builder) {
    ImmutableSortedMap<String, Table> explicitTables = builder.build();

    for (String s : implicitFunctionCache.get(System.currentTimeMillis())) {
        // explicit table wins.
        if (explicitTables.containsKey(s)) {
            continue;
        }// ww  w. j a va 2  s  .  c  o  m
        for (Function function : getSchema().getFunctions(s)) {
            if (function instanceof TableMacro && function.getParameters().isEmpty()) {
                final Table table = ((TableMacro) function).apply(ImmutableList.of());
                builder.put(s, table);
            }
        }
    }
}

From source file:org.apache.calcite.jdbc.CachingCalciteSchema.java

protected void addImplicitTablesBasedOnNullaryFunctionsToBuilder(
        ImmutableSortedMap.Builder<String, Table> builder) {
    ImmutableSortedMap<String, Table> explicitTables = builder.build();

    final long now = System.currentTimeMillis();
    final NameSet set = implicitFunctionCache.get(now);
    for (String s : set.iterable()) {
        // explicit table wins.
        if (explicitTables.containsKey(s)) {
            continue;
        }//w  w w.ja v a 2  s .c om
        for (Function function : schema.getFunctions(s)) {
            if (function instanceof TableMacro && function.getParameters().isEmpty()) {
                final Table table = ((TableMacro) function).apply(ImmutableList.of());
                builder.put(s, table);
            }
        }
    }
}

From source file:org.apache.calcite.jdbc.CachingCalciteSchema.java

protected void addImplicitSubSchemaToBuilder(ImmutableSortedMap.Builder<String, CalciteSchema> builder) {
    ImmutableSortedMap<String, CalciteSchema> explicitSubSchemas = builder.build();
    final long now = System.currentTimeMillis();
    final SubSchemaCache subSchemaCache = implicitSubSchemaCache.get(now);
    for (String name : subSchemaCache.names.iterable()) {
        if (explicitSubSchemas.containsKey(name)) {
            // explicit sub-schema wins.
            continue;
        }//w  w  w  .j  av  a  2s .c  o m
        builder.put(name, subSchemaCache.cache.getUnchecked(name));
    }
}

From source file:kr.co.bitnine.octopus.engine.calcite.CachingCalciteSchema.java

protected void addImplicitSubSchemaToBuilder(ImmutableSortedMap.Builder<String, CalciteSchema> builder) {
    ImmutableSortedMap<String, CalciteSchema> explicitSubSchemas = builder.build();
    final long now = System.currentTimeMillis();
    final SubSchemaCache subSchemaCache = implicitSubSchemaCache.get(now);
    for (String name : subSchemaCache.names) {
        if (explicitSubSchemas.containsKey(name)) {
            // explicit sub-schema wins.
            continue;
        }/*from   www  .j  a  v  a2s .c  o  m*/
        builder.put(name, subSchemaCache.cache.getUnchecked(name));
    }
}

From source file:com.facebook.buck.jvm.java.AbstractDefaultJavaLibraryClasspaths.java

@Value.Lazy
public ImmutableList<JavaDependencyInfo> getDependencyInfos() {
    ImmutableList.Builder<JavaDependencyInfo> builder = ImmutableList.builder();

    ImmutableSortedMap<BuildTarget, BuildRule> abiDeps = toLibraryTargetKeyedMap(
            getCompileTimeClasspathAbiDeps());
    ImmutableSortedMap<BuildTarget, BuildRule> sourceOnlyAbiDeps = toLibraryTargetKeyedMap(
            getSourceOnlyAbiClasspaths().getCompileTimeClasspathDeps());

    for (BuildRule compileTimeDep : getCompileTimeClasspathDeps()) {
        Preconditions.checkState(compileTimeDep instanceof HasJavaAbi);

        BuildTarget compileTimeDepLibraryTarget = toLibraryTarget(compileTimeDep);

        boolean requiredForSourceOnlyAbi = sourceOnlyAbiDeps.containsKey(compileTimeDepLibraryTarget);
        boolean isAbiDep = abiDeps.containsKey(compileTimeDepLibraryTarget);

        SourcePath compileTimeSourcePath = compileTimeDep.getSourcePathToOutput();

        // Some deps might not actually contain any source files. In that case, they have no output.
        // Just skip them.
        if (compileTimeSourcePath == null) {
            continue;
        }//from w ww  .  j a  va2  s .c o m

        SourcePath abiClasspath;
        if (isAbiDep) {
            abiClasspath = Objects
                    .requireNonNull(abiDeps.get(compileTimeDepLibraryTarget).getSourcePathToOutput());
        } else {
            abiClasspath = compileTimeSourcePath;
        }

        builder.add(new JavaDependencyInfo(compileTimeSourcePath, abiClasspath, requiredForSourceOnlyAbi));
    }

    return builder.build();
}