Example usage for java.util LinkedHashMap containsKey

List of usage examples for java.util LinkedHashMap containsKey

Introduction

In this page you can find the example usage for java.util LinkedHashMap 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:otsopack.commons.network.coordination.spacemanager.FileSpaceManager.java

protected boolean optBoolean(LinkedHashMap<String, Object> object, String key, boolean defaultValue) {
    if (object.containsKey(key)) {
        return ((Boolean) object.get(key));
    }//from w  w  w. ja  v a  2s  . c om
    return defaultValue;
}

From source file:org.eclipse.winery.compliance.checking.ToscaComplianceRuleMatcher.java

public boolean isPropertyCompatible(Entry<String, String> leftEntry,
        @ADR(12) LinkedHashMap<String, String> rightProperties) {
    return rightProperties.containsKey(leftEntry.getKey()) && rightProperties.get(leftEntry.getKey()) != null
            && isPropertyValueCompatible(leftEntry.getValue(), rightProperties.get(leftEntry.getKey()));
}

From source file:org.apache.kylin.common.persistence.JDBCConnectionManager.java

private void putIfMissing(LinkedHashMap<String, String> map, String key, String value) {
    if (map.containsKey(key) == false)
        map.put(key, value);/*from  w ww.j ava 2  s .  co  m*/
}

From source file:org.bimserver.charting.SupportFunctions.java

public static ArrayList<LinkedHashMap<String, Object>> getIfcByClassificationReferenceWithTreeStructure(
        String structureKeyword, IfcModelInterface model, Chart chart, boolean includeClassificationSystem) {
    ArrayList<LinkedHashMap<String, Object>> rawData = new ArrayList<>();
    // Prepare for static iteration.
    LinkedHashMap<IfcRelAssociatesClassification, Integer> ifcClassificationWithCounts = new LinkedHashMap<>();
    // Iterate only the products.
    for (IfcRelAssociatesClassification ifcRelAssociatesClassification : model
            .getAllWithSubTypes(IfcRelAssociatesClassification.class)) {
        IfcRelAssociatesClassification key = ifcRelAssociatesClassification;
        Integer value = 0;//from  w w w  .j  a  va  2s .  c  o m
        if (ifcClassificationWithCounts.containsKey(key))
            value = ifcClassificationWithCounts.get(key);
        // Count.
        EList<IfcRoot> a = ifcRelAssociatesClassification.getRelatedObjects();
        ifcClassificationWithCounts.put(key, value + a.size());
    }
    // Derive the column names.
    ArrayList<String> hierarchyColumnNames = new ArrayList<>();
    int extraColumns = (includeClassificationSystem) ? 1 : 0;
    String leafColumnName = String.format("%s%d", structureKeyword, extraColumns + 1);
    for (int i = 0; i < extraColumns + 1; i++)
        hierarchyColumnNames.add(String.format("%s%d", structureKeyword, i + 1));
    // Update the chart configuration.
    chart.setDimensionLookupKeys(structureKeyword, hierarchyColumnNames);
    chart.setDimensionLookupKey("size", "size");
    chart.setDimensionLookupKey("label", "label");
    chart.setDimensionLookupKey("color", "size");
    // Add each entry.
    for (Entry<IfcRelAssociatesClassification, Integer> countedEntry : ifcClassificationWithCounts.entrySet()) {
        //
        Integer count = countedEntry.getValue();
        IfcRelAssociatesClassification ifcRelAssociatesClassification = countedEntry.getKey();
        //
        LinkedList<String> itemReferenceNames = new LinkedList<>();
        String classificationSystem = (ifcRelAssociatesClassification.isSetName())
                ? ifcRelAssociatesClassification.getName()
                : "(no name)";
        //
        IfcClassificationNotationSelect notationOrReference = ifcRelAssociatesClassification
                .getRelatingClassification();
        if (notationOrReference instanceof IfcClassificationNotation) {
            // Get notation.
            IfcClassificationNotation notation = (IfcClassificationNotation) notationOrReference;
            // Go through the facets of this annotation.
            for (IfcClassificationNotationFacet facet : notation.getNotationFacets()) {
                String notationValue = facet.getNotationValue();
                itemReferenceNames.add(notationValue);
            }
            // TODO: Look up notation in classification. No inverse lookup is available.
        } else if (notationOrReference instanceof IfcClassificationReference) {
            // Get reference.
            IfcClassificationReference reference = (IfcClassificationReference) notationOrReference;
            // Get the reference name.
            String itemReferenceName = reference.getItemReference();
            itemReferenceNames.add(itemReferenceName);
            // Get the classification the reference links out to.
            IfcClassification classification = reference.getReferencedSource();
            // Use it.
            if (classification != null)
                classificationSystem = classification.getName();
        }
        //
        while (itemReferenceNames.size() > 0) {
            String itemReferenceName = itemReferenceNames.pop();
            // Prepare to store this raw data entry.
            LinkedHashMap<String, Object> dataEntry = new LinkedHashMap<>();
            // Name the group.
            String name = String.format("%s (%s)", itemReferenceName, count);
            dataEntry.put(leafColumnName, name);
            if (includeClassificationSystem)
                dataEntry.put(hierarchyColumnNames.get(0), classificationSystem);
            dataEntry.put("size", count);
            dataEntry.put("label", name);
            // Push the entry into the data pool.
            rawData.add(dataEntry);
        }
    }
    // Send it all back.
    return rawData;
}

From source file:hd3gtv.mydmam.useraction.fileoperation.UAFileOperationTrash.java

public UACapability createCapability(LinkedHashMap<String, ?> internal_configuration) {
    if (internal_configuration.containsKey("trash_directory")) {
        trash_directory_name = (String) internal_configuration.get("trash_directory");
    }/*  w  w w  .ja  va2 s  . com*/
    return new Capability();
}

From source file:com.google.api.codegen.config.GapicProductConfig.java

private static void createSingleResourceNameConfig(DiagCollector diagCollector,
        CollectionConfigProto collectionConfigProto,
        LinkedHashMap<String, SingleResourceNameConfig> singleResourceNameConfigsMap, @Nullable ProtoFile file,
        TargetLanguage language) {// w w  w. j ava 2 s  .c  o  m
    SingleResourceNameConfig singleResourceNameConfig = SingleResourceNameConfig
            .createSingleResourceName(diagCollector, collectionConfigProto, file, language);
    if (singleResourceNameConfig == null) {
        return;
    }
    if (singleResourceNameConfigsMap.containsKey(singleResourceNameConfig.getEntityId())) {
        SingleResourceNameConfig otherConfig = singleResourceNameConfigsMap
                .get(singleResourceNameConfig.getEntityId());
        if (!singleResourceNameConfig.getNamePattern().equals(otherConfig.getNamePattern())) {
            diagCollector.addDiag(Diag.error(SimpleLocation.TOPLEVEL,
                    "Inconsistent collection configs across interfaces. Entity name: "
                            + singleResourceNameConfig.getEntityId()));
        }
    } else {
        singleResourceNameConfigsMap.put(singleResourceNameConfig.getEntityId(), singleResourceNameConfig);
    }
}

From source file:org.eclipse.recommenders.utils.rcp.JdtUtils.java

/**
 * Returns a list of all public instance methods and fields declared in the given type or any of its super-types
 *///from  w  ww  . j  a  v a  2s.  c  o  m
public static Collection<IMember> findAllPublicInstanceFieldsAndNonVoidNonPrimitiveInstanceMethods(
        final IType type) {
    final LinkedHashMap<String, IMember> tmp = new LinkedHashMap<String, IMember>();

    try {
        final IType[] returnTypeAndSupertypes = findAllSupertypesIncludeingArgument(type);
        for (final IType cur : returnTypeAndSupertypes) {
            for (final IMethod m : cur.getMethods()) {
                if (isVoid(m) || !isPublic(m) || m.isConstructor() || isStatic(m)
                        || hasPrimitiveReturnType(m)) {
                    continue;
                }
                final String key = createMethodKey(m);
                if (!tmp.containsKey(key)) {
                    tmp.put(key, m);
                }
            }
            for (final IField field : cur.getFields()) {
                if (!isPublic(field) || isStatic(field)) {
                    continue;
                }
                final String key = createFieldKey(field);
                if (!tmp.containsKey(key)) {
                    tmp.put(key, field);
                }
            }
        }
    } catch (final Exception e) {
        log(e);
    }
    return tmp.values();
}

From source file:com.opengamma.analytics.financial.provider.sensitivity.multicurve.SimpleParameterSensitivity.java

/**
 * Create a copy of the sensitivity and add a given named sensitivity to it. If the name / currency pair is in the map, the two sensitivity matrices are added.
 * Otherwise, a new entry is put into the map
 * @param name The name. Not null./*from w w  w .  j  a va 2  s . c o m*/
 * @param sensitivity The sensitivity to add, not null
 * @return The total sensitivity.
 */
public SimpleParameterSensitivity plus(final String name, final DoubleMatrix1D sensitivity) {
    ArgumentChecker.notNull(name, "Name");
    ArgumentChecker.notNull(sensitivity, "Matrix");
    final MatrixAlgebra algebra = MatrixAlgebraFactory.COMMONS_ALGEBRA;
    final LinkedHashMap<String, DoubleMatrix1D> result = new LinkedHashMap<>();
    result.putAll(_sensitivity);
    if (result.containsKey(name)) {
        result.put(name, (DoubleMatrix1D) algebra.add(result.get(name), sensitivity));
    } else {
        result.put(name, sensitivity);
    }
    return new SimpleParameterSensitivity(result);
}

From source file:com.redhat.topicindex.security.FedoraAccountSystem.java

private boolean checkCLAAgreement(LinkedList<LinkedHashMap> groups) {
    for (LinkedHashMap group : groups) {
        if (group.containsKey("name")) {
            if (group.get("name").equals("cla_done")) {
                return true;
            }/* w w  w  .ja  v a2 s  .c  om*/
        }
    }
    return false;
}

From source file:com.redhat.topicindex.security.FedoraAccountSystem.java

private boolean checkCLAAgreement(LinkedHashMap groups) {
    for (Object key : groups.keySet()) {
        LinkedHashMap group = (LinkedHashMap) groups.get(key);
        if (group.containsKey("name")) {
            if (group.get("name").equals("cla_done")) {
                return true;
            }/*from  w ww  . j a va  2  s  .  c  om*/
        }
    }
    return false;
}