Check if Node always mean true or false in boolean context
968472
private static int isAlwaysDefinedBoolean(Node node) {
        switch (node.getType()) {
          case Token.FALSE:
          case Token.NULL:
            return ALWAYS_FALSE_BOOLEAN;
          case Token.TRUE:
            return ALWAYS_TRUE_BOOLEAN;
          case Token.NUMBER: {
            double num = node.getDouble();
            if (num == num && num != 0.0) {
                return ALWAYS_TRUE_BOOLEAN;
            }
            return ALWAYS_FALSE_BOOLEAN;
          }
        }
        return 0;
    }
974507
public boolean optBoolean(String key){
		LazyNode token=getOptionalFieldToken(key);
		if(token==null)return false;
		if(token.type==LazyNode.VALUE_STRING || token.type==LazyNode.VALUE_ESTRING){
			String str=token.getStringValue().toLowerCase().trim();
			if(str.equals("true"))return true;
			if(str.equals("false"))return false;
			throw new LazyException("Requested value is not a boolean",token);
		}
		// if(token.type==LazyNode.VALUE_NULL)return false;
		if(token.type==LazyNode.VALUE_TRUE)return true;
		// if(token.type==LazyNode.VALUE_FALSE)return false;
		return false;
	}
22894
def _convert_simple_value_boolean_query_to_and_boolean_queries(tree, keyword):
    """"""

    def _create_operator_node(value_node):
        """Creates a KeywordOp or a ValueOp node."""
        base_node = value_node.op if isinstance(value_node, NotOp) else value_node
        updated_base_node = KeywordOp(keyword, base_node) if keyword else ValueOp(base_node)

        return NotOp(updated_base_node) if isinstance(value_node, NotOp) else updated_base_node

    def _get_bool_op_type(bool_op):
        return AndOp if isinstance(bool_op, And) else OrOp

    new_tree_root = _get_bool_op_type(tree.bool_op)(None, None)
    current_tree = new_tree_root
    previous_tree = tree

    while True:  # Walk down the tree while building the new AndOp queries subtree.
        current_tree.left = _create_operator_node(previous_tree.left)

        if not isinstance(previous_tree.right, SimpleValueBooleanQuery):
            current_tree.right = _create_operator_node(previous_tree.right)
            break

        previous_tree = previous_tree.right
        current_tree.right = _get_bool_op_type(previous_tree.bool_op)(None, None)
        current_tree = current_tree.right

    return new_tree_root
1041536
private boolean isBooleanFalse() {

        if (getNode().getDataKey() >= 0) {
            return false;
        } else { // is AtomicValue
            if (getNode().getTypeKey() == NamePageHash.generateHashForString("xs:boolean")) {
                // atomic value of type boolean
                // return true, if atomic values's value is false
                return !(Boolean.parseBoolean(new String(((ITreeValData)getNode()).getRawValue())));

            } else {
                return false;
            }
        }

    }
851307
function(one, two) {
        if (one.tag != two.tag) {
            return false;
        } else if (one.text.trim() != two.text.trim()) {
            return false;
        } else if (one._children.length != two._children.length) {
            return false;
        }

        if (!attribMatch(one, two)) return false;

        for (var i = 0; i < one._children.length; i++) {
            if (!module.exports.equalNodes(one._children[i], two._children[i])) {
                return false;
            }
        }

        return true;
    }
929746
public Boolean getBoolean(int field, String falseText)
   {
      Boolean result;

      if ((field < m_fields.length) && (m_fields[field].length() != 0))
      {
         result = ((m_fields[field].equalsIgnoreCase(falseText) == true) ? Boolean.FALSE : Boolean.TRUE);
      }
      else
      {
         result = null;
      }

      return (result);
   }
73723
public Boolean getBooleanTag(String key) {
		Object value = tags.get(key);
		if (value instanceof Boolean) {
			return (Boolean) value;
		}
		return null;
	}
