com.google.common.collect.ImmutableSortedMap#containsKey ( )源码实例Demo

下面列出了com.google.common.collect.ImmutableSortedMap#containsKey ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Bats   文件: 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;
    }
    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);
      }
    }
  }
}
 
源代码2 项目: Bats   文件: 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;
        }
        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);
            }
        }
    }
}
 
源代码3 项目: Quicksql   文件: 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;
    }
    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);
      }
    }
  }
}
 
源代码4 项目: Quicksql   文件: 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;
    }
    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);
      }
    }
  }
}
 
源代码5 项目: calcite   文件: 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;
    }
    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);
      }
    }
  }
}
 
源代码6 项目: calcite   文件: 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;
    }
    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);
      }
    }
  }
}
 
源代码7 项目: bazel   文件: NinjaBuild.java
private static NestedSet<Artifact> getGroupArtifacts(
    RuleContext ruleContext,
    List<String> targets,
    ImmutableSortedMap<PathFragment, PhonyTarget> phonyTargetsMap,
    PhonyTargetArtifacts phonyTargetsArtifacts,
    NinjaGraphArtifactsHelper artifactsHelper)
    throws GenericParsingException {
  NestedSetBuilder<Artifact> nestedSetBuilder = NestedSetBuilder.stableOrder();
  for (String target : targets) {
    PathFragment path = PathFragment.create(target);
    if (phonyTargetsMap.containsKey(path)) {
      NestedSet<Artifact> artifacts = phonyTargetsArtifacts.getPhonyTargetArtifacts(path);
      nestedSetBuilder.addTransitive(artifacts);
    } else {
      Artifact outputArtifact = artifactsHelper.createOutputArtifact(path);
      if (outputArtifact == null) {
        ruleContext.ruleError(
            String.format("Required target '%s' is not created in ninja_graph.", path));
        return NestedSetBuilder.emptySet(Order.STABLE_ORDER);
      }
      nestedSetBuilder.add(outputArtifact);
    }
  }
  return nestedSetBuilder.build();
}
 
源代码8 项目: Bats   文件: 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;
    }
    builder.put(name, subSchemaCache.cache.getUnchecked(name));
  }
}
 
源代码9 项目: Bats   文件: 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;
        }
        Schema s = schema.getSubSchema(schemaName);
        if (s != null) {
            CalciteSchema calciteSchema = new SimpleCalciteSchema(this, s, schemaName);
            builder.put(schemaName, calciteSchema);
        }
    }
}
 
源代码10 项目: Quicksql   文件: 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;
    }
    builder.put(name, subSchemaCache.cache.getUnchecked(name));
  }
}
 
源代码11 项目: Quicksql   文件: 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;
    }
    Schema s = schema.getSubSchema(schemaName);
    if (s != null) {
      CalciteSchema calciteSchema = new SimpleCalciteSchema(this, s, schemaName);
      builder.put(schemaName, calciteSchema);
    }
  }
}
 
源代码12 项目: 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.iterable()) {
    if (explicitSubSchemas.containsKey(name)) {
      // explicit sub-schema wins.
      continue;
    }
    builder.put(name, subSchemaCache.cache.getUnchecked(name));
  }
}
 
源代码13 项目: calcite   文件: 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;
    }
    Schema s = schema.getSubSchema(schemaName);
    if (s != null) {
      CalciteSchema calciteSchema = new SimpleCalciteSchema(this, s, schemaName);
      builder.put(schemaName, calciteSchema);
    }
  }
}
 
源代码14 项目: buck   文件: DefaultJavaLibraryClasspaths.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;
    }

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

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

  return builder.build();
}
 
源代码15 项目: buck   文件: LuaBinaryDescription.java
/**
 * @return the native library map with additional entries for library names with the version
 *     suffix stripped (e.g. libfoo.so.1.0 -> libfoo.so) to appease LuaJIT, which wants to load
 *     libraries using the build-time name.
 */
private ImmutableSortedMap<String, SourcePath> addVersionLessLibraries(
    CxxPlatform cxxPlatform, ImmutableSortedMap<String, SourcePath> libraries) {
  Pattern versionedExtension =
      Pattern.compile(
          Joiner.on("[.\\d]*")
              .join(
                  Iterables.transform(
                      Splitter.on("%s")
                          .split(cxxPlatform.getSharedLibraryVersionedExtensionFormat()),
                      input -> input.isEmpty() ? input : Pattern.quote(input))));
  Map<String, SourcePath> librariesPaths = new HashMap<>();
  for (Map.Entry<String, SourcePath> ent : libraries.entrySet()) {
    String name = ent.getKey();

    if (librariesPaths.containsKey(name) && librariesPaths.get(name) != ent.getValue()) {
      throw new HumanReadableException(
          "Library %s has multiple possible paths: %s and %s",
          name, ent.getValue(), librariesPaths.get(name));
    }

    librariesPaths.put(name, ent.getValue());
    Matcher matcher = versionedExtension.matcher(name);
    String versionLessName = matcher.replaceAll(cxxPlatform.getSharedLibraryExtension());
    if (!versionLessName.equals(ent.getKey()) && !libraries.containsKey(versionLessName)) {
      librariesPaths.put(versionLessName, ent.getValue());
    }
  }
  return ImmutableSortedMap.copyOf(librariesPaths);
}