Class UnambiguousParameterComparator

  • All Implemented Interfaces:
    Comparator<Parameter>

    public class UnambiguousParameterComparator
    extends ParameterComparator
    Unambiguous parameter comparator. - Two parameters which are null are equals - The parameter which is not null is before null. - Use UnambiguousCvTermComparator to compare first the parameter types. - If parameter types are equals, use UnambiguousCvTermComparator to compare the units. - If the units are not set, compares the values - If both units are set and If they are equals, compares the values (case sensitive) - If both values are equals, compares the uncertainty.
    Since:
    19/12/12
    Version:
    $Id$
    Author:
    Marine Dumousseau (marine@ebi.ac.uk)
    • Constructor Detail

      • UnambiguousParameterComparator

        public UnambiguousParameterComparator()

        Constructor for UnambiguousParameterComparator.

    • Method Detail

      • compare

        public int compare​(Parameter parameter1,
                           Parameter parameter2)
        It first compares parameter types, then parameter units and then it uses ParameterValueComparator for comparing parameter values It will also compare the uncertainty. - Two parameters which are null are equals - The parameter which is not null is before null. - Use UnambiguousCvTermComparator to compare first the parameter types. - If parameter types are equals, use UnambiguousCvTermComparator to compare the units. - If the units are not set, compares the values - If both units are set and If they are equals, compares the values (case sensitive) - If both values are equals, compares the uncertainty.
        Specified by:
        compare in interface Comparator<Parameter>
        Overrides:
        compare in class ParameterComparator
        Parameters:
        parameter1 - a Parameter object.
        parameter2 - a Parameter object.
        Returns:
        a int.
      • areEquals

        public static boolean areEquals​(Parameter param1,
                                        Parameter param2)
        Use UnabmbiguousComparatorParameter to know if two parameters are equals.
        Parameters:
        param1 - a Parameter object.
        param2 - a Parameter object.
        Returns:
        true if the two parameters are equal
      • hashCode

        public static int hashCode​(Parameter param)

        hashCode

        Parameters:
        param - a Parameter object.
        Returns:
        the hashcode consistent with the equals method for this comparator