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

org.opentripplanner.routing.edgetype.SimpleEdge Maven / Gradle / Ivy

There is a newer version: 2.5.0
Show newest version
package org.opentripplanner.routing.edgetype;

import org.opentripplanner.routing.core.State;
import org.opentripplanner.routing.core.StateEditor;
import org.opentripplanner.routing.graph.Vertex;

/** Appears to be used only in tests. */
public class SimpleEdge extends FreeEdge {
    private static final long serialVersionUID = 1L;
    private double weight;
    private int seconds;

    public SimpleEdge (Vertex v1, Vertex v2, double weight, int seconds) {
        super(v1, v2);
        this.weight = weight;
        this.seconds = seconds;
    }
    
    @Override
    public State traverse(State s0) {
        StateEditor s1 = s0.edit(this);
        s1.incrementTimeInSeconds(seconds);
        s1.incrementWeight(weight);
        // SimpleEdges don't concern themselves with mode
        return s1.makeState();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy