- public static final <AT, DT extends DeclaredStatement<AT>> StmtContext<AT, ?, ?> findFirstDeclaredSubstatement(
- StmtContext<?, ?, ?> stmtContext, Class<DT> declaredType) {
- Collection<? extends StmtContext<?, ?, ?>> declaredSubstatements = stmtContext.declaredSubstatements();
- for (StmtContext<?, ?, ?> subStmtContext : declaredSubstatements) {
- if (producesDeclared(subStmtContext, declaredType)) {
+ public static <AT,DT extends DeclaredStatement<AT>> Collection<StmtContext<AT, DT, ?>> findAllDeclaredSubstatement(
+ final StmtContext<?, ?, ?> stmtContext, final Class<DT> declaredType) {
+ ImmutableList.Builder<StmtContext<AT, DT, ?>> listBuilder = ImmutableList.builder();
+ for (StmtContext<?, ?, ?> subStmtContext : stmtContext.declaredSubstatements()) {
+ if (producesDeclared(subStmtContext,declaredType)) {
+ listBuilder.add((StmtContext<AT, DT, ?>) subStmtContext);
+ }
+ }
+ return listBuilder.build();
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <AT,DT extends DeclaredStatement<AT>> StmtContext<AT, ?, ?> findFirstEffectiveSubstatement(
+ final StmtContext<?, ?, ?> stmtContext, final Class<DT> declaredType) {
+ for (StmtContext<?, ?, ?> subStmtContext : stmtContext.effectiveSubstatements()) {
+ if (producesDeclared(subStmtContext,declaredType)) {