All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.optaplanner.constraint.streams.bavet.tri.FlattenLastTriNode Maven / Gradle / Ivy

Go to download

OptaPlanner solves planning problems. This lightweight, embeddable planning engine implements powerful and scalable algorithms to optimize business resource scheduling and planning. This module contains implementation of Constraint streams (Bavet).

There is a newer version: 10.0.0
Show newest version
package org.optaplanner.constraint.streams.bavet.tri;

import java.util.function.Function;

import org.optaplanner.constraint.streams.bavet.common.AbstractFlattenLastNode;
import org.optaplanner.constraint.streams.bavet.common.TupleLifecycle;

final class FlattenLastTriNode
        extends AbstractFlattenLastNode, TriTuple, C, NewC> {

    private final int outputStoreSize;

    FlattenLastTriNode(int flattenLastStoreIndex, Function> mappingFunction,
            TupleLifecycle> nextNodesTupleLifecycle, int outputStoreSize) {
        super(flattenLastStoreIndex, mappingFunction, nextNodesTupleLifecycle);
        this.outputStoreSize = outputStoreSize;
    }

    @Override
    protected TriTuple createTuple(TriTuple originalTuple, NewC newC) {
        return new TriTupleImpl<>(originalTuple.getFactA(), originalTuple.getFactB(), newC, outputStoreSize);
    }

    @Override
    protected C getEffectiveFactIn(TriTuple tuple) {
        return tuple.getFactC();
    }

    @Override
    protected NewC getEffectiveFactOut(TriTuple outTuple) {
        return outTuple.getFactC();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy