class RootNegationCheckVisitor {

    public static Boolean hasTopLevelNegation(JexlNode script) {
        RootNegationCheckVisitor visitor = new RootNegationCheckVisitor();
        
        // ensure all negations are pushed down
        JexlNode pushedDownTree = PushdownNegationVisitor.pushdownNegations(script);
        return !visitor.hasLeafWithoutNegation(pushedDownTree);
    }

}