Package org.openrefine.runners.testing
Class TestingChangeData<T>
- java.lang.Object
-
- org.openrefine.runners.testing.TestingChangeData<T>
-
- All Implemented Interfaces:
ChangeData<T>,CloseableIterable<IndexedData<T>>
public class TestingChangeData<T> extends Object implements ChangeData<T>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.openrefine.util.CloseableIterable
CloseableIterable.Wrapper<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<Long,IndexedData<T>>dataprotected booleanisComplete
-
Constructor Summary
Constructors Constructor Description TestingChangeData(Map<Long,IndexedData<T>> data, boolean isComplete)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IndexedData<T>get(long rowId)Returns the change data at a given row.RunnergetRunner()The runner which was used to create this change data.booleanisComplete()Whether the entire change data is available to be iterated on statically, without performing any new computation or fetching.CloseableIterator<IndexedData<T>>iterator()voidsaveToFile(File file, ChangeDataSerializer<T> serializer)Saves the change data to a specified directory, following OpenRefine's format for change data.protected voidsaveToFile(File file, ChangeDataSerializer<T> serializer, Optional<ProgressReporter> progressReporter)ProgressingFuture<Void>saveToFileAsync(File file, ChangeDataSerializer<T> serializer)Saves the change data to a specified directory, following OpenRefine's format for change data, in an asynchronous way.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openrefine.util.CloseableIterable
drop, filter, map, take
-
-
-
-
Field Detail
-
data
protected Map<Long,IndexedData<T>> data
-
isComplete
protected boolean isComplete
-
-
Constructor Detail
-
TestingChangeData
public TestingChangeData(Map<Long,IndexedData<T>> data, boolean isComplete)
-
-
Method Detail
-
get
public IndexedData<T> get(long rowId)
Description copied from interface:ChangeDataReturns the change data at a given row. The data encapsulated in thisIndexedDatamay be null, but not the return value of this function itself.- Specified by:
getin interfaceChangeData<T>- Parameters:
rowId- the 0-based row index
-
getRunner
public Runner getRunner()
Description copied from interface:ChangeDataThe runner which was used to create this change data.- Specified by:
getRunnerin interfaceChangeData<T>
-
saveToFile
protected void saveToFile(File file, ChangeDataSerializer<T> serializer, Optional<ProgressReporter> progressReporter) throws IOException
- Throws:
IOException
-
saveToFile
public void saveToFile(File file, ChangeDataSerializer<T> serializer) throws IOException
Description copied from interface:ChangeDataSaves the change data to a specified directory, following OpenRefine's format for change data.- Specified by:
saveToFilein interfaceChangeData<T>- Parameters:
file- the directory where to save the gridserializer- the serializer used to convert the items to strings- Throws:
IOException
-
saveToFileAsync
public ProgressingFuture<Void> saveToFileAsync(File file, ChangeDataSerializer<T> serializer)
Description copied from interface:ChangeDataSaves the change data to a specified directory, following OpenRefine's format for change data, in an asynchronous way.- Specified by:
saveToFileAsyncin interfaceChangeData<T>- Parameters:
file- the directory where to save the gridserializer- the serializer used to convert the items to strings- Returns:
- a future which completes once the save is complete
-
isComplete
public boolean isComplete()
Description copied from interface:ChangeDataWhether the entire change data is available to be iterated on statically, without performing any new computation or fetching. This happens when this ChangeData object is loaded back from disk and a suitable completion marker was found.- Specified by:
isCompletein interfaceChangeData<T>
-
iterator
public CloseableIterator<IndexedData<T>> iterator()
- Specified by:
iteratorin interfaceCloseableIterable<T>
-
-