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

se.cambio.openehr.view.util.DataValueComparator Maven / Gradle / Ivy

There is a newer version: 1.3.26
Show newest version
package se.cambio.openehr.view.util;

import org.openehr.rm.datatypes.basic.DataValue;
import org.openehr.rm.datatypes.text.DvText;

import java.util.Comparator;

/**
 * User: Iago.Corbal
 * Date: 2013-11-17
 * Time: 13:03
 */
public class DataValueComparator implements Comparator {

    @Override
    public int compare(DataValue dv1, DataValue dv2) {
        if (dv1 instanceof DvText) {
            return dv1.equals(dv2) ? 0 : -1;
        } else {
            if (dv1 instanceof Comparable) {
                return ((Comparable) dv1).compareTo(dv2);
            } else {
                return -1;
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy