org.licas.autonomic.script

## Class AutoReply

- java.lang.Object
- - org.licas.autonomic.script.AutoReply

-     public class AutoReply
      extends java.lang.Object

  This class can evaluate a reply object for a true-false response, or success-failure, with regard to using it further in the process.
  Author:
    Kieran Greer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AutoReply(java.lang.Object theReply)` Create a new instance of AutoReply.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `evaluate(java.lang.Object filter, org.ai_heuristic.eval.Condition function, ObjectsMap objectsMap)` Check the reply based on any filter query or function, which can be a simple description, such as the default set programmed into the licas script.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AutoReply

          public AutoReply(java.lang.Object theReply)

      Create a new instance of AutoReply.
      Parameters:
        `theReply` - the reply object to evaluate.

  - ### Method Detail

    - #### evaluate

          protected boolean evaluate(java.lang.Object filter,
                                     org.ai_heuristic.eval.Condition function,
                                     ObjectsMap objectsMap)
                              throws java.lang.Exception

      Check the reply based on any filter query or function, which can be a simple description, such as the default set programmed into the licas script. The following checks are made:

      1. If filter and function are `null`, then return true. If either are not null, then try to evaluate that.
      2. If filter is an Element, then try a metadata `structure` match.
      3. If filter is Boolean, then try a true/false match, as for the function.
      4. If filter is any other Object, try an `Object.Equals` with the reply. 5. If function can be cast to a Boolean, then:
      5.1 If true, a `not null` reply is true, otherwise it is false.
      5.2 If false, a `null` reply is true, otherwise it is false.
      6 Otherwise compare the function condition with the result object for true result.

      Parameters:
        `filter` - to filter the method result first, with a matching query or other.
        `function` - a function on the filtered result to satisfy, typically true.
        `objectsMap` - mapping of variable keys to instance value.
      Returns:
        if true, then reply is not null, if false, then reply is null.
      Throws:
        `java.lang.Exception` - any error.