Package org.anchoranalysis.io.input
Class InputsWithDirectory<T extends InputFromManager>
Object
org.anchoranalysis.io.input.InputsWithDirectory<T>
- Type Parameters:
T- input-type
public final class InputsWithDirectory<T extends InputFromManager> extends Object
All inputs for an experiment, together with any parent directory which is specified as a parent
for these inputs.
All inputs must be contained in this directory or one of its sub-direcotries.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors Constructor Description InputsWithDirectory(List<T> inputs)Creates without any parent directory.InputsWithDirectory(List<T> inputs, Optional<Path> directory) -
Method Summary
Modifier and Type Method Description Optional<Path>directory()The directory associated with the inputs.booleanequals(Object o)Collection<NamedFile>findAllNonInputFiles()Find all files in the input directory are not used as inputs.inthashCode()List<T>inputs()The inputs.booleanisEmpty()Whether no inputs exist.Iterator<T>iterator()Returns an iterator over the elements in this list in proper sequence.ListIterator<T>listIterator()Returns a list iterator over the elements in this list (in proper sequence).<S extends InputFromManager>
InputsWithDirectory<S>map(Function<T,S> mapFunction)Creates a newInputsWithDirectorywhich is the result of mapping the existing inputs.<S extends InputFromManager, E extends Exception>
InputsWithDirectory<S>map(CheckedFunction<T,S,E> mapFunction, Class<? extends E> throwableClass)Creates a newInputsWithDirectorywhich is the result of mapping the existing inputs.StringtoString()<S extends InputFromManager>
InputsWithDirectory<S>withInputs(List<S> inputsToAssign)Changes the inputs, but preserves the directory.
-
Constructor Details
-
InputsWithDirectory
Creates without any parent directory.- Parameters:
inputs- the inputs.
-
InputsWithDirectory
-
-
Method Details
-
map
Creates a newInputsWithDirectorywhich is the result of mapping the existing inputs.This is an immutable operation.
- Type Parameters:
S- the type of inputs that are mapped to.- Parameters:
mapFunction- the function that transforms and existing input into a new input.- Returns:
- a newly created input-manager with the mapped inputs, but an identical directory.
-
map
public <S extends InputFromManager, E extends Exception> InputsWithDirectory<S> map(CheckedFunction<T,S,E> mapFunction, Class<? extends E> throwableClass) throws E extends ExceptionCreates a newInputsWithDirectorywhich is the result of mapping the existing inputs.This is an immutable operation.
- Type Parameters:
S- the type of inputs that are mapped to.E- an exception that may be thrown bymapFunction.- Parameters:
mapFunction- the function that transforms and existing input into a new input.throwableClass- class type of exception that may be thrown bymapFunction.- Returns:
- a newly created input-manager with the mapped inputs, but an identical directory.
- Throws:
E- if thrown bymapFunction.E extends Exception
-
withInputs
Changes the inputs, but preserves the directory.This is an immutable operation.
- Type Parameters:
S- type of inputs to assign- Parameters:
inputsToAssign- inputs to assign- Returns:
- a newly created input-manager with
inputsToAssign, but an unchanged directory.
-
findAllNonInputFiles
Find all files in the input directory are not used as inputs.- Returns:
- the files, with an identifier derived relative to the input-directory
- Throws:
OperationFailedException- if directory isn't defined
-
isEmpty
public boolean isEmpty()Whether no inputs exist.- Returns:
- true if no inputs exist, false if at least one input exists.
-
iterator
Returns an iterator over the elements in this list in proper sequence.- Returns:
- an iterator over the elements in this list in proper sequence
-
listIterator
Returns a list iterator over the elements in this list (in proper sequence).- Returns:
- a list iterator over the elements in this list (in proper sequence)
-
inputs
The inputs. -
directory
The directory associated with the inputs. -
equals
-
hashCode
public int hashCode() -
toString
-