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

org.opentripplanner.transit.raptor.rangeraptor.debug.ParetoSetDebugHandlerAdapter Maven / Gradle / Ivy

There is a newer version: 2.5.0
Show newest version
package org.opentripplanner.transit.raptor.rangeraptor.debug;

import org.opentripplanner.transit.raptor.rangeraptor.view.DebugHandler;
import org.opentripplanner.transit.raptor.util.paretoset.ParetoSet;
import org.opentripplanner.transit.raptor.util.paretoset.ParetoSetEventListener;


/**
 * Use this class to attach a debugHandler to a pareto set. The handler will
 * be notified about all changes in the set.
 *
 * @param  The {@link ParetoSet} type.
 */
final class ParetoSetDebugHandlerAdapter implements ParetoSetEventListener {

    private final DebugHandler debugHandler;

    ParetoSetDebugHandlerAdapter(DebugHandler debugHandler) {
        this.debugHandler = debugHandler;
    }

    @Override
    public void notifyElementAccepted(T newElement) {
        debugHandler.accept(newElement);
    }

    @Override
    public void notifyElementDropped(T element, T droppedByElement) {
        debugHandler.drop(element, droppedByElement, null);
    }

    @Override
    public void notifyElementRejected(T element, T droppedByElement) {
        debugHandler.reject(element, droppedByElement, null);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy