Example usage for org.apache.commons.lang3.tuple Pair getRight

List of usage examples for org.apache.commons.lang3.tuple Pair getRight

Introduction

In this page you can find the example usage for org.apache.commons.lang3.tuple Pair getRight.

Prototype

public abstract R getRight();

Source Link

Document

Gets the right element from this pair.

When treated as a key-value pair, this is the value.

Usage

From source file:io.knotx.launcher.KnotxStarterVerticle.java

private StringBuilder collectDeployment(StringBuilder accumulator, Pair<String, String> deploymentId) {
    return accumulator
            .append(String.format("\t\tDeployed %s [%s]", deploymentId.getRight(), deploymentId.getLeft()))
            .append(System.lineSeparator());
}

From source file:com.blacklocus.jres.handler.JresJsonResponseHandler.java

@Override
public REPLY handleResponse(HttpResponse http) throws IOException, JresErrorReplyException {

    int statusCode = http.getStatusLine().getStatusCode();

    if (statusCode / 100 == 2) {
        Pair<JsonNode, REPLY> replyPair = read(http, getReplyClass());
        REPLY reply = replyPair.getRight();
        reply.node(replyPair.getLeft());
        return reply;

    } else if (statusCode / 100 >= 4) {
        Pair<JsonNode, JresJsonReply> replyPair = read(http, null); // only want the node
        JsonNode node = replyPair.getLeft();
        String error = node != null && node.has("error") ? node.get("error").asText() : null;
        throw new JresErrorReplyException(error, statusCode, node);

    } else {//from  ww  w  . j  a  va  2s .  c o m
        // Does ElasticSearch ever return 1xx or 3xx (or other)?
        throw new RuntimeException("Erm... dernt nerr wert erm derern?"); // Um, don't know what I'm doing?
    }

}

From source file:hu.ppke.itk.nlpg.purepos.common.lemma.AbstractLemmaTransformation.java

@Override
public Pair<String, Integer> analyze(String word) {
    Pair<String, Integer> ret = encode(word, representation);
    return Pair.of(postprocess(ret.getLeft()), ret.getRight());

}

From source file:io.github.karols.hocr4j.Bounds.java

/**
 * The smallest rectangle containing the second elements of all pairs of the collection.
 * The collection, all the pairs and all the second elements have to be non-null.
 * If the collections is empty, returns <code>null</code>.
 *
 * @param thingies collection of pairs//from  w ww  .j a  va2  s  . c o m
 * @param <T>      type of the first element of the pair
 * @param <B>      type of the second element of the pair
 * @return union of bounds of all second elements,
 *         or <code>null</code> if the collection was empty
 * @see Bounds#ofAll(Collection)
 * @see Bounds#ofAllLeft(Collection)
 */
@Nullable
public static <T, B extends Bounded> Bounds ofAllRight(@Nonnull Collection<Pair<T, B>> thingies) {
    Bounds acc = null;
    for (Pair<T, B> thingy : thingies) {
        acc = nullSafeUnion(acc, thingy.getRight().getBounds());
    }
    return acc;
}

From source file:com.act.lcms.ExtractFromNetCDFAroundMass.java

private Pair<Double, Double> findMaxPeak(List<Pair<Double, Double>> raw) {
    // the intensity is the second value in the pairs
    // this finds the pair with the max intensity 

    Pair<Double, Double> max = null;
    for (Pair<Double, Double> mz_int : raw) {
        if (max == null || max.getRight() < mz_int.getRight())
            max = mz_int;
    }/* ww w.jav  a 2 s.com*/
    return max;
}

From source file:gobblin.ingestion.google.webmaster.UrlTriePrefixGrouper.java

@Override
public boolean hasNext() {
    if (_retVal != null) {
        return true;
    }//from www  . j  a  v  a 2  s  .  co m

    while (_iterator.hasNext() && _retVal == null) {
        Pair<String, UrlTrieNode> nextPair = _iterator.next();
        UrlTrieNode nextNode = nextPair.getRight();
        if (nextNode.getSize() <= _groupSize) {
            _retVal = Triple.of(nextPair.getLeft(), GoogleWebmasterFilter.FilterOperator.CONTAINS, nextNode);
            return true;
        } else if (nextNode.isExist()) {
            _retVal = Triple.of(nextPair.getLeft(), GoogleWebmasterFilter.FilterOperator.EQUALS, nextNode);
            return true;
        }
    }
    return false;
}

From source file:hu.mta.sztaki.lpds.cloud.simulator.iaas.statenotifications.PowerStateChangeNotificationHandler.java

/**
 * The event handling mechanism for power state change notifications about
 * resource spreaders/*w ww  . ja v a2s .co m*/
 * 
 * @param onObject
 *            The listener to send the event to
 * @param newPowerBehavior
 *            a data pair containing the resource spreader that changed its
 *            state and the power state that the spreader just switches to.
 */
@Override
public void sendNotification(final PowerBehaviorChangeListener onObject,
        final Pair<ResourceSpreader, PowerState> newPowerBehavior) {
    onObject.behaviorChanged(newPowerBehavior.getLeft(), newPowerBehavior.getRight());
}

From source file:flens.input.GraphiteInput.java

@Override
//metric_path value timestamp\n  
//http://graphite.wikidot.com/getting-your-data-into-graphite
public void readAndProcess(Pair<String, BufferedReader> inx) throws IOException {
    BufferedReader in = inx.getRight();
    String host = inx.getLeft();//  www . ja v a2s . c  om
    String line = in.readLine();
    if (line == null)
        throw new IOException("connection lost");

    Scanner st = new Scanner(line);

    try {

        String metricName = st.next();
        String metric = st.next();
        long time = st.nextLong();

        Map<String, Object> tags = new HashMap<String, Object>();

        tags.put(Constants.METRIC, metricName);
        tags.put(Constants.VALUE, metric);

        Record r = Record.createWithTimeHostAndValues(time * 1000, host, tags);
        dispatch(r);
    } catch (NoSuchElementException e) {
        warn("line too short", line);
    }

}

From source file:ddf.catalog.operation.faceting.FacetedAttributeResult.java

/**
 * Instantiates a FacetedAttributeResult representing a portion of the results of a faceted query.
 * This constructor takes a zipped list of value to count pairings.
 *
 * @param attributeName The field name for which faceting data is reported
 * @param valueCountPairs A list of value-count pairs for the faceted field
 *///from  ww  w .  j a v  a 2s  .  c  om
public FacetedAttributeResult(String attributeName, List<Pair<String, Long>> valueCountPairs) {
    this.attributeName = attributeName;
    facetValues = new ArrayList<>();
    for (Pair<String, Long> valueCountPair : valueCountPairs) {
        facetValues.add(new FacetValueCount(valueCountPair.getLeft(), valueCountPair.getRight()));
    }
}

From source file:flens.filter.RenameFilter.java

public Collection<Record> process(Record in) {
    Map vals = in.getValues();/*  www  .j  a v  a  2s.c om*/
    for (Pair ren : this.names) {
        Object val = vals.remove(ren.getKey());
        if (val != null) {
            if (!((String) ren.getRight()).isEmpty())
                vals.put(ren.getRight(), val);
            if (ren.getRight().equals(Constants.TIME)) {

                vals.put(Constants.TIME, in.getTimestamp());
            }
        }
    }

    tag(in);
    return Collections.EMPTY_LIST;
}