org.intermine.dataloader
Class SourcePriorityComparator

java.lang.Object
  extended by 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.


Constructor Summary
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
 int compare(InterMineObject o1, InterMineObject o2)
          Compares two objects.
 
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
 

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