Package edu.byu.hbll.box
Class ProcessBatch
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<ProcessContext>
-
- edu.byu.hbll.box.ProcessBatch
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<ProcessContext>
,Collection<ProcessContext>
,List<ProcessContext>
,RandomAccess
public class ProcessBatch extends ArrayList<ProcessContext>
A batch of ids/contexts to be processed by aProcessor
.- Author:
- Charles Draper
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description ProcessBatch()
Creates a new emptyProcessBatch
.ProcessBatch(Collection<? extends ProcessContext> contexts)
Creates a newProcessBatch
initialized with the given contexts.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ProcessContext
get(String id)
Returns the context for the given id or null if not found.ProcessContext
getFirstContext()
Returns the first found context or null if empty.String
getFirstId()
Returns the first id or null if batch is empty.List<String>
getIds()
Returns the ids.static ProcessBatch
ofIds(List<String> ids)
Creates a newProcessBatch
from a list of ids only (ie, no dependency information).-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
Methods inherited from class java.util.AbstractCollection
containsAll, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Methods inherited from interface java.util.List
containsAll
-
-
-
-
Constructor Detail
-
ProcessBatch
public ProcessBatch()
Creates a new emptyProcessBatch
.
-
ProcessBatch
public ProcessBatch(Collection<? extends ProcessContext> contexts)
Creates a newProcessBatch
initialized with the given contexts.- Parameters:
contexts
- the contexts associated with this batch
-
-
Method Detail
-
getFirstId
public String getFirstId()
Returns the first id or null if batch is empty.- Returns:
- the first id from the batch, null if the batch is empty
-
getFirstContext
public ProcessContext getFirstContext()
Returns the first found context or null if empty.- Returns:
- the first context from the batch, null if the batch is empty
-
get
public ProcessContext get(String id)
Returns the context for the given id or null if not found.- Parameters:
id
- the document id- Returns:
- the context associated with the given id, null if id not found
-
ofIds
public static ProcessBatch ofIds(List<String> ids)
Creates a newProcessBatch
from a list of ids only (ie, no dependency information).- Parameters:
ids
- the ids for the batch.- Returns:
- a new batch
-
-