Java Code Examples for com.google.common.collect.Multimap#containsValue()
The following examples show how to use
com.google.common.collect.Multimap#containsValue() .
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: Guava.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@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); }
Example 2
Source File: Guava.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@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"); }
Example 3
Source File: Guava.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@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"); }
Example 4
Source File: ContextTidAspect.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * 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; }
Example 5
Source File: ContextPidAspect.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * 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; }
Example 6
Source File: ExpandCompositeTerms.java From datawave with Apache License 2.0 | 4 votes |
/** * 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; } }
Example 7
Source File: LttngUstTrace.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
private boolean checkFieldPresent(@NonNull String field) { final Multimap<@NonNull String, @NonNull String> traceEvents = TmfEventTypeCollectionHelper.getEventFieldNames((getContainedEventTypes())); return traceEvents.containsValue(field); }