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

org.opentcs.util.persistence.v6.Comparators 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.util.persistence.v6;

import java.util.Comparator;

/**
 * Some comparator implementations for JAXB classes.
 */
public final class Comparators {

  /**
   * Prevents instantiation.
   */
  private Comparators() {
  }

  /**
   * Returns a comparator for ordering PlantModelElementTOs ascendingly by their names.
   *
   * @return A comparator for ordering PlantModelElementTOs ascendingly by their names.
   */
  public static Comparator elementsByName() {
    return Comparator.comparing(PlantModelElementTO::getName);
  }

  /**
   * Returns a comparator for ordering OutgoingPaths ascendingly by their names.
   *
   * @return A comparator for ordering OutgoingPaths ascendingly by their names.
   */
  public static Comparator outgoingPathsByName() {
    return Comparator.comparing(PointTO.OutgoingPath::getName);
  }

  /**
   * Returns a comparator for ordering Links ascendingly by their point names.
   *
   * @return A comparator for ordering Links ascendingly by their point names.
   */
  public static Comparator linksByPointName() {
    return Comparator.comparing(LocationTO.Link::getPoint);
  }

  /**
   * Returns a comparator for ordering Propertiess ascendingly by their names.
   *
   * @return A comparator for ordering Properties ascendingly by their names.
   */
  public static Comparator propertiesByName() {
    return Comparator.comparing(PropertyTO::getName);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy