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>>
data
protected boolean
isComplete
-
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.Runner
getRunner()
The runner which was used to create this change data.boolean
isComplete()
Whether the entire change data is available to be iterated on statically, without performing any new computation or fetching.CloseableIterator<IndexedData<T>>
iterator()
void
saveToFile(File file, ChangeDataSerializer<T> serializer)
Saves the change data to a specified directory, following OpenRefine's format for change data.protected void
saveToFile(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:ChangeData
Returns the change data at a given row. The data encapsulated in thisIndexedData
may be null, but not the return value of this function itself.- Specified by:
get
in interfaceChangeData<T>
- Parameters:
rowId
- the 0-based row index
-
getRunner
public Runner getRunner()
Description copied from interface:ChangeData
The runner which was used to create this change data.- Specified by:
getRunner
in 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:ChangeData
Saves the change data to a specified directory, following OpenRefine's format for change data.- Specified by:
saveToFile
in 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:ChangeData
Saves the change data to a specified directory, following OpenRefine's format for change data, in an asynchronous way.- Specified by:
saveToFileAsync
in 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:ChangeData
Whether 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:
isComplete
in interfaceChangeData<T>
-
iterator
public CloseableIterator<IndexedData<T>> iterator()
- Specified by:
iterator
in interfaceCloseableIterable<T>
-
-