private static Pair<String, String> getGivenAndFamilyNames(StructuredName structuredName) { return Pair.of(structuredName.getGiven(), structuredName.getFamily()); }
private CompletableFuture<WCADomainsResult> createDomainsTaskWithDeps(Contingency contingency, String baseStateId, List<SecurityRuleExpression> securityRuleExpressions, Supplier<CompletableFuture<Uncertainties>> memoizedUncertaintiesFuture, Supplier<CompletableFuture<WCAHistoLimits>> histoLimitsFuture, StringToIntMapper<AmplSubset> mapper, List<String> preventiveStateIds, List<String> preventiveActionIds, boolean activateFiltering) { return memoizedUncertaintiesFuture.get() .thenCombine(histoLimitsFuture.get(), (uncertainties, histoLimits) -> Pair.of(uncertainties, histoLimits)) .thenCompose(p -> createDomainsTask(contingency, baseStateId, securityRuleExpressions, p.getFirst(), p.getSecond(), mapper, preventiveStateIds, preventiveActionIds, activateFiltering)); }
/** * Returns the next element if it exists, otherwise calls endOfData() and * returns null. */ @Override public BaseContentEntry<?> computeNext() { if (!currentItr.hasNext()) { Pair<Iterator<BaseContentEntry<?>>, Integer> pair = getEntries(index, resultsPerRequest); currentItr = pair.getFirst(); index += pair.getSecond(); if (!currentItr.hasNext()) { return endOfData(); } } return currentItr.next(); }
/** Creates a new pair containing the given objects in order. */ public static <A,B> Pair<A,B> of(A first, B second) { return new Pair<A,B>(first, second); }
private Pair<Iterator<BaseContentEntry<?>>, Integer> catchException(Exception e, int start, int num) { String message = "Error retrieving response from query."; LOGGER.log(Level.WARNING, message, e); if (num == 1) { Iterator<BaseContentEntry<?>> itr = Iterators.emptyIterator(); return Pair.of(itr, 1); } else { int num1 = num/2; int num2 = num - num1; Pair<Iterator<BaseContentEntry<?>>, Integer> pair1 = getEntries(start, num1); Pair<Iterator<BaseContentEntry<?>>, Integer> pair2 = getEntries(start + num1, num2); Iterator<BaseContentEntry<?>> itr = Iterators.concat(pair1.getFirst(), pair2.getFirst()); int numReturned = pair1.getSecond() + pair2.getSecond(); return Pair.of(itr, numReturned); } } }
/** * Appends this XmlElement (and any children) to an Appendable. */ public void appendTo(Appendable a) throws IOException { a.append('<').append(elementType); for (Map.Entry<String, String> attribute : attributes.entrySet()) { a.append(' ').append(attribute.getKey()).append("=\"") .append(attribute.getValue()).append("\""); } if (children.isEmpty()) { a.append(" />"); } else { a.append(">"); for (Pair<Object, ChildType> pair : children) { Object child = pair.getFirst(); ChildType type = pair.getSecond(); if (type == ChildType.ELEMENT) { ((XmlElement)child).appendTo(a); } else { a.append((String)child); } } a.append("</").append(elementType).append('>'); } }
/** Creates a new pair containing the given objects in order. */ public static <A,B> Pair<A,B> of(A first, B second) { return new Pair<A,B>(first, second); }
private CompletableFuture<WCAClustersResult> createClustersTaskWithDeps(Contingency contingency, List<String> curativeActionIds, String baseStateId, String contingencyStateId, List<String> curativeStateIds, List<SecurityRuleExpression> securityRuleExpressions, Supplier<CompletableFuture<Uncertainties>> memoizedUncertaintiesFuture, Supplier<CompletableFuture<WCAHistoLimits>> histoLimitsFuture, StringToIntMapper<AmplSubset> mapper, boolean activateFiltering) { return memoizedUncertaintiesFuture.get() .thenCombine(histoLimitsFuture.get(), (uncertainties, histoLimits) -> Pair.of(uncertainties, histoLimits)) .thenCompose(p -> createClustersTask(contingency, curativeActionIds, baseStateId, contingencyStateId, curativeStateIds, securityRuleExpressions, p.getFirst(), p.getSecond(), mapper, activateFiltering)); }
private static Pair<String, String> getGivenAndFamilyValues(Name name) { return Pair.of(name.getGivenName(), name.getFamilyName()); }
/** Creates a new pair containing the given objects in order. */ public static <A,B> Pair<A,B> of(A first, B second) { return new Pair<A,B>(first, second); }
.collect(Collectors.toList()); assertThat(actualPrimaryNameValues) .containsExactly(Pair.of(primaryGivenName, primaryFamilyName)); List<String> actualPrimaryNameSourceValues = actualPrimaryNames
/** * Adds a string of xml as a child to this element. * * <p>Unlike addText(String), the string provided will not be escaped. If the * given String is not well formed, then this element may not be well formed. * </p> */ public XmlElement addXml(String xml) { Preconditions.checkNotNull(xml); children.add(new Pair<Object, ChildType>(xml, ChildType.XML)); return this; }