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

org.opentcs.strategies.basic.routing.DefaultRoutingGroupMapper Maven / Gradle / Ivy

There is a newer version: 6.2.0
Show newest version
/**
 * Copyright (c) The openTCS Authors.
 *
 * This program is free software and subject to the MIT license. (For details,
 * see the licensing information (LICENSE.txt) you should have received with
 * this copy of the software.)
 */
package org.opentcs.strategies.basic.routing;

import static org.opentcs.components.kernel.Router.PROPKEY_ROUTING_GROUP;

import org.opentcs.components.kernel.Router;
import org.opentcs.components.kernel.routing.GroupMapper;
import org.opentcs.data.model.Vehicle;

/**
 * Determines a vehicle's routing group by reading it's {@link Router#PROPKEY_ROUTING_GROUP}
 * property. Returns {@link #DEFAULT_ROUTING_GROUP} if the property does not exist or is invalid.
 */
public class DefaultRoutingGroupMapper
    implements
      GroupMapper {

  /**
   * The default value of a vehicle's routing group.
   */
  private static final String DEFAULT_ROUTING_GROUP = "";

  /**
   * Creates a new instance.
   */
  public DefaultRoutingGroupMapper() {
  }

  @Override
  public String apply(Vehicle vehicle) {
    String propVal = vehicle.getProperty(PROPKEY_ROUTING_GROUP);

    return propVal == null ? DEFAULT_ROUTING_GROUP : propVal;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy