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

org.opentcs.util.persistence.v6.Comparators Maven / Gradle / Ivy

The newest version!
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
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 - 2024 Weber Informatics LLC | Privacy Policy