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

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

Introduction

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

Prototype

@Override
public String toString() 

Source Link

Document

Returns a String representation of this pair using the format ($left,$right) .

Usage

From source file:li.klass.fhem.domain.culhm.ThermostatTest.java

@SafeVarargs
private final void assertWeekProfileContainsExactly(
        WeekProfile<FilledTemperatureInterval, CULHMConfiguration, CULHMDevice> weekProfile, DayUtil.Day day,
        Pair<String, Double>... switchTimeTemperature) {
    DayProfile<FilledTemperatureInterval, CULHMDevice, CULHMConfiguration> dayProfile = weekProfile
            .getDayProfileFor(day);/* ww  w  .  j  av  a2 s  . com*/
    List<FilledTemperatureInterval> heatingIntervals = dayProfile.getHeatingIntervals();
    assertThat(heatingIntervals.size()).isEqualTo(switchTimeTemperature.length);

    for (Pair<String, Double> expected : switchTimeTemperature) {
        boolean found = false;
        for (FilledTemperatureInterval heatingInterval : heatingIntervals) {
            if (Math.abs(expected.getRight() - heatingInterval.getTemperature()) <= 0.01
                    && expected.getLeft().equals(heatingInterval.getSwitchTime())) {
                found = true;
                break;
            }
        }
        assertThat(found).as(day + " " + expected.toString()).isTrue();
    }
}

From source file:com.amazon.janusgraph.diskstorage.dynamodb.AbstractDynamoDBStore.java

@Override
public void acquireLock(StaticBuffer key, StaticBuffer column, StaticBuffer expectedValue, StoreTransaction txh)
        throws BackendException {
    final DynamoDBStoreTransaction tx = DynamoDBStoreTransaction.getTx(txh);
    final Pair<StaticBuffer, StaticBuffer> keyColumn = Pair.of(key, column);

    final DynamoDBStoreTransaction existing;
    try {/*  ww w  .j  av a 2 s .c o  m*/
        existing = keyColumnLocalLocks.get(keyColumn, new SetStoreIfTxMappingDoesntExist(tx, keyColumn));
    } catch (ExecutionException | UncheckedExecutionException | ExecutionError e) {
        throw new TemporaryLockingException("Unable to acquire lock", e);
    }
    if (null != existing && tx != existing) {
        throw new TemporaryLockingException(
                String.format("tx %s already locked key-column %s when tx %s tried to lock", existing.getId(),
                        keyColumn.toString(), tx.getId()));
    }

    // Titan's locking expects that only the first expectedValue for a given key/column should be used
    if (!tx.contains(key, column)) {
        tx.put(key, column, expectedValue);
    }
}