Interface AddOnCalculationValidator


public interface AddOnCalculationValidator
This interface defines the functions that must be implemented by the class that checks if a script is respecting the established contract.
  • Method Details

    • setAlignedSignalsStreamComplete

      AddOnCalculationValidator setAlignedSignalsStreamComplete(Stream<List<Sample>> alignedSignalsStreamComplete)
      Sets the stream of list of aligned samples into the detector. The list of samples is complete and one can take any number of them to be used in validation. For speed considerations it is recommended to only take few (e.g. 100)
      Parameters:
      alignedSignalsStreamComplete - complete stream of aligned list of samples
      Returns:
      the instance of the detector
    • setSignalFragmentScriptCaller

      AddOnCalculationValidator setSignalFragmentScriptCaller(BiFunction<Integer,Stream<List<Sample>>,Stream<Sample>> signalFragmentScriptCaller)
      During validation the detector will need to call the script for a subset of the samples provided in the complete stream
      Parameters:
      signalFragmentScriptCaller - function providing the possibility to call the script for a subset of samples
      Returns:
      the instance of the detector
    • setScriptName

      AddOnCalculationValidator setScriptName(String scriptName)
      Set the name of the script into the detector. Script name may be used by the detector in error reporting.
      Parameters:
      scriptName - name of the script
      Returns:
      the instance of detector
    • setWindowSize

      AddOnCalculationValidator setWindowSize(@Nullable Long windowSize)
      Set the window size for windowed calculations
      Parameters:
      windowSize - windowSize for windowed calculations, otherwise null
      Returns:
      the instance of detector
    • getMinimumNumberOfSamples

      int getMinimumNumberOfSamples()
      Return the minimum number of samples required for validation
      Returns:
      minimum number of samples required for validation
    • doValidate

      void doValidate()
      Does the validation that checks if the script is correctly made. In case the contract break is detected, a RuntimeException is thrown. In case no problem is detected in the script, a subsequent call to isContractRespected should return true.
    • isValid

      boolean isValid()
      Gets the value of contract respected flag.
      Returns:
      true if the script is respecting the contract