boolean (MatchNode matchNode, IMatchable object) { if (!object.match(matchNode, this)) { return false; } int expr_index = 0; int stat_index = 0; for (MatchNode childNode : matchNode.getChildren()) { boolean isStatement = childNode.getType() == MatchNode.MATCHNODE_STATEMENT; IMatchable childObject = object.findObject(childNode, isStatement ? stat_index : expr_index); if (childObject == null || !match(childNode, childObject)) { return false; } if (isStatement) { stat_index++; } else { expr_index++; } } return true; }