public static Optional<ParserRuleContext> findFirstChildNodeNoneRecursive(final ParserRuleContext node, final RuleName ruleName) {
        if (isMatchedNode(node, ruleName)) {
            return Optional.of(node);
        }
        for (int i = 0; i < node.getChildCount(); i++) {
            if (node.getChild(i) instanceof ParserRuleContext) {
                ParserRuleContext child = (ParserRuleContext) node.getChild(i);
                if (isMatchedNode(child, ruleName)) {
                    return Optional.of(child);
                }
            }
        }
        return Optional.absent();
    }
public static Optional < ParserRuleContext > findFirstChildNodeNoneRecursive ( final ParserRuleContext node , final RuleName ruleName ) { if ( isMatchedNode ( node , ruleName ) ) { return Optional . of ( node ) ; } for ( int i = 0 ; i < node . getChildCount ( ) ; i ++ ) { if ( node . getChild ( i ) instanceof ParserRuleContext ) { ParserRuleContext child = ( ParserRuleContext ) node . getChild ( i ) ; if ( isMatchedNode ( child , ruleName ) ) { return Optional . of ( child ) ; } } } return Optional . absent ( ) ; }
Find first child node none recursive.

@param node start node
@param ruleName rule name
@return matched node