622224
private boolean validBooleanExpression(Node expr) {
    if (isBooleanOperation(expr)) {
      return validBooleanOperation(expr);
    }

    if (!isOperation(expr)) {
      warnInvalidExpression("boolean", expr);
      return false;
    }
    if (!isValidPredicate(getCallName(expr))) {
      warnInvalid("boolean predicate", expr);
      return false;
    }
    Keywords keyword = nameToKeyword(getCallName(expr));
    if (!checkParameterCount(expr, keyword)) {
      return false;
    }
    switch (keyword.kind) {
      case TYPE_PREDICATE:
        return validTypePredicate(expr, getCallParamCount(expr));
      case STRING_PREDICATE:
        return validStringPredicate(expr, getCallParamCount(expr));
      case TYPEVAR_PREDICATE:
        return validTypevarPredicate(expr, getCallParamCount(expr));
      default:
        throw new IllegalStateException("Invalid boolean expression");
    }
  }
376584
def on_if(self, node):    # ('test', 'body', 'orelse')
        """"""
        block = node.body
        if not self.run(node.test):
            block = node.orelse
        for tnode in block:
            self.run(tnode)
846454
def visit_If(self, node):
        
        currs = (node,)
        raises = ()

        # true branch
        for n in node.body:
            self.result.add_node(n)
            for curr in currs:
                self.result.add_edge(curr, n)
            currs, nraises = self.visit(n)
            raises += nraises
        if is_true_predicate(node.test):
            return currs, raises

        # false branch
        tcurrs = currs
        currs = (node,)
        for n in node.orelse:
            self.result.add_node(n)
            for curr in currs:
                self.result.add_edge(curr, n)
            currs, nraises = self.visit(n)
            raises += nraises
        return tcurrs + currs, raises
283065
public static Boolean asBoolean(String expression, Node node, XPath xpath)
            throws XPathExpressionException {
        String booleanString = evaluateAsString(expression, node, xpath);
        return (isEmptyString(booleanString)) ? null : Boolean.parseBoolean(booleanString);
    }
1142666
function boolean(value) {
  var parsedBoolean = json(value);

  // handle 0|1 case
  if (typeOf(parsedBoolean) == 'number' && [0, 1].indexOf(parsedBoolean) > -1) {
    parsedBoolean = parsedBoolean === 0 ? false : true;
  }

  // couldn't parse it
  if (typeOf(parsedBoolean) != 'boolean') {
    return throwModifierError('boolean', value, {message: 'Invalid Boolean'});
  }

  return parsedBoolean;
}
656295
def bool(self, name):
        """"""
        self._assert_is_string(name)
        frame = self._next_frame()
        if len(frame) != 1:
            raise MessageParserError("Expected exacty 1 byte for boolean value")
        val = frame != b"\x00"
        self.results.__dict__[name] = val
        return self
1180123
def boolean(text):
    

    tmp = text.lower()
    if tmp.isdigit():
        return bool(int(tmp))
    elif tmp in ('t', 'true', 'on', 'yes'):
        return True
    elif tmp in ('f', 'false', 'off', 'no'):
        return False

    raise ValueError("invalid Boolean value %r" % text)
211624
def is_node(objecttype):
    
    if not isclass(objecttype):
        return False

    if not issubclass(objecttype, ObjectType):
        return False

    for i in objecttype._meta.interfaces:
        if issubclass(i, Node):
            return True

    return False
714608
public boolean getBoolean(String key){
		LazyNode token=getFieldToken(key);
		if(token.type==LazyNode.VALUE_STRING || token.type==LazyNode.VALUE_ESTRING){
			String str=token.getStringValue().toLowerCase().trim();
			if(str.equals("true"))return true;
			if(str.equals("false"))return false;
			throw new LazyException("Requested value is not a boolean",token);
		}
		if(token.type==LazyNode.VALUE_TRUE)return true;
		if(token.type==LazyNode.VALUE_FALSE)return false;
		throw new LazyException("Requested value is not a boolean",token);
	}
209547
function validateBoolean(context, name, def) {
  var value = context[name]

  if (value == null) {
    value = def
  }

  if (typeof value !== 'boolean') {
    raise(value, 'options.' + name)
  }

  context[name] = value
}