A
- public abstract class AbstractPriorityRule<A> extends java.lang.Object implements PriorityRule<A>
Comparison
wrapper allowing subclasses to focus on
the actual comparison of ligands.PriorityRule.Type
Constructor and Description |
---|
AbstractPriorityRule(Descriptor.Type reflection,
PriorityRule.Type ordering)
Constructor creates a comparator with the specified type.
|
AbstractPriorityRule(PriorityRule.Type ordering)
Default constructor creates an
Descriptor.Type#ASYMMETRIC comparator. |
Modifier and Type | Method and Description |
---|---|
int |
compare(java.util.List<Ligand<A>> first,
java.util.List<Ligand<A>> second)
Compares two lists of ligands.
|
Comparison |
compareLigands(Ligand<A> o1,
Ligand<A> o2)
Analogous to
Comparator.compare(Object, Object) the prioritise method combines the Descriptor.Type to the
order and can indicate what comparison method was used. |
PriorityRule.Type |
getRuleType()
Indicates whether the rule is conditional etc.
|
LigandSorter<A> |
getSorter()
Access the ligand sorter, if the sorter is null a default insertion sorter (
InsertionSorter ) is created
using 'this; rule as the comparator. |
Descriptor.Type |
getType()
Access the descriptor type this rule indicates.
|
boolean |
isHalted() |
Priority |
prioritise(java.util.List<Ligand<A>> ligands)
Uses the injected ligand sorter to order the ligands.
|
int |
recursiveCompare(Ligand<A> o1,
Ligand<A> o2) |
void |
setHalt(boolean halt)
Indicates the rule should halt.
|
void |
setSorter(LigandSorter<A> sorter)
Allows injection of a ligand sorter.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compare, comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public AbstractPriorityRule(PriorityRule.Type ordering)
Descriptor.Type#ASYMMETRIC
comparator.ordering
- public AbstractPriorityRule(Descriptor.Type reflection, PriorityRule.Type ordering)
ordering
- public void setHalt(boolean halt)
PriorityRule
setHalt
in interface PriorityRule<A>
public int recursiveCompare(Ligand<A> o1, Ligand<A> o2)
recursiveCompare
in interface PriorityRule<A>
o1
- o2
- public Comparison compareLigands(Ligand<A> o1, Ligand<A> o2)
PriorityRule
Comparator.compare(Object, Object)
the prioritise method combines the Descriptor.Type
to the
order and can indicate what comparison method was used. The single comparison cases the type doesn't change
however when using a combined comparator the type may change depending on which comparator was used.compareLigands
in interface PriorityRule<A>
o1
- first ligando2
- second ligandComparator.compare(Object, Object)
public void setSorter(LigandSorter<A> sorter)
PriorityRule
setSorter
in interface PriorityRule<A>
sorter
- the ligand sorter to usepublic LigandSorter<A> getSorter()
InsertionSorter
) is created
using 'this; rule as the comparator.public Priority prioritise(java.util.List<Ligand<A>> ligands)
prioritise
in interface PriorityRule<A>
ligands
- the ligands that are to be sortedpublic int compare(java.util.List<Ligand<A>> first, java.util.List<Ligand<A>> second)
first
- first list of ligandssecond
- second list of ligandspublic boolean isHalted()
public Descriptor.Type getType()
PriorityRule
getType
in interface PriorityRule<A>
public PriorityRule.Type getRuleType()
getRuleType
in interface PriorityRule<A>