当前位置: 首页>>代码示例>>Java>>正文


Java ImmutableMap.containsKey方法代码示例

本文整理汇总了Java中com.google.common.collect.ImmutableMap.containsKey方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableMap.containsKey方法的具体用法?Java ImmutableMap.containsKey怎么用?Java ImmutableMap.containsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.collect.ImmutableMap的用法示例。


在下文中一共展示了ImmutableMap.containsKey方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extractLdpathNamespaces

import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
private ImmutableMap<String, String> extractLdpathNamespaces(Swagger swagger) {
  Map<String, Object> extensions = swagger.getVendorExtensions();
  ImmutableMap<String, Object> vendorExtensions =
      extensions == null ? ImmutableMap.of() : ImmutableMap.copyOf(extensions);
  if (vendorExtensions.containsKey(OpenApiSpecificationExtensions.LDPATH_NAMESPACES)) {
    Object ldPathNamespaces =
        vendorExtensions.get(OpenApiSpecificationExtensions.LDPATH_NAMESPACES);
    try {
      return ImmutableMap.copyOf((Map<String, String>) ldPathNamespaces);
    } catch (ClassCastException cce) {
      throw new LdPathExecutorRuntimeException(String.format(
          "Vendor extension '%s' should contain a map of namespaces (eg. "
              + "{ \"rdfs\": \"http://www.w3.org/2000/01/rdf-schema#\", "
              + "\"rdf\": \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"})",
          OpenApiSpecificationExtensions.LDPATH_NAMESPACES), cce);
    }
  }
  return ImmutableMap.of();
}
 
开发者ID:dotwebstack,项目名称:dotwebstack-framework,代码行数:20,代码来源:GraphEntity.java

示例2: fromResponses

