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

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

Introduction

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

Prototype

public abstract R getRight();

Source Link

Document

Gets the right element from this triple.

Usage

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

/**
 * The event handling mechanism for VM state change notifications
 * //from   ww w  .  jav  a2  s.c  o m
 * @param onObject
 *            The listener to send the event to
 * @param stateData
 *            a data triplet containing the VM and its the past and future
 *            states.
 */
@Override
public void sendNotification(final StateChange onObject, Triple<VirtualMachine, State, State> stateData) {
    onObject.stateChanged(stateData.getLeft(), stateData.getMiddle(), stateData.getRight());
}

From source file:io.github.autsia.crowly.services.geolocation.impl.GeoLocationServiceImpl.java

@Override
public GeoCode convertCoordinatesToGeoCode(Triple<Double, Double, Double> location) {
    return new GeoCode(location.getLeft(), location.getMiddle(), location.getRight().intValue());
}

From source file:cherry.foundation.bizcal.WorkdayManagerImpl.java

@Override
public void afterPropertiesSet() {
    numberOfWorkdayCache = CacheBuilder.from(numberOfWorkdayCacheSpec)
            .build(new CacheLoader<Triple<String, LocalDate, LocalDate>, Integer>() {
                @Override//  w w  w .java2s  .co  m
                public Integer load(Triple<String, LocalDate, LocalDate> key) {
                    return workdayStore.getNumberOfWorkday(key.getLeft(), key.getMiddle(), key.getRight());
                }
            });
    nextWorkdayCache = CacheBuilder.from(nextWorkdayCacheSpec)
            .build(new CacheLoader<Triple<String, LocalDate, Integer>, LocalDate>() {
                @Override
                public LocalDate load(Triple<String, LocalDate, Integer> key) {
                    return workdayStore.getNextWorkday(key.getLeft(), key.getMiddle(), key.getRight());
                }
            });
}

From source file:alfio.controller.api.support.TicketHelper.java

private Triple<ValidationResult, Event, Ticket> assignTicket(UpdateTicketOwnerForm updateTicketOwner,
        Optional<Errors> bindingResult, HttpServletRequest request, Optional<UserDetails> userDetails,
        Triple<Event, TicketReservation, Ticket> result) {
    Ticket t = result.getRight();
    final Event event = result.getLeft();
    if (t.getLockedAssignment()) {
        //in case of locked assignment, fullName and Email will be overwritten
        updateTicketOwner.setFirstName(t.getFirstName());
        updateTicketOwner.setLastName(t.getLastName());
        updateTicketOwner.setFullName(t.getFullName());
        updateTicketOwner.setEmail(t.getEmail());
    }//from w ww .  j a va 2s  . c om

    final TicketReservation ticketReservation = result.getMiddle();
    List<TicketFieldConfiguration> fieldConf = ticketFieldRepository
            .findAdditionalFieldsForEvent(event.getId());
    ValidationResult validationResult = Validator
            .validateTicketAssignment(updateTicketOwner, fieldConf, bindingResult, event)
            .ifSuccess(() -> updateTicketOwner(updateTicketOwner, request, t, event, ticketReservation,
                    userDetails));
    return Triple.of(validationResult, event, ticketRepository.findByUUID(t.getUuid()));
}

From source file:com.nttec.everychan.ui.gallery.GalleryInitResult.java

public int getParcelSize() {
    int total = 12;
    for (Triple<AttachmentModel, String, String> tuple : attachments) {
        total += 40;/*from   www.jav  a2 s . co  m*/
        AttachmentModel attachment = tuple.getLeft();
        String hash = tuple.getMiddle();
        String post = tuple.getRight();
        if (attachment.thumbnail != null)
            total += attachment.thumbnail.length() * 2;
        if (attachment.path != null)
            total += attachment.path.length() * 2;
        if (attachment.originalName != null)
            total += attachment.originalName.length() * 2;
        if (hash != null)
            total += hash.length() * 2;
        if (post != null)
            total += post.length() * 2;
    }
    return total;
}

From source file:com.boozallen.cognition.ingest.storm.bolt.starter.LineRegexReplaceInRegionBolt.java

