Package org.intermine.dataloader
Class SourcePriorityComparator
- java.lang.Object
-
- org.intermine.dataloader.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 Summary
Constructors Constructor Description 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(InterMineObject o1, InterMineObject o2)
Compares two objects.
-
-
-
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 trackerclazz
- the Class of the resulting objectfieldName
- the fieldName the comparison is fordef
- the default SourcedefObj
- a InterMineObject that came from a data source, not from the destination objectstore, and should be associated with the default sourcedbIdsStored
- the set of IDs stored in this dataloader run - improves error messagesiw
- the IntegrationWriter creating this comparatorsource
- the main source, as passed to iw.storeskelSource
- the skeleton source, as passed to iw.storepriorityConfig
- 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 interfacejava.util.Comparator<InterMineObject>
- Parameters:
o1
- the first objecto2
- 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 InterMineObjectjava.lang.RuntimeException
- if an error occurs in the underlying data tracking objectstore
-
-