public static Result toResult(Object value) {
        if (value == null || value == Result.FALSE || value == Boolean.FALSE ||
            (value instanceof Number && ((Number)value).doubleValue() == 0)) {
            return Result.FALSE;
        } else if (value == INVALID) {
            return Result.INVALID;
        } else if (value instanceof AttributeNode.VariableValueList) {
            return ((AttributeNode.VariableValueList)value).isEmpty() ? Result.FALSE : Result.TRUE;
        } else if (value instanceof ResultList) {
            return ((ResultList)value).toResult();
        } else {
            return Result.TRUE;
        }
    }
Converts the given object value into an instance of this Result enumeration.

@param value The object to convert.
@return The corresponding result value.
document/src/main/java/com/yahoo/document/select/Result.java