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-2018 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: 2018-09-19 13:55:45 +0200 (Wed, 19 Sep 2018) $, @version $Revision: 4006 $, 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 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();
    }

}