ASTNode (int role) { LOG.assertTrue(ChildRole.isUnique(role)); switch(role){ default: return null; case ChildRole.REFERENCE_PARAMETER_LIST: return findChildByType(JavaElementType.REFERENCE_PARAMETER_LIST); case ChildRole.QUALIFIER: TreeElement firstChild = getFirstChildNode(); if (firstChild != null && firstChild.getElementType() != JavaTokenType.NEW_KEYWORD) { return firstChild; } else { return null; } case ChildRole.DOT: return findChildByType(JavaTokenType.DOT); case ChildRole.NEW_KEYWORD: return findChildByType(JavaTokenType.NEW_KEYWORD); case ChildRole.ANONYMOUS_CLASS: return findChildByType(JavaElementType.ANONYMOUS_CLASS); case ChildRole.TYPE_REFERENCE: return findChildByType(JavaElementType.JAVA_CODE_REFERENCE); case ChildRole.TYPE_KEYWORD: return findChildByType(ElementType.PRIMITIVE_TYPE_BIT_SET); case ChildRole.ARGUMENT_LIST: return findChildByType(JavaElementType.EXPRESSION_LIST); case ChildRole.LBRACKET: return findChildByType(JavaTokenType.LBRACKET); case ChildRole.RBRACKET: return findChildByType(JavaTokenType.RBRACKET); case ChildRole.ARRAY_INITIALIZER: if (getLastChildNode().getElementType() == JavaElementType.ARRAY_INITIALIZER_EXPRESSION){ return getLastChildNode(); } else{ return null; } } }