@Override public final int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == JavaElementType.JAVA_CODE_REFERENCE) { return ChildRole.QUALIFIER; } else if (i == JavaTokenType.DOT) { return ChildRole.DOT; } else if (i == JavaTokenType.IDENTIFIER) { return ChildRole.REFERENCE_NAME; } else { return ChildRoleBase.NONE; } }
@Override public final int getChildRole(final ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); final IElementType i = child.getElementType(); if (i == JavaElementType.REFERENCE_PARAMETER_LIST) { return ChildRole.REFERENCE_PARAMETER_LIST; } if (i == JavaElementType.JAVA_CODE_REFERENCE) { return ChildRole.QUALIFIER; } if (i == JavaTokenType.DOT) { return ChildRole.DOT; } if (i == JavaTokenType.IDENTIFIER) { return ChildRole.REFERENCE_NAME; } return ChildRoleBase.NONE; }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == SWITCH_KEYWORD) { return ChildRole.SWITCH_KEYWORD; } else if (i == LPARENTH) { return ChildRole.LPARENTH; } else if (i == RPARENTH) { return ChildRole.RPARENTH; } else { if (EXPRESSION_BIT_SET.contains(child.getElementType())) { return ChildRole.SWITCH_EXPRESSION; } else if (child.getElementType() == CODE_BLOCK) { return ChildRole.SWITCH_BODY; } else { return ChildRoleBase.NONE; } } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == ASSERT_KEYWORD) { return ChildRole.ASSERT_KEYWORD; } else if (i == COLON) { return ChildRole.COLON; } else if (i == SEMICOLON) { return ChildRole.CLOSING_SEMICOLON; } else { if (EXPRESSION_BIT_SET.contains(child.getElementType())) { int role = getChildRole(child, ChildRole.CONDITION); if (role != ChildRoleBase.NONE) return role; return ChildRole.ASSERT_DESCRIPTION; } return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { IElementType i = child.getElementType(); if (i == JavaElementType.TYPE) { return ChildRole.TYPE_IN_REFERENCE_PARAMETER_LIST; } else if (i == JavaTokenType.COMMA) { return ChildRole.COMMA; } else if (i == JavaTokenType.LT) { return ChildRole.LT_IN_TYPE_LIST; } else if (i == JavaTokenType.GT) { return ChildRole.GT_IN_TYPE_LIST; } else { return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == CASE_KEYWORD) { return ChildRole.CASE_KEYWORD; } else if (i == DEFAULT_KEYWORD) { return ChildRole.DEFAULT_KEYWORD; } else if (i == COLON) { return ChildRole.COLON; } else { if (EXPRESSION_BIT_SET.contains(child.getElementType())) { return ChildRole.CASE_EXPRESSION; } else { return ChildRoleBase.NONE; } } }
@Override public int getChildRole(final ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); final IElementType elType = child.getElementType(); if (elType == AND) { return ChildRole.AMPERSAND_IN_BOUNDS_LIST; } else if (elType == JavaElementType.JAVA_CODE_REFERENCE) { return ChildRole.BASE_CLASS_REFERENCE; } else if (elType == JavaTokenType.EXTENDS_KEYWORD) { return ChildRole.EXTENDS_KEYWORD; } else { return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == C_STYLE_COMMENT || i == END_OF_LINE_COMMENT) { { return ChildRoleBase.NONE; } } else if (i == MODIFIER_LIST) { return ChildRole.MODIFIER_LIST; } else if (i == CODE_BLOCK) { return ChildRole.METHOD_BODY; } else { return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == MODIFIER_LIST) { return ChildRole.MODIFIER_LIST; } else if (i == TYPE) { return getChildRole(child, ChildRole.TYPE); } else if (i == JavaTokenType.IDENTIFIER) { return getChildRole(child, ChildRole.NAME); } else if (i == JavaTokenType.EQ) { return getChildRole(child, ChildRole.INITIALIZER_EQ); } else if (i == JavaTokenType.SEMICOLON) { return getChildRole(child, ChildRole.CLOSING_SEMICOLON); } else { if (ElementType.EXPRESSION_BIT_SET.contains(child.getElementType())) { return ChildRole.INITIALIZER; } return ChildRoleBase.NONE; } }
@Override public int getChildRole(final ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); final IElementType elType = child.getElementType(); if (elType == JavaElementType.TYPE_PARAMETER) { return ChildRole.TYPE_PARAMETER_IN_LIST; } else if (elType == JavaTokenType.COMMA) { return ChildRole.COMMA; } else if (elType == JavaTokenType.LT) { return ChildRole.LT_IN_TYPE_LIST; } else if (elType == JavaTokenType.GT) { return ChildRole.GT_IN_TYPE_LIST; } else { return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == BREAK_KEYWORD) { return ChildRole.BREAK_KEYWORD; } else if (i == IDENTIFIER) { return ChildRole.LABEL; } else if (i == SEMICOLON) { return ChildRole.CLOSING_SEMICOLON; } else { return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == RETURN_KEYWORD) { return ChildRole.RETURN_KEYWORD; } else if (i == SEMICOLON) { return ChildRole.CLOSING_SEMICOLON; } else { if (EXPRESSION_BIT_SET.contains(child.getElementType())) { return ChildRole.RETURN_VALUE; } else { return ChildRoleBase.NONE; } } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == JavaTokenType.DOT) { return ChildRole.DOT; } else if (i == JavaElementType.REFERENCE_PARAMETER_LIST) { return ChildRole.REFERENCE_PARAMETER_LIST; } else if (i == JavaTokenType.IDENTIFIER || i == JavaTokenType.THIS_KEYWORD || i == JavaTokenType.SUPER_KEYWORD) { return ChildRole.REFERENCE_NAME; } else { if (ElementType.EXPRESSION_BIT_SET.contains(child.getElementType())) { return ChildRole.QUALIFIER; } return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == WHILE_KEYWORD) { return ChildRole.WHILE_KEYWORD; } else if (i == LPARENTH) { return ChildRole.LPARENTH; } else if (i == RPARENTH) { return ChildRole.RPARENTH; } else { if (EXPRESSION_BIT_SET.contains(child.getElementType())) { return ChildRole.CONDITION; } else if (child.getPsi() instanceof PsiStatement) { return ChildRole.LOOP_BODY; } else { return ChildRoleBase.NONE; } } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == SYNCHRONIZED_KEYWORD) { return ChildRole.SYNCHRONIZED_KEYWORD; } else if (i == LPARENTH) { return ChildRole.LPARENTH; } else if (i == RPARENTH) { return ChildRole.RPARENTH; } else if (i == CODE_BLOCK) { return ChildRole.BLOCK; } else { if (EXPRESSION_BIT_SET.contains(child.getElementType())) { return ChildRole.LOCK; } return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == LPARENTH) { return ChildRole.LPARENTH; } else if (i == RPARENTH) { return ChildRole.RPARENTH; } else { if (EXPRESSION_BIT_SET.contains(child.getElementType())) { return ChildRole.EXPRESSION; } return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == PARAMETER) { return ChildRole.PARAMETER; } else if (i == CODE_BLOCK) { return ChildRole.CATCH_BLOCK; } else if (i == CATCH_KEYWORD) { return ChildRole.CATCH_KEYWORD; } else if (i == LPARENTH) { return ChildRole.CATCH_BLOCK_PARAMETER_LPARENTH; } else if (i == RPARENTH) { return ChildRole.CATCH_BLOCK_PARAMETER_RPARENTH; } return ChildRoleBase.NONE; }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == JavaTokenType.PACKAGE_KEYWORD) { return ChildRole.PACKAGE_KEYWORD; } else if (i == JavaElementType.JAVA_CODE_REFERENCE) { return ChildRole.PACKAGE_REFERENCE; } else if (i == JavaTokenType.SEMICOLON) { return ChildRole.CLOSING_SEMICOLON; } else if (i == JavaElementType.MODIFIER_LIST) { return ChildRole.MODIFIER_LIST; } else { return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == JavaElementType.PACKAGE_STATEMENT) { return ChildRole.PACKAGE_STATEMENT; } else if (i == JavaElementType.IMPORT_LIST) { return ChildRole.IMPORT_LIST; } else if (i == JavaElementType.CLASS) { return ChildRole.CLASS; } else { return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == LBRACKET) { return ChildRole.LBRACKET; } else if (i == RBRACKET) { return ChildRole.RBRACKET; } else { if (EXPRESSION_BIT_SET.contains(child.getElementType())) { return child == getFirstChildNode() ? ChildRole.ARRAY : ChildRole.INDEX; } else { return ChildRoleBase.NONE; } } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == JavaTokenType.COMMA) { return ChildRole.COMMA; } else if (i == JavaTokenType.LPARENTH) { return ChildRole.LPARENTH; } else if (i == JavaTokenType.RPARENTH) { return ChildRole.RPARENTH; } else { if (ElementType.EXPRESSION_BIT_SET.contains(child.getElementType())) { return ChildRole.EXPRESSION_IN_LIST; } return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == TRY_KEYWORD) { return ChildRole.TRY_KEYWORD; } else if (i == FINALLY_KEYWORD) { return ChildRole.FINALLY_KEYWORD; } else if (i == CATCH_SECTION) { return ChildRole.CATCH_SECTION; } else { if (child.getElementType() == CODE_BLOCK) { int role = getChildRole(child, ChildRole.TRY_BLOCK); if (role != ChildRoleBase.NONE) return role; return getChildRole(child, ChildRole.FINALLY_BLOCK); } else { return ChildRoleBase.NONE; } } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (PARAMETER_SET.contains((i))) { return ChildRole.PARAMETER; } else if (i == COMMA) { return ChildRole.COMMA; } else if (i == LPARENTH) { return getChildRole(child, ChildRole.LPARENTH); } else if (i == RPARENTH) { return getChildRole(child, ChildRole.RPARENTH); } else { return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); if (ElementType.EXPRESSION_BIT_SET.contains(child.getElementType())){ int role = getChildRole(child, ChildRole.CONDITION); if (role != ChildRoleBase.NONE) return role; role = getChildRole(child, ChildRole.THEN_EXPRESSION); if (role != ChildRoleBase.NONE) return role; role = getChildRole(child, ChildRole.ELSE_EXPRESSION); return role; } if (child.getElementType() == JavaTokenType.QUEST){ return ChildRole.QUEST; } if (child.getElementType() == JavaTokenType.COLON){ return ChildRole.COLON; } return ChildRoleBase.NONE; }
@Override public int getChildRole(ASTNode child) { IElementType i = child.getElementType(); if (i == JavaTokenType.COMMA) { return ChildRole.COMMA; } else if (i == JavaTokenType.LPARENTH) { return ChildRole.LPARENTH; } else if (i == JavaTokenType.RPARENTH) { return ChildRole.RPARENTH; } else if (ElementType.ANNOTATION_MEMBER_VALUE_BIT_SET.contains(i) || (i == JavaElementType.NAME_VALUE_PAIR && child.getFirstChildNode() != null && child.getFirstChildNode().getElementType() == JavaElementType.ANNOTATION_ARRAY_INITIALIZER)) { return ChildRole.ANNOTATION_VALUE; } else { return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == JAVA_CODE_REFERENCE) { return ChildRole.QUALIFIER; } else if (i == DOT) { return ChildRole.DOT; } else if (i == THIS_KEYWORD) { return ChildRole.THIS_KEYWORD; } else { return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == JavaTokenType.COMMA) { return ChildRole.COMMA; } else if (i == JavaTokenType.LBRACE) { return ChildRole.LBRACE; } else if (i == JavaTokenType.RBRACE) { return ChildRole.RBRACE; } else if (MEMBER_SET.contains(child.getElementType())) { return ChildRole.ANNOTATION_VALUE; } return ChildRoleBase.NONE; }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == JavaElementType.MODIFIER_LIST) { return ChildRole.MODIFIER_LIST; } else if (i == JavaElementType.TYPE) { return getChildRole(child, ChildRole.TYPE); } else if (i == JavaTokenType.IDENTIFIER) { return getChildRole(child, ChildRole.NAME); } else { return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == JavaTokenType.IMPLEMENTS_KEYWORD) { return ChildRole.IMPLEMENTS_KEYWORD; } else if (i == JavaTokenType.COMMA) { return ChildRole.COMMA; } else if (i == JavaElementType.JAVA_CODE_REFERENCE) { return ChildRole.REFERENCE_IN_LIST; } else { return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == JavaTokenType.EXTENDS_KEYWORD) { return ChildRole.EXTENDS_KEYWORD; } else if (i == JavaTokenType.COMMA) { return ChildRole.COMMA; } else if (i == JavaElementType.JAVA_CODE_REFERENCE) { return ChildRole.REFERENCE_IN_LIST; } else { return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == TYPE) { return ChildRole.TYPE; } else if (i == INSTANCEOF_KEYWORD) { return ChildRole.INSTANCEOF_KEYWORD; } else { if (EXPRESSION_BIT_SET.contains(child.getElementType())) { return ChildRole.OPERAND; } return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == TYPE) { return ChildRole.TYPE; } else if (i == DOT) { return ChildRole.DOT; } else if (i == CLASS_KEYWORD) { return ChildRole.CLASS_KEYWORD; } else { return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == JavaTokenType.IMPORT_KEYWORD) { return ChildRole.IMPORT_KEYWORD; } else if (i == JavaElementType.JAVA_CODE_REFERENCE) { return ChildRole.IMPORT_REFERENCE; } else if (i == JavaTokenType.DOT) { return ChildRole.IMPORT_ON_DEMAND_DOT; } else if (i == JavaTokenType.ASTERISK) { return ChildRole.IMPORT_ON_DEMAND_ASTERISK; } else if (i == JavaTokenType.SEMICOLON) { return ChildRole.CLOSING_SEMICOLON; } else { return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == THROW_KEYWORD) { return ChildRole.THROW_KEYWORD; } else if (i == SEMICOLON) { return ChildRole.CLOSING_SEMICOLON; } else { if (EXPRESSION_BIT_SET.contains(child.getElementType())) { return ChildRole.EXCEPTION; } else { return ChildRoleBase.NONE; } } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == JAVA_CODE_REFERENCE) { return ChildRole.QUALIFIER; } else if (i == DOT) { return ChildRole.DOT; } else if (i == SUPER_KEYWORD) { return ChildRole.SUPER_KEYWORD; } else { return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == JavaTokenType.THROWS_KEYWORD) { return ChildRole.THROWS_KEYWORD; } else if (i == JavaTokenType.COMMA) { return ChildRole.COMMA; } else if (i == JavaElementType.JAVA_CODE_REFERENCE) { return ChildRole.REFERENCE_IN_LIST; } else { return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == JavaTokenType.COMMA) { return ChildRole.COMMA; } else if (i == JavaTokenType.LBRACE) { return ChildRole.LBRACE; } else if (i == JavaTokenType.RBRACE) { return ChildRole.RBRACE; } else { if (ElementType.EXPRESSION_BIT_SET.contains(child.getElementType())) { return ChildRole.EXPRESSION_IN_LIST; } return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == IDENTIFIER) { return ChildRole.LABEL_NAME; } else if (i == COLON) { return ChildRole.COLON; } else { if (child.getPsi() instanceof PsiStatement) { return ChildRole.STATEMENT; } return ChildRoleBase.NONE; } }
@Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); if (i == CONTINUE_KEYWORD) { return ChildRole.CONTINUE_KEYWORD; } else if (i == IDENTIFIER) { return ChildRole.LABEL; } else if (i == SEMICOLON) { return ChildRole.CLOSING_SEMICOLON; } else { return ChildRoleBase.NONE; } }
public static boolean isUnique(int role) { switch(role){ default: return true; case ChildRoleBase.NONE: case CLASS: case FIELD: case METHOD: case PARAMETER: case CLASS_INITIALIZER: case COMMA: case REFERENCE_IN_LIST: case EXPRESSION_IN_LIST: case ARRAY_DIMENSION: case TYPE_PARAMETER_IN_LIST: case ANNOTATION_VALUE: return false; } }