Class ParameterComparator
- java.lang.Object
-
- psidev.psi.mi.jami.utils.comparator.parameter.ParameterComparator
-
- All Implemented Interfaces:
Comparator<Parameter>
- Direct Known Subclasses:
UnambiguousParameterComparator
public abstract class ParameterComparator extends Object implements Comparator<Parameter>
Simple comparator for Parameter 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.- Since:
18/12/12
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Constructor Description ParameterComparator(Comparator<CvTerm> cvTermComparator)
Creates a new ParameterComparatorParameterComparator(Comparator<CvTerm> cvTermComparator, ParameterValueComparator valueComparator)
Creates a new ParameterComparator
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.Comparator<CvTerm>
getCvTermComparator()
Getter for the fieldcvTermComparator
.ParameterValueComparator
getValueComparator()
Getter for the fieldvalueComparator
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Constructor Detail
-
ParameterComparator
public ParameterComparator(Comparator<CvTerm> cvTermComparator)
Creates a new ParameterComparator- Parameters:
cvTermComparator
- : cv term comparator to compare parameter types and units. It is required
-
ParameterComparator
public ParameterComparator(Comparator<CvTerm> cvTermComparator, ParameterValueComparator valueComparator)
Creates a new ParameterComparator- Parameters:
cvTermComparator
- : cv term comparator to compare parameter types and units. It is requiredvalueComparator
- : parameter value comparator. If null, it will create a new ParameterValueComparator
-
-
Method Detail
-
getCvTermComparator
public Comparator<CvTerm> getCvTermComparator()
Getter for the field
cvTermComparator
.- Returns:
- a
Comparator
object.
-
getValueComparator
public ParameterValueComparator getValueComparator()
Getter for the field
valueComparator
.- Returns:
- a
ParameterValueComparator
object.
-
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.- Specified by:
compare
in interfaceComparator<Parameter>
- Parameters:
parameter1
- aParameter
object.parameter2
- aParameter
object.- Returns:
- a int.
-
-