Class SourcePriorityComparator

  • All Implemented Interfaces:
    java.util.Comparator<InterMineObject>

    public class SourcePriorityComparator
    extends java.lang.Object
    implements java.util.Comparator<InterMineObject>
    Comparator, that compares two InterMineObjects, with reference to a particular FieldDescriptor for priority.
    Author:
    Matthew Wakeling, Andrew Varley
    • Constructor Detail

      • SourcePriorityComparator

        public SourcePriorityComparator​(DataTracker dataTracker,
                                        java.lang.Class<? extends InterMineObject> clazz,
                                        java.lang.String fieldName,
                                        Source def,
                                        InterMineObject defObj,
                                        IntPresentSet dbIdsStored,
                                        IntegrationWriterAbstractImpl iw,
                                        Source source,
                                        Source skelSource,
                                        PriorityConfig priorityConfig)
        Constructs a new Comparator for comparing objects for priority for a given field.
        Parameters:
        dataTracker - the data tracker
        clazz - the Class of the resulting object
        fieldName - the fieldName the comparison is for
        def - the default Source
        defObj - a InterMineObject that came from a data source, not from the destination objectstore, and should be associated with the default source
        dbIdsStored - the set of IDs stored in this dataloader run - improves error messages
        iw - the IntegrationWriter creating this comparator
        source - the main source, as passed to iw.store
        skelSource - the skeleton source, as passed to iw.store
        priorityConfig - a PriorityConfig object for the target Model
    • Method Detail

      • compare

        public int compare​(InterMineObject o1,
                           InterMineObject o2)
        Compares two objects. These objects must both be InterMineObjects.
        Specified by:
        compare in interface java.util.Comparator<InterMineObject>
        Parameters:
        o1 - the first object
        o2 - the second object
        Returns:
        a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
        Throws:
        java.lang.ClassCastException - if either of the two objects is not a InterMineObject
        java.lang.RuntimeException - if an error occurs in the underlying data tracking objectstore