ASTNode (int role) { LOG.assertTrue(ChildRole.isUnique(role)); switch(role){ default: return null; case ChildRole.ARRAY: return getFirstChildNode(); case ChildRole.INDEX: { ASTNode lbracket = findChildByRole(ChildRole.LBRACKET); if (lbracket == null) return null; for(ASTNode child = lbracket.getTreeNext(); child != null; child = child.getTreeNext()){ if (EXPRESSION_BIT_SET.contains(child.getElementType())){ return child; } } return null; } case ChildRole.LBRACKET: return findChildByType(LBRACKET); case ChildRole.RBRACKET: return findChildByType(RBRACKET); } }