Exemplo n.º 1
0
 /** {@inheritDoc} */
 public final Object evaluate() {
   Object result = null;
   // if the function returns another function, execute it. stop executing
   // when the result is not of the expected type.
   while (true) {
     result = function.evaluate();
     if (functionType.isInstance(result)) {
       function = (NullaryFunction<?>) result;
       continue;
     } else {
       break;
     }
   }
   return result;
 }
Exemplo n.º 2
0
 /** {@inheritDoc} */
 @Override
 public int hashCode() {
   return "RecursiveEvaluation".hashCode() << 2 ^ function.hashCode();
 }
Exemplo n.º 3
0
 /**
  * Get the class of the specified object, or <code>null</code> if <code>o</code> is <code>null
  * </code>.
  *
  * @param f Object to check
  * @return Class found
  */
 private static Class<?> getClass(NullaryFunction<?> f) {
   return f == null ? null : f.getClass();
 }