Class Sort
- java.lang.Object
-
- uk.gov.gchq.gaffer.operation.impl.compare.Sort
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ElementComparison
,Input<Iterable<? extends Element>>
,InputOutput<Iterable<? extends Element>,Iterable<? extends Element>>
,MultiInput<Element>
,Output<Iterable<? extends Element>>
,Operation
public class Sort extends Object implements InputOutput<Iterable<? extends Element>,Iterable<? extends Element>>, MultiInput<Element>, ElementComparison
ASort
operation can be used to sort aIterable
ofElement
s using providedComparator
s. Either implement your own comparators or use theElementPropertyComparator
.The provided element comparators will be use sequentially to sort the operation input iterable.
There is also a resultLimit option that will only keep the top 'X' results. This avoids having to load a large number of Elements into memory, if you only just want the first few results.
- See Also:
Sort.Builder
,ElementPropertyComparator
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Sort.Builder
-
Nested classes/interfaces inherited from interface uk.gov.gchq.gaffer.operation.Operation
Operation.BaseBuilder<OP extends Operation,B extends Operation.BaseBuilder<OP,?>>
-
-
Constructor Summary
Constructors Constructor Description Sort()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Comparator<Element>>
getComparators()
Get the list ofElement
comparators registered to the operation.Iterable<? extends Element>
getInput()
Map<String,String>
getOptions()
com.fasterxml.jackson.core.type.TypeReference<Iterable<? extends Element>>
getOutputTypeReference()
Integer
getResultLimit()
boolean
isDeduplicate()
void
setComparators(List<Comparator<Element>> comparators)
void
setDeduplicate(boolean deduplicate)
void
setInput(Iterable<? extends Element> input)
void
setOptions(Map<String,String> options)
void
setResultLimit(Integer resultLimit)
Sort
shallowClone()
Operation implementations should ensure a ShallowClone method is implemented.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface uk.gov.gchq.gaffer.operation.impl.compare.ElementComparison
getCombinedComparator, getComparableGroupPropertyPairs
-
Methods inherited from interface uk.gov.gchq.gaffer.operation.io.MultiInput
createInputArray, setInput
-
Methods inherited from interface uk.gov.gchq.gaffer.operation.Operation
_getNullOrOptions, addOption, containsOption, getOption, getOption, validate, validateRequiredFieldPresent
-
Methods inherited from interface uk.gov.gchq.gaffer.operation.io.Output
castToOutputType, getOutputClass, getOutputType
-
-
-
-
Method Detail
-
getComparators
public List<Comparator<Element>> getComparators()
Description copied from interface:ElementComparison
Get the list ofElement
comparators registered to the operation.- Specified by:
getComparators
in interfaceElementComparison
- Returns:
- an ordered
List
containing the comparators
-
setComparators
public void setComparators(List<Comparator<Element>> comparators)
-
getResultLimit
public Integer getResultLimit()
-
setResultLimit
public void setResultLimit(Integer resultLimit)
-
isDeduplicate
public boolean isDeduplicate()
-
setDeduplicate
public void setDeduplicate(boolean deduplicate)
-
getOutputTypeReference
public com.fasterxml.jackson.core.type.TypeReference<Iterable<? extends Element>> getOutputTypeReference()
- Specified by:
getOutputTypeReference
in interfaceOutput<Iterable<? extends Element>>
-
shallowClone
public Sort shallowClone()
Description copied from interface:Operation
Operation implementations should ensure a ShallowClone method is implemented. Performs a shallow clone. Creates a new instance and copies the fields across. It does not clone the fields. If the operation contains nested operations, these must also be cloned.- Specified by:
shallowClone
in interfaceOperation
- Returns:
- shallow clone
-
getOptions
public Map<String,String> getOptions()
- Specified by:
getOptions
in interfaceOperation
- Returns:
- the operation options. This may contain store specific options such as authorisation strings or and other properties required for the operation to be executed. Note these options will probably not be interpreted in the same way by every store implementation.
-
setOptions
public void setOptions(Map<String,String> options)
- Specified by:
setOptions
in interfaceOperation
- Parameters:
options
- the operation options. This may contain store specific options such as authorisation strings or and other properties required for the operation to be executed. Note these options will probably not be interpreted in the same way by every store implementation.
-
-