String replaceAll(String record) {
    for (Triple<Pattern, String, String> entry : groupSearchReplaceList) {
        Pattern pattern = entry.getLeft();
        String regex = entry.getMiddle();
        String replacement = entry.getRight();

        record = replace(record, pattern, regex, replacement);
    }//from   ww  w  .ja v a2s  .c  o m
    return record;
}

From source file:at.gridtec.lambda4j.consumer.tri.TriConsumer.java

/**
 * Applies this consumer to the given tuple.
 *
 * @param tuple The tuple to be applied to the consumer
 * @throws NullPointerException If given argument is {@code null}
 * @see org.apache.commons.lang3.tuple.Triple
 *//*from  w  w w  .  j  ava  2  s  . c  o  m*/
default void accept(@Nonnull Triple<T, U, V> tuple) {
    Objects.requireNonNull(tuple);
    accept(tuple.getLeft(), tuple.getMiddle(), tuple.getRight());
}

From source file:com.act.lcms.v2.fullindex.SearcherTest.java

@Test
public void searchIndexInRange() throws Exception {
    List<TMzI> actual = searcher.searchIndexInRange(Pair.of(100.004, 100.016), Pair.of(1.5, 3.5));

    List<Triple<Float, Double, Float>> expected = Arrays.asList(Triple.of(2.0F, 100.005, 10.0F),
            Triple.of(2.0F, 100.010, 20.0F), Triple.of(2.0F, 100.015, 30.0F), Triple.of(3.0F, 100.010, 100.0F),
            Triple.of(3.0F, 100.015, 200.0F));

    assertEquals("Searcher returned expected number of TMzI tuples", expected.size(), actual.size());
    for (int i = 0; i < expected.size(); i++) {
        Triple<Float, Double, Float> e = expected.get(i);
        TMzI a = actual.get(i);/*  w  w w. j a  v  a2s  .c  om*/
        assertEquals("Time matches expected", e.getLeft(), a.getTime(), FP_TOLERANCE);
        assertEquals("M/z matches expected", e.getMiddle(), a.getMz(), FP_TOLERANCE);
        assertEquals("Intensity matches expected", e.getRight(), a.getIntensity(), FP_TOLERANCE);
    }
}

From source file:alfio.controller.TicketController.java

private Ticket internalSendTicketByEmail(HttpServletRequest request,
        Triple<Event, TicketReservation, Ticket> data) throws IOException {
    Ticket ticket = data.getRight();
    Event event = data.getLeft();
    Locale locale = LocaleUtil.getTicketLanguage(ticket, request);

    TicketReservation reservation = data.getMiddle();
    Organization organization = organizationRepository.getById(event.getOrganizationId());
    TicketCategory category = ticketCategoryRepository.getById(ticket.getCategoryId());
    notificationManager.sendTicketByEmail(ticket, event, locale,
            TemplateProcessor.buildPartialEmail(event, organization, reservation, category, templateManager,
                    ticketReservationManager.ticketUpdateUrl(event, ticket.getUuid()), request),
            reservation, ticketCategoryRepository.getByIdAndActive(ticket.getCategoryId(), event.getId()));
    return ticket;
}

From source file:alfio.controller.TicketController.java

@RequestMapping(value = "/event/{eventName}/ticket/{ticketIdentifier}/download-ticket", method = RequestMethod.GET)
public void generateTicketPdf(@PathVariable("eventName") String eventName,
        @PathVariable("ticketIdentifier") String ticketIdentifier, HttpServletRequest request,
        HttpServletResponse response) throws IOException, WriterException {

    Optional<Triple<Event, TicketReservation, Ticket>> oData = ticketReservationManager
            .fetchCompleteAndAssigned(eventName, ticketIdentifier);
    if (!oData.isPresent()) {
        response.sendError(HttpServletResponse.SC_FORBIDDEN);
        return;/*w ww .  j ava2  s.  co  m*/
    }
    Triple<Event, TicketReservation, Ticket> data = oData.get();

    Ticket ticket = data.getRight();

    response.setContentType("application/pdf");
    response.addHeader("Content-Disposition", "attachment; filename=ticket-" + ticketIdentifier + ".pdf");
    try (OutputStream os = response.getOutputStream()) {
        PdfBoxRenderer renderer = preparePdfTicket(request, data.getLeft(), data.getMiddle(), ticket)
                .generate(ticket);
        if (renderer != null) {
            renderer.createPDF(os);
        }
    }
}