import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
ResponsesAndLinking fromResponses(final ImmutableSet<Response> originalResponses,
    final ImmutableMap<Response, DocLevelEventArg> responseToDocLevelEventArg,
    final ResponseLinking responseLinking) {
  final DocLevelArgLinking.Builder linkingBuilder = new DocLevelArgLinking.Builder()
      .docID(responseLinking.docID());
  for (final ResponseSet rs : responseLinking.responseSets()) {
    final ScoringEventFrame.Builder eventFrameBuilder = new ScoringEventFrame.Builder();
    boolean addedArg = false;
    for (final Response response : rs) {
      if (responseToDocLevelEventArg.containsKey(response)) {
        eventFrameBuilder.addArguments(responseToDocLevelEventArg.get(response));
        addedArg = true;
      }
    }
    if (addedArg) {
      linkingBuilder.addEventFrames(eventFrameBuilder.build());
    }
  }
  return ResponsesAndLinking.of(responseToDocLevelEventArg.values(), linkingBuilder.build());
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:21,代码来源:ScoreKBPAgainstERE.java

示例3: merge

import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
/**
 * Perform the merging and return the result.
 *
 * @return an instance of {@link com.android.manifmerger.MergingReport} that will give
 * access to all the logging and merging records.
 *
 * This method can be invoked several time and will re-do the file merges.
 *
 * @throws MergeFailureException if the merging
 * cannot be completed successfully.
 */
public MergingReport merge() throws MergeFailureException {

    // provide some free placeholders values.
    ImmutableMap<SystemProperty, Object> systemProperties = mSystemProperties.build();
    if (systemProperties.containsKey(SystemProperty.PACKAGE)) {
        mPlaceholders.put(PACKAGE_NAME, systemProperties.get(SystemProperty.PACKAGE));
        mPlaceholders.put(APPLICATION_ID, systemProperties.get(SystemProperty.PACKAGE));
    }

    ManifestMerger2 manifestMerger =
            new ManifestMerger2(
                    mLogger,
                    mMainManifestFile,
                    mLibraryFilesBuilder.build(),
                    mFlavorsAndBuildTypeFiles.build(),
                    mFeaturesBuilder.build(),
                    mPlaceholders.build(),
                    new MapBasedKeyBasedValueResolver<SystemProperty>(systemProperties),
                    mMergeType,
                    Optional.fromNullable(mReportFile));
    return manifestMerger.merge();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:34,代码来源:ManifestMerger2.java

示例4: routed

import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
public static RecipeSource routed(final ImmutableMap<Identifier, RecipeSource> routes, final RecipeSource otherwise) {
    Preconditions.checkNotNull(routes);
    Preconditions.checkNotNull(otherwise);
    return new RecipeSource() {

        public Process<Event, Recipe> fetch (final RecipeIdentifier identifier) {
            if (identifier.source.isPresent()) {
                if (routes.containsKey(identifier.source.get())) {
                    return routes.get(identifier.source.get()).fetch(identifier);
                }
                return Process.error(new DependencyResolutionException(
                    "Could not fetch " + identifier.encode() + " because " + identifier.source.get() + " is not routed. "));
            }
            return otherwise.fetch(identifier);
        }

        public Iterable<RecipeIdentifier> findCandidates(PartialRecipeIdentifier partial) {
            if (partial.source.isPresent()) {
                if (routes.containsKey(partial.source.get())) {
                    return routes.get(partial.source.get()).findCandidates(partial);
                }
            }
            return otherwise.findCandidates(partial);
        }
    };
}
 
开发者ID:LoopPerfect,项目名称:buckaroo,代码行数:27,代码来源:RecipeSources.java

示例5: process

import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
/**
 * Sets the liquid in the model.
 * fluid - Name of the fluid in the FluidRegistry
 * flipGas - If "true" the model will be flipped upside down if the liquid is a gas. If "false" it wont
 * <p/>
 * If the fluid can't be found, water is used
 */
@Override
public ModelDynBucket process(ImmutableMap<String, String> customData)
{
    String fluidName = customData.get("fluid");
    Fluid fluid = FluidRegistry.getFluid(fluidName);

    if (fluid == null) fluid = this.fluid;

    boolean flip = flipGas;
    if (customData.containsKey("flipGas"))
    {
        String flipStr = customData.get("flipGas");
        if (flipStr.equals("true")) flip = true;
        else if (flipStr.equals("false")) flip = false;
        else
            throw new IllegalArgumentException(String.format("DynBucket custom data \"flipGas\" must have value \'true\' or \'false\' (was \'%s\')", flipStr));
    }

    // create new model with correct liquid
    return new ModelDynBucket(baseLocation, liquidLocation, coverLocation, fluid, flip);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:29,代码来源:ModelDynBucket.java

示例6: MultiLayerBakedModel

import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
public MultiLayerBakedModel(ImmutableMap<Optional<BlockRenderLayer>, IBakedModel> models, IBakedModel missing, ImmutableMap<TransformType, TRSRTransformation> cameraTransforms)
{
    this.models = models;
    this.cameraTransforms = cameraTransforms;
    this.missing = missing;
    if(models.containsKey(Optional.absent()))
    {
        base = models.get(Optional.absent());
    }
    else
    {
        base = missing;
    }
    ImmutableMap.Builder<Optional<EnumFacing>, ImmutableList<BakedQuad>> quadBuilder = ImmutableMap.builder();
    quadBuilder.put(Optional.<EnumFacing>absent(), buildQuads(models, Optional.<EnumFacing>absent()));
    for(EnumFacing side: EnumFacing.values())
    {
        quadBuilder.put(Optional.of(side), buildQuads(models, Optional.of(side)));
    }
    quads = quadBuilder.build();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:MultiLayerModel.java

示例7: retexture

import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
public ItemLayerModel retexture(ImmutableMap<String, String> textures)
{
    ImmutableList.Builder<ResourceLocation> builder = ImmutableList.builder();
    for(int i = 0; i < textures.size() + this.textures.size(); i++)
    {
        if(textures.containsKey("layer" + i))
        {
            builder.add(new ResourceLocation(textures.get("layer" + i)));
        }
        else if(i < this.textures.size())
        {
            builder.add(this.textures.get(i));
        }
    }
    return new ItemLayerModel(builder.build(), overrides);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:ItemLayerModel.java

示例8: retexture

import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
@Override
public ModelWrapper retexture(ImmutableMap<String, String> textures)
{
    ImmutableMap.Builder<String, ResourceLocation> builder = ImmutableMap.builder();
    for(Map.Entry<String, ResourceLocation> e : this.textures.entrySet())
    {
        String path = e.getKey();
        String loc = getLocation(path);
        if(textures.containsKey(loc))
        {
            String newLoc = textures.get(loc);
            if(newLoc == null) newLoc = getLocation(path);
            builder.put(e.getKey(), new ResourceLocation(newLoc));
        }
        else
        {
            builder.put(e);
        }
    }
    return new ModelWrapper(modelLocation, model, meshes, smooth, gui3d, defaultKey, builder.build());
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:B3DLoader.java

示例9: copyFallingBackTo

import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
/**
 * Takes this AnswerKey as ground truth, and takes unannotated or assessed Responses in fallback
 * and adds them to the AnswerKey.
 *
 * If the CAS for an AssessedResponse is known, prefer that CAS to the CAS in fallback.
 *
 * Does not handle the case where the fallback AnswerKey has an Assessment that this AnswerKey
 * does not.
 */
public AnswerKey copyFallingBackTo(AnswerKey fallback) {
  final Builder ret = modifiedCopyBuilder();

  final ImmutableMap<String, Response> unannotatedHere = Maps.uniqueIndex(unannotatedResponses(),
      ResponseFunctions.uniqueIdentifier());
  final ImmutableMap<String, AssessedResponse> idToAssessedHere =
      Maps.uniqueIndex(annotatedResponses(),
          Functions.compose(ResponseFunctions.uniqueIdentifier(),
              AssessedResponseFunctions.response()));
  final Set<String> idsHere = Sets.union(unannotatedHere.keySet(), idToAssessedHere.keySet());

  final ImmutableMap<String, Response> unannotatedThere = Maps.uniqueIndex(
      fallback.unannotatedResponses(), ResponseFunctions.uniqueIdentifier());
  final ImmutableMap<String, AssessedResponse> idToAssessedThere =
      Maps.uniqueIndex(fallback.annotatedResponses(),
          Functions.compose(ResponseFunctions.uniqueIdentifier(),
              AssessedResponseFunctions.response()));
  final Set<String> idsThere = Sets.union(unannotatedThere.keySet(), idToAssessedThere.keySet());

  final Set<String> idsOnlyInFallback = Sets.difference(idsThere, idsHere);
  for (final String id : idsOnlyInFallback) {
    if (unannotatedThere.containsKey(id)) {
      ret.addUnannotated(unannotatedThere.get(id));
    }
    if (idToAssessedThere.containsKey(id)) {
      final AssessedResponse r = idToAssessedThere.get(id);
      final int CASGroup;
      if (corefAnnotation().CASesToIDs().containsKey(r.response().canonicalArgument())) {
        CASGroup = corefAnnotation().CASesToIDs().get(r.response().canonicalArgument());
      } else {
        CASGroup = fallback.corefAnnotation().CASesToIDs().get(r.response().canonicalArgument());
      }
      ret.addAnnotated(r, CASGroup);
    }
  }
  return ret.build();
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:47,代码来源:AnswerKey.java

示例10: immutableMapStuff

import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
static void immutableMapStuff() {
  ImmutableMap m = ImmutableMap.of();
  Object res = m.get(new Object());
  // BUG: Diagnostic contains: dereferenced expression
  res.toString();
  Object x = new Object();
  if (m.containsKey(x)) {
    m.get(x).toString();
  }
}
 
开发者ID:uber,项目名称:NullAway,代码行数:11,代码来源:NullAwayNativeModels.java

示例11: process

import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
@Override
public ModelFluid process(ImmutableMap<String, String> customData)
{
    if(!customData.containsKey("fluid")) return this;

    String fluidStr = customData.get("fluid");
    JsonElement e = new JsonParser().parse(fluidStr);
    String fluid = e.getAsString();
    if(!FluidRegistry.isFluidRegistered(fluid))
    {
        FMLLog.severe("fluid '%s' not found", fluid);
        return WATER;
    }
    return new ModelFluid(FluidRegistry.getFluid(fluid));
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:16,代码来源:ModelFluid.java

示例12: generateConstructorFromParcel

import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
private MethodSpec generateConstructorFromParcel(
            ProcessingEnvironment env,
            ImmutableList<Property> properties,
            ImmutableMap<TypeMirror, FieldSpec> typeAdapters) {

        // Create the PRIVATE constructor from Parcel
        MethodSpec.Builder builder = MethodSpec.constructorBuilder()
                .addModifiers(PRIVATE)      // private
                .addParameter(ClassName.bestGuess("android.os.Parcel"), "in"); // input param

        // get a code block builder
        CodeBlock.Builder block = CodeBlock.builder();

//        // First thing is reading the Parcelable object version
//        block.add("this.version = in.readInt();\n");

        // Now, iterate all properties, check the version initialize them
        for (Property p : properties) {

//            // get the property version
//            int pVersion = p.version();
//            if (pVersion > 0) {
//                block.beginControlFlow("if (this.version >= $L)", pVersion);
//            }

            block.add("this.$N = ", p.fieldName);

            if (p.typeAdapter != null && typeAdapters.containsKey(p.typeAdapter)) {
                Parcelables.readValueWithTypeAdapter(block, p, typeAdapters.get(p.typeAdapter));
            } else {
                TypeName parcelableType = Parcelables.getTypeNameFromProperty(p, env.getTypeUtils());
                if (parcelableType == null) {
                    mErrorReporter.abortWithError("could not create parcelable for type " + p.typeName, p.element);
                }
                Parcelables.readValue(block, p, parcelableType);
            }

            block.add(";\n");

//            if (pVersion > 0) {
//                block.endControlFlow();
//            }
        }

        builder.addCode(block.build());

        return builder.build();
    }
 
开发者ID:foodora,项目名称:android-auto-mapper,代码行数:49,代码来源:AutoMappperProcessor.java


注:本文中的com.google.common.collect.ImmutableMap.containsKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。