Class Algorithm


  • public final class Algorithm
    extends java.lang.Object
    Represents an Algorithmia algorithm that can be called.
    • Method Detail

      • setOptions

        public Algorithm setOptions​(java.util.Map<java.lang.String,​java.lang.String> options)
      • setOption

        public Algorithm setOption​(java.lang.String key,
                                   java.lang.String value)
      • setTimeout

        public Algorithm setTimeout​(java.lang.Long timeout,
                                    java.util.concurrent.TimeUnit unit)
      • getTimeout

        public java.lang.Long getTimeout()
      • setStdout

        public Algorithm setStdout​(boolean showStdout)
      • pipe

        public AlgoResponse pipe​(java.lang.Object input)
                          throws APIException
        Calls the Algorithmia API for a given input. Attempts to automatically serialize the input to JSON.
        Parameters:
        input - algorithm input, will automatically be converted into JSON
        Returns:
        algorithm result (AlgoSuccess or AlgoFailure)
        Throws:
        APIException - if there is a problem communication with the Algorithmia API.
      • pipeAsync

        public FutureAlgoResponse pipeAsync​(java.lang.Object input)
        Calls the Algorithmia API asynchronously for a given input. Attempts to automatically serialize the input to JSON. The future response will complete when the algorithm has completed or errored
        Parameters:
        input - algorithm input, will automatically be converted into JSON
        Returns:
        future algorithm result (AlgoSuccess or AlgoFailure)
      • pipeJson

        public AlgoResponse pipeJson​(java.lang.String inputJson)
                              throws APIException
        Calls the Algorithmia API for given input that will be treated as JSON
        Parameters:
        inputJson - json input value
        Returns:
        success or failure
        Throws:
        APIException - if there is a problem communication with the Algorithmia API.
      • pipeJsonAsync

        public FutureAlgoResponse pipeJsonAsync​(java.lang.String inputJson)
        Calls the Algorithmia API asynchronously for given input that will be treated as JSON The future response will complete when the algorithm has completed or errored
        Parameters:
        inputJson - json input value
        Returns:
        success or failure