Java Code Examples for com.google.common.collect.ImmutableSortedMap#containsKey()
The following examples show how to use
com.google.common.collect.ImmutableSortedMap#containsKey() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CachingCalciteSchema.java From Bats with Apache License 2.0 | 6 votes |
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); } } } }
Example 2
Source File: SimpleCalciteSchema.java From Bats with Apache License 2.0 | 6 votes |
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); } } } }
Example 3
Source File: CachingCalciteSchema.java From Quicksql with MIT License | 6 votes |
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); } } } }
Example 4
Source File: SimpleCalciteSchema.java From Quicksql with MIT License | 6 votes |
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); } } } }
Example 5
Source File: CachingCalciteSchema.java From calcite with Apache License 2.0 | 6 votes |
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); } } } }
Example 6
Source File: SimpleCalciteSchema.java From calcite with Apache License 2.0 | 6 votes |
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); } } } }
Example 7
Source File: NinjaBuild.java From bazel with Apache License 2.0 | 6 votes |
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(); }
Example 8
Source File: CachingCalciteSchema.java From Bats with Apache License 2.0 | 5 votes |
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)); } }
Example 9
Source File: SimpleCalciteSchema.java From Bats with Apache License 2.0 | 5 votes |
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); } } }
Example 10
Source File: CachingCalciteSchema.java From Quicksql with MIT License | 5 votes |
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)); } }
Example 11
Source File: SimpleCalciteSchema.java From Quicksql with MIT License | 5 votes |
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); } } }
Example 12
Source File: CachingCalciteSchema.java From calcite with Apache License 2.0 | 5 votes |
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)); } }
Example 13
Source File: SimpleCalciteSchema.java From calcite with Apache License 2.0 | 5 votes |
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); } } }
Example 14
Source File: DefaultJavaLibraryClasspaths.java From buck with Apache License 2.0 | 5 votes |
@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(); }
Example 15
Source File: LuaBinaryDescription.java From buck with Apache License 2.0 | 5 votes |
/** * @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); }