FixedRouteGenerator.java

package org.opentrafficsim.core.network.route;

import java.io.Serializable;

import org.opentrafficsim.core.distributions.ConstantGenerator;
import org.opentrafficsim.core.network.Node;

/**
 * Generate a fixed route (always the same).
 * <p>
 * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
 * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
 * <p>
 * $LastChangedDate: 2019-01-06 01:35:05 +0100 (Sun, 06 Jan 2019) $, @version $Revision: 4831 $, by $Author: averbraeck $,
 * initial version 20 mrt. 2015 <br>
 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
 */
public class FixedRouteGenerator extends ConstantGenerator<Route> implements RouteGenerator, Serializable
{
    /** */
    private static final long serialVersionUID = 20150000L;

    /**
     * Construct a new FixedRouteGenerator.
     * @param route Route; the CompleteRoute to generate
     */
    public FixedRouteGenerator(final Route route)
    {
        super(route);
    }

    /** {@inheritDoc} */
    @Override
    public final String toString()
    {
        StringBuilder result = new StringBuilder();
        result.append("FixedRouteGenerator");
        String separator = " [";
        for (Node node : getValue().getNodes())
        {
            result.append(separator);
            result.append(node);
            separator = ", ";
        }
        result.append("]");
        return result.toString();
    }

}