Example usage for org.apache.commons.lang3.tuple ImmutablePair ImmutablePair

List of usage examples for org.apache.commons.lang3.tuple ImmutablePair ImmutablePair

Introduction

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

Prototype

public ImmutablePair(final L left, final R right) 

Source Link

Document

Create a new pair instance.

Usage

From source file:net.mindengine.galen.specs.reader.page.RuleStandardProcessor.java

@Override
public void processRule(ObjectSpecs objectSpecs, String ruleText, VarsContext varsContext, PageSection section,
        Properties properties, String contextPath, PageSpecReader pageSpecReader) throws IOException {

    List<Pair<String, Place>> lines = new LinkedList<Pair<String, Place>>();
    String indentation = "";

    ObjectSpecs temporaryObjectSpecs = null;
    SpecGroup specGroup = null;//ww  w  .ja  va  2s.  com

    if (objectSpecs != null) {
        indentation = "    ";

        specGroup = new SpecGroup();
        specGroup.setName(ruleText);

        temporaryObjectSpecs = new ObjectSpecs(objectSpecs.getObjectName());
    } else {
        PageSection subSection = new PageSection();
        subSection.setName(ruleText);
        section.addSubSection(subSection);
        section = subSection;
    }

    for (Pair<String, Place> line : originalLines) {
        lines.add(new ImmutablePair<String, Place>(indentation + line.getLeft(), line.getRight()));
    }

    StateDoingSection stateDoingSection = new StateDoingSection(properties, section, contextPath,
            pageSpecReader);

    if (objectSpecs != null) {
        stateDoingSection.setCurrentObject(temporaryObjectSpecs);
    }

    for (Pair<String, Place> line : lines) {
        stateDoingSection.process(varsContext, line.getLeft(), line.getRight());
    }

    if (objectSpecs != null) {
        specGroup.getSpecs().addAll(temporaryObjectSpecs.getSpecs());
        objectSpecs.getSpecGroups().add(specGroup);
    }
}

From source file:com.precioustech.fxtrading.marketdata.historic.MovingAverageCalculationService.java

public ImmutablePair<Double, Double> calculateSMAandWMAasPair(TradeableInstrument<T> instrument, int count,
        CandleStickGranularity granularity) {
    List<CandleStick<T>> candles = this.historicMarketDataProvider.getCandleSticks(instrument, granularity,
            count);/*from ww  w .jav  a2s  . com*/
    return new ImmutablePair<Double, Double>(calculateSMA(candles), calculateWMA(candles));
}

From source file:com.streamsets.pipeline.stage.destination.hive.queryexecutor.HiveQueryExecutorIT.java

@Test
public void testExecuteSimpleQuery() throws Exception {
    HiveQueryExecutor queryExecutor = createExecutor("CREATE TABLE copy AS SELECT * FROM origin");

    TargetRunner runner = new TargetRunner.Builder(HiveQueryDExecutor.class, queryExecutor)
            .setOnRecordError(OnRecordError.STOP_PIPELINE).build();
    runner.runInit();// ww  w  .j  a v  a2 s  .com

    Record record = RecordCreator.create();
    record.set(Field.create("blank line"));

    runner.runWrite(ImmutableList.of(record));
    runner.runDestroy();

    assertTableStructure("default.copy", new ImmutablePair("copy.id", Types.INTEGER),
            new ImmutablePair("copy.name", Types.VARCHAR));
}

From source file:cl.troncador.delfin.query.constraint.PrepareOrderAdapter.java

/**
 * Adds the./*from  ww  w  .  ja v  a 2 s .  co  m*/
 *
 * @param column the column
 * @param direction the direction
 */
public void add(SingularAttribute<T, ?> column, Direction direction) {
    Pair<SingularAttribute<T, ?>, Direction> pair = new ImmutablePair<SingularAttribute<T, ?>, Direction>(
            column, direction);
    directionedColumnList.add(pair);
}

From source file:com.streamsets.datacollector.event.handler.remote.RemoteStateEventListener.java

@Override
public void onStateChange(PipelineState fromState, PipelineState toState, String toStateJson,
        ThreadUsage threadUsage, Map<String, String> offset) throws PipelineException {
    Object isRemote = toState.getAttributes().get(RemoteDataCollector.IS_REMOTE_PIPELINE);
    if ((isRemote == null) ? false : (boolean) isRemote) {
        if (pipelineStateQueue.offer(new ImmutablePair<>(toState, offset))) {
            LOG.debug(Utils.format("Adding status event for remote pipeline: '{}' in status: '{}'",
                    toState.getPipelineId(), toState.getStatus()));
        } else {/*from  www . j  a v  a 2s  . c o  m*/
            LOG.warn(
                    Utils.format("Cannot add status event for remote pipeline: '{}' in status: '{}'; Queue for "
                            + "storing pipeline state events is full"),
                    toState.getPipelineId(), toState.getStatus());
        }
    }
}

From source file:net.mintern.primitive.pair.ImmutableObjIntPair.java

@Override
public ImmutablePair<L, Integer> boxed() {
    return new ImmutablePair<>(left, right);
}

From source file:net.mintern.primitive.pair.ImmutableObjBytePair.java

@Override
public ImmutablePair<L, Byte> boxed() {
    return new ImmutablePair<>(left, right);
}

From source file:net.mintern.primitive.pair.ImmutableObjLongPair.java

@Override
public ImmutablePair<L, Long> boxed() {
    return new ImmutablePair<>(left, right);
}

From source file:net.mintern.primitive.pair.ImmutableObjCharPair.java

@Override
public ImmutablePair<L, Character> boxed() {
    return new ImmutablePair<>(left, right);
}

From source file:net.mintern.primitive.pair.ImmutableObjFloatPair.java

@Override
public ImmutablePair<L, Float> boxed() {
    return new ImmutablePair<>(left, right);
}