org.opentcs.util.persistence.v004.Comparators Maven / Gradle / Ivy
/**
* 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.v004;
import java.util.Comparator;
/**
* Some comparator implementations for JAXB classes.
*
* @author Martin Grzenia (Fraunhofer IML)
*/
public final class Comparators {
/**
* A Comparator
for ordering PlantModelElementTO
s ascendingly by their
* names.
*/
private static final Comparator ELEMENTS_BY_NAME
= (PlantModelElementTO o1, PlantModelElementTO o2) -> o1.getName().compareTo(o2.getName());
/**
* A Comparator
for ordering OutgoingPath
s ascendingly by their names.
*/
private static final Comparator OUTGOING_PATHS_BY_NAME
= (PointTO.OutgoingPath o1, PointTO.OutgoingPath o2) -> o1.getName().compareTo(o2.getName());
/**
* A Comparator
for ordering Link
s ascendingly by their point names.
*/
private static final Comparator LINKS_BY_POINT_NAME
= (LocationTO.Link o1, LocationTO.Link o2) -> o1.getPoint().compareTo(o2.getPoint());
/**
* A Comparator
for ordering Properties
ascendingly by their
* names.
*/
private static final Comparator PROPERTIES_BY_NAME
= (PropertyTO o1, PropertyTO o2) -> o1.getName().compareTo(o2.getName());
private Comparators() {
}
/**
* Returns a comparator for ordering PlantModelElementTO
s ascendingly by their names.
*
* @return A comparator for ordering PlantModelElementTO
s ascendingly by their names.
*/
public static Comparator elementsByName() {
return ELEMENTS_BY_NAME;
}
/**
* Returns a comparator for ordering OutgoingPath
s ascendingly by their names.
*
* @return A comparator for ordering OutgoingPath
s ascendingly by their names.
*/
public static Comparator outgoingPathsByName() {
return OUTGOING_PATHS_BY_NAME;
}
/**
* Returns a comparator for ordering Link
s ascendingly by their point names.
*
* @return A comparator for ordering Link
s ascendingly by their point names.
*/
public static Comparator linksByPointName() {
return LINKS_BY_POINT_NAME;
}
/**
* Returns a comparator for ordering Properties
s ascendingly by their names.
*
* @return A comparator for ordering Properties
ascendingly by their names.
*/
public static Comparator propertiesByName() {
return PROPERTIES_BY_NAME;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy