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

org.opentcs.strategies.basic.routing.jgrapht.PointVertexMapper 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.jgrapht;

import static java.util.Objects.requireNonNull;

import jakarta.inject.Inject;
import java.util.Collection;
import java.util.Set;
import java.util.stream.Collectors;
import org.opentcs.data.model.Point;

/**
 * Mapper to translate a collection of {@link Point}s to names of vertices.
 */
public class PointVertexMapper {

  /**
   * Creates a new instance.
   */
  @Inject
  public PointVertexMapper() {
  }

  /**
   * Translates the given {@link Point}s to names of vertices.
   *
   * @param points The points to translate to names of vertices.
   * @return The translated names of vertices.
   */
  public Set translatePoints(Collection points) {
    requireNonNull(points, "points");

    return points.stream()
        .map(Point::getName)
        .collect(Collectors.toSet());
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy