com.google.common.collect.Multimap#containsValue ( )源码实例Demo

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

源代码1 项目: spotbugs   文件: Guava.java
@ExpectWarning(value="GC", num=7)
public static void testMultimap(Multimap<String, Integer> mm) {
    mm.containsEntry("x", "y");
    mm.containsEntry(1, 5);
    mm.containsKey(1);
    mm.containsValue("x");
    mm.remove("x", "x");
    mm.remove(1, 2);
    mm.removeAll(1);
}
 
源代码2 项目: spotbugs   文件: Guava.java
@NoWarning("GC")
public static void testMultimapOK(Multimap<String, Integer> mm) {
    mm.containsEntry("x", 1);
    mm.containsKey("x");
    mm.containsValue(1);
    mm.remove("x", 1);
    mm.removeAll("x");
}
 
源代码3 项目: spotbugs   文件: Guava.java
@NoWarning("GC")
public static void testMultimapOK2(Multimap<String, Pair<Integer,Long>> mm) {
    Pair<Integer, Long> p = new Pair<Integer, Long>(1, 1L);
    mm.containsEntry("x", p);
    mm.containsKey("x");
    mm.containsValue(p);
    mm.remove("x", p);
    mm.removeAll("x");
}
 
源代码4 项目: tracecompass   文件: ContextTidAspect.java
/**
 * Get the context TID aspect if the trace contains at least one event with
 * a tid context field
 *
 * @param trace
 *            The LTTng kernel trace for which to get the aspect
 * @return The aspect if it has the proper field, or <code>null</code>
 *         otherwise
 */
public static @Nullable ContextTidAspect getAspect(LttngKernelTrace trace) {
    IKernelAnalysisEventLayout layout = trace.getKernelEventLayout();
    if (!(layout instanceof LttngEventLayout)) {
        return null;
    }
    LttngEventLayout lttngLayout = (LttngEventLayout) layout;
    Set<@NonNull CtfTmfEventType> eventTypes = trace.getContainedEventTypes();
    Multimap<@NonNull String, @NonNull String> eventFieldNames = TmfEventTypeCollectionHelper.getEventFieldNames(eventTypes);
    return (eventFieldNames.containsValue(lttngLayout.contextTid())) ? new ContextTidAspect(lttngLayout) : null;
}
 
源代码5 项目: tracecompass   文件: ContextPidAspect.java
/**
 * Get the context PID aspect if the trace contains at least one event with
 * a pid context field
 *
 * @param trace
 *            The LTTng kernel trace for which to get the aspect
 * @return The aspect if it has the proper field, or <code>null</code>
 *         otherwise
 */
public static @Nullable ContextPidAspect getAspect(LttngKernelTrace trace) {
    IKernelAnalysisEventLayout layout = trace.getKernelEventLayout();
    if (!(layout instanceof LttngEventLayout)) {
        return null;
    }
    LttngEventLayout lttngLayout = (LttngEventLayout) layout;
    Set<@NonNull CtfTmfEventType> eventTypes = trace.getContainedEventTypes();
    Multimap<@NonNull String, @NonNull String> eventFieldNames = TmfEventTypeCollectionHelper.getEventFieldNames(eventTypes);
    return (eventFieldNames.containsValue(lttngLayout.contextPid())) ? new ContextPidAspect(lttngLayout) : null;
}
 
源代码6 项目: datawave   文件: ExpandCompositeTerms.java
/**
 * Rebuilds the current 'and' node, and attempts to create the best composites from the leaf and ancestor anded nodes available. First, we descend into the
 * non-leaf nodes, and keep track of which leaf and anded nodes are used. We then attempt to create composites from the remaining leaf and anded nodes.
 * Finally, any leftover, unused leaf nodes are anded at this level, while the used leaf nodes are passed down to the descendants and anded where
 * appropriate.
 *
 * @param node
 *            An 'and' node from the original script
 * @param data
 *            ExpandData, containing ancestor anded nodes, used anded nodes, and a flag indicating whether composites were found
 * @return An expanded version of the 'and' node containing composite nodes, if found, or the original in node, if not found
 */
@Override
public Object visit(ASTAndNode node, Object data) {
    ExpandData parentData = (ExpandData) data;
    
    // only process delayed predicates
    if (QueryPropertyMarkerVisitor.instanceOfAnyExcept(node, Arrays.asList(ASTDelayedPredicate.class))) {
        return node;
    }
    
    // if we only have one child, just pass through
    // this shouldn't ever really happen, but it could
    if (node.jjtGetNumChildren() == 1)
        return super.visit(node, data);
    
    // first, find all leaf nodes
    // note: an 'and' node defining a range over a single term is considered a leaf node for our purposes
    List<JexlNode> nonLeafNodes = new ArrayList<>();
    Multimap<String,JexlNode> leafNodes = getLeafNodes(node, nonLeafNodes);
    
    // if this is a 'leaf' range node, check to see if a composite can be made
    if (leafNodes.size() == 1 && leafNodes.containsValue(node)) {
        // attempt to build a composite
        return visitLeafNode(node, parentData);
    }
    // otherwise, process the 'and' node as usual
    else {
        
        Multimap<String,JexlNode> usedLeafNodes = LinkedHashMultimap.create();
        
        // process the non-leaf nodes first
        List<JexlNode> processedNonLeafNodes = processNonLeafNodes(parentData, nonLeafNodes, leafNodes, usedLeafNodes);
        
        // remove the used nodes from the leaf and anded nodes
        leafNodes.values().removeAll(usedLeafNodes.values());
        parentData.andedNodes.values().removeAll(parentData.usedAndedNodes.values());
        
        // next, process the remaining leaf nodes
        List<JexlNode> processedLeafNodes = processUnusedLeafNodes(parentData, leafNodes, usedLeafNodes);
        
        // again, remove the used nodes from the leaf and anded nodes
        leafNodes.values().removeAll(usedLeafNodes.values());
        parentData.andedNodes.values().removeAll(parentData.usedAndedNodes.values());
        
        // rebuild the node if composites are found
        if (parentData.foundComposite) {
            List<JexlNode> processedNodes = new ArrayList<>();
            processedNodes.addAll(processedLeafNodes);
            processedNodes.addAll(processedNonLeafNodes);
            
            // rebuild the node
            JexlNode rebuiltNode = createUnwrappedAndNode(processedNodes);
            
            // distribute the used nodes into the rebuilt node
            if (!usedLeafNodes.values().isEmpty()) {
                // first we need to trim the used nodes to eliminate any wrapping nodes
                // i.e. reference, reference expression, or single child and/or nodes
                List<JexlNode> leafNodesToDistribute = usedLeafNodes.values().stream().map(this::getLeafNode).collect(Collectors.toList());
                rebuiltNode = DistributeAndedNodes.distributeAndedNode(rebuiltNode, leafNodesToDistribute, jexlNodeToCompMap);
            }
            
            return rebuiltNode;
        }
        
        return node;
    }
}
 
源代码7 项目: tracecompass   文件: LttngUstTrace.java
private boolean checkFieldPresent(@NonNull String field) {
    final Multimap<@NonNull String, @NonNull String> traceEvents = TmfEventTypeCollectionHelper.getEventFieldNames((getContainedEventTypes()));

    return traceEvents.containsValue(field);
}