Utility method that calls {@link #getResult(CharSequence)} and converts returned value to a boolean.

@param equation will be evaluated.
@return true if: returned value is boolean true, a positive number or non-null string.
964012
public boolean getBooleanResult(final CharSequence equation) {
        final Element result = new ValueElement(getResult(equation), null, null);
        if (result.isBoolean()) {
            return result.getBoolean();
        } else if (result.isInt()) {
            return result.getInt() > 0;
        } else if (result.isFloat()) {
            return result.getFloat() > 0f;
        }
        return !isNullOrFalse(result.getString());
    }
419234
public static void isTrue(Boolean expression) {
		if(!validation) return;
		notNull(expression);
		if(!expression)
			throw new ParameterException(ErrorCode.CONSTRAINT);
	}
859942
public static boolean isBoolean(String number) {
        boolean result = false;
        if (number != null && (number.equalsIgnoreCase("true") || number.equalsIgnoreCase("false"))) {
            result = true;
        }
        return result;
    }
247126
public static boolean getBoolean(
    Object  value)
  {
    if (value == null)
    {
        return false;
    }
    
    if (value instanceof Boolean)
    {
        return ((Boolean) value).booleanValue();
    }

    return Boolean.valueOf(value.toString()).booleanValue();
  }
1327979
def boolean(value):
    
    if isinstance(value, bool):
        return value

    if value == "":
        return False

    return strtobool(value)
399368
public static Boolean parseBoolean(String value) throws ParseException
   {
      Boolean result = null;
      Integer number = parseInteger(value);
      if (number != null)
      {
         result = number.intValue() == 0 ? Boolean.FALSE : Boolean.TRUE;
      }

      return result;
   }
494333
private static boolean isAsciiAlphaNum(String string) {
        for (int i = 0; i < string.length(); i++) {
            final char character = string.charAt(i);
            if (!(character >= 'a' && character <= 'z' ||
                    character >= 'A' && character <= 'Z' ||
                    character >= '0' && character <= '9')) {
                return false;
            }
        }

        return true;
    }
1263770
private boolean isTrue(JSONObject obj, String property) {

        JSONValue val = obj.get(property);
        if (val == null) {
            return false;
        }
        boolean stringTrue = ((val.isString() != null) && Boolean.parseBoolean(val.isString().stringValue()));
        boolean boolTrue = ((val.isBoolean() != null) && val.isBoolean().booleanValue());
        return stringTrue || boolTrue;
    }
47412
public static boolean areStringEquals(String string1, String string2) {
		/* string1	string2	outcome
		 * null		null	true
		 * null		x		false
		 * x		null	false
		 * x		y		false
		 * x		x		true
		 */
		// XXX both null must be unequal? If yes, boolean must be too?
		if (string1 == null && string2 == null) {
			return false;
		} else if (string1 != null && !string1.equals(string2)) {
			return false;
		} else if (string2 != null && !string2.equals(string1)) {
			return false;
		}
		return true;
	}
870554
private boolean isMathExpression(String line) {
        String cleanLine = cleanLine(line).trim();
        boolean mathExpression = false;
        if (cleanLine.startsWith(DEFINE)) {
            return true;
        } else if (cleanLine.matches(CODE_LINE_SUFFIX)) {
            return true;
        }

        // go forward
        int index = cleanLine.indexOf(COPYRIGHT_SYMBOL);
        for (int i = index + 1; i < cleanLine.length(); i++) {
            char c = cleanLine.charAt(i);
            if (c == Constants.OPEN_BRACKET || c == Constants.CLOSE_BRACKET || c == Constants.WHITESPACE_CHAR) {
                continue;
            } else if (MATH_SYMBOLS.contains(c)) {
                mathExpression = true;
                break;
            } else {
                break;
            }
        }

        // go backwards
        if (mathExpression) {
            for (int i = index - 1; i >= 0; i--) {
                char c = cleanLine.charAt(i);
                if (c == Constants.OPEN_BRACKET || c == Constants.CLOSE_BRACKET || c == Constants.WHITESPACE_CHAR) {
                    continue;
                } else if (MATH_SYMBOLS.contains(c)) {
                    mathExpression = true;
                    break;
                } else {
                    break;
                }
            }
        }
        return mathExpression;
    }
170145
public static boolean eq(CharSequence a, CharSequence b) {
        return of(a).equals(of(b));
    }
583460
public static CharSequence toParameterValue(final Boolean value) {
        return value != null ? Boolean.toString(value) : Attr.nullValue();
    }
971226
public boolean toBoolean(Object val) {
    if (val == null) {
      return false;
    }
    else if (val instanceof Boolean) {
      return ((Boolean) val).booleanValue();
    }
    else if (val instanceof Number) {
      double number = toDouble(val);
      return !Double.isNaN(number) && number != 0.d;
    }
    else if (val instanceof String) {
      String strval = val.toString();
      return strval.length() > 0 && !"false".equals(strval);
    }
    else if (val instanceof Collection<?>) {
      Collection<?> collval = (Collection<?>) val;
      return collval.isEmpty();
    }
    return false;
  }
15002
private static BigDecimal doCalculate(String formula) throws Exception {
        Stack<BigDecimal> stack = new Stack<>();
        BigDecimal result = BigDecimal.valueOf(0);
        BigDecimal number = BigDecimal.valueOf(0);
        char sign = '+';
        boolean isDecimal = false;
        BigDecimal decimalSign = new BigDecimal(0.1);

        for (int i = 0; i < formula.length(); i++) {
            char c = formula.charAt(i);
            if (Character.isDigit(c)) {
                BigDecimal num = new BigDecimal(c - '0');
                number = isDecimal ? number.add(num.multiply(decimalSign)) : num.add(number.multiply(BigDecimal
                        .valueOf(10)));
                decimalSign = decimalSign.multiply(BigDecimal.valueOf(0.1));
            } else if (c == '.') {
                isDecimal = true;
                decimalSign = BigDecimal.valueOf(0.1);
            } else if (c == '(') {
                BigDecimal[] res = calculateInlineFormula(i + 1, formula);
                number = number.compareTo(BigDecimal.valueOf(0)) == 0 ? res[0] : number.multiply(res[0]);
                i = res[1].intValue();
            }
            boolean isNotDigit = (!Character.isDigit(c) && c != '.' && c != '(') || i == formula.length() - 1;
            if (isNotDigit) {
                if (sign == '+') {
                    stack.push(number);
                } else if (sign == '-') {
                    stack.push(number.multiply(BigDecimal.valueOf(-1)));
                } else if (sign == '*') {
                    stack.push(number.multiply(stack.pop()));
                } else if (sign == '/') {
                    stack.push(stack.pop().divide(number, getPrecision(), BigDecimal.ROUND_HALF_UP));
                }
                sign = c;
                isDecimal = false;
                number = BigDecimal.valueOf(0);
            }
        }
        for (BigDecimal i : stack) {
            result = result.add(i);
        }
        return result.setScale(getPrecision(), BigDecimal.ROUND_HALF_UP);
    }
447441
public boolean parseBooleanString(String booleanString) {
        StringReader sr = new StringReader(booleanString);
        StreamTokenizer st = new StreamTokenizer(sr);
        boolean value = false;
        int tokenType;
        try {
            tokenType = st.nextToken();
            if (tokenType == StreamTokenizer.TT_WORD) {
                if (st.sval.equalsIgnoreCase("true"))
                    value = true;
            }
        } catch (IOException e) {
            Log.e(TAG, "Boolean Error: " + e);
            e.printStackTrace();
        }
        return value;
    }
565863
public static Boolean checkInfrontBehind(MatchResult r, Sentence s) {
		Boolean ok = true;
		
		// get rid of expressions such as "1999" in 53453.1999
		if (r.start() > 1) {
			if ((s.getCoveredText().substring(r.start() - 2, r.start()).matches("\\d\\."))){
				ok = false;
			}
		}
		
		// get rid of expressions if there is a character or symbol ($+) directly in front of the expression
		if (r.start() > 0) {
			if (((s.getCoveredText().substring(r.start() - 1, r.start()).matches("[\\w\\$\\+]"))) &&
					(!(s.getCoveredText().substring(r.start() - 1, r.start()).matches("\\(")))){
				ok = false;
			}
		}
		
		if (r.end() < s.getCoveredText().length()) {
			if ((s.getCoveredText().substring(r.end(), r.end() + 1).matches("[°\\w]")) &&
					(!(s.getCoveredText().substring(r.end(), r.end() + 1).matches("\\)")))){
				ok = false;
			}
			if (r.end() + 1 < s.getCoveredText().length()) {
				if (s.getCoveredText().substring(r.end(), r.end() + 2).matches(
						"[\\.,]\\d")) {
					ok = false;
				}
			}
		}
		return ok;
	}
1324225
private boolean validConditionalExpression(Node expr) {
    // The expression must have four children:
    // - The cond keyword
    // - A boolean expression
    // - A type transformation expression with the 'if' branch
    // - A type transformation expression with the 'else' branch
    if (!checkParameterCount(expr, Keywords.COND)) {
      return false;
    }
    // Check for the validity of the boolean and the expressions
    if (!validBooleanExpression(getCallArgument(expr, 0))) {
      warnInvalidInside("conditional", expr);
      return false;
    }
    if (!validTypeTransformationExpression(getCallArgument(expr, 1))) {
      warnInvalidInside("conditional", expr);
      return false;
    }
    if (!validTypeTransformationExpression(getCallArgument(expr, 2))) {
      warnInvalidInside("conditional", expr);
      return false;
    }
    return true;
  }