Class InputsWithDirectory<T extends InputFromManager>

Object
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 Details

    • InputsWithDirectory

      public InputsWithDirectory(List<T> inputs)
      Creates without any parent directory.
      Parameters:
      inputs - the inputs.
    • InputsWithDirectory

      public InputsWithDirectory(List<T> inputs, Optional<Path> directory)
      Creates a new InputsWithDirectory instance.
      Parameters:
      inputs - The inputs.
      directory - The directory associated with the inputs.
  • Method Details

    • map

      public <S extends InputFromManager> InputsWithDirectory<S> map(Function<T,S> mapFunction)
      Creates a new InputsWithDirectory which 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
      Creates a new InputsWithDirectory which 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 by mapFunction.
      Parameters:
      mapFunction - the function that transforms and existing input into a new input.
      throwableClass - class type of exception that may be thrown by mapFunction.
      Returns:
      a newly created input-manager with the mapped inputs, but an identical directory.
      Throws:
      E - if thrown by mapFunction.
    • withInputs

      public <S extends InputFromManager> InputsWithDirectory<S> withInputs(List<S> inputsToAssign)
      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

      public Collection<NamedFile> findAllNonInputFiles() throws OperationFailedException
      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

      public Iterator<T> 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

      public ListIterator<T> 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

      public List<T> inputs()
      The inputs.
    • directory

      public Optional<Path> directory()
      The directory associated with the inputs.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object