Class JobBatch
java.lang.Object
org.eclipse.epsilon.erl.execute.data.JobBatch
- All Implemented Interfaces:
Serializable
,Cloneable
Simple convenience input for splitting deterministically-ordered
jobs and processing them in chunks based on their position in the list.
- Since:
- 1.6
- Author:
- Sina Madani
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected JobBatch
clone()
boolean
getBatches
(int totalJobs, int chunks) Provides a List of indices based on the desired split size.int
hashCode()
<T> List<T>
Splits the given list based on this class's indices.<T> T[]
split
(T[] arr) <T> List<T>
splitToList
(T[] arr) toString()
-
Field Details
-
from
public int fromThe start index. -
to
public int toThe end index.
-
-
Constructor Details
-
JobBatch
public JobBatch() -
JobBatch
public JobBatch(int from, int to)
-
-
Method Details
-
clone
-
hashCode
public int hashCode() -
equals
-
toString
-
getBatches
Provides a List of indices based on the desired split size.- Parameters:
totalJobs
- The size of the source List being splitchunks
- The range (i.e.to - from
) of each batch. The last batch may be smaller than this but the other batches are guaranteed to be of this size.- Returns:
- A Serializable List of indexes with
totalJobs/batches
increments.
-
splitToList
-
split
public <T> T[] split(T[] arr) -
split
Splits the given list based on this class's indices.- Type Parameters:
T
- The type of the List- Parameters:
list
- The list to callList.subList(int, int)
on- Returns:
- The split list.
-