@Override public boolean matches(final INode other, final Match match) { if (other instanceof IndexerExpression) { final IndexerExpression otherIndexer = (IndexerExpression) other; return !otherIndexer.isNull() && getTarget().matches(otherIndexer.getTarget(), match) && getArgument().matches(otherIndexer.getArgument(), match); } return false; } }
public final Expression getTarget() { return getChildByRole(Roles.TARGET_EXPRESSION); }
public IndexerExpression( final int offset, final Expression target, final Expression argument) { super( offset); setTarget(target); setArgument(argument); }
@Override public Void visitIndexerExpression(final IndexerExpression node, final Void ignored) { startNode(node); node.getTarget().acceptVisitor(this, ignored); space(policy.SpaceBeforeMethodCallParentheses); writeToken(Roles.LEFT_BRACKET); node.getArgument().acceptVisitor(this, ignored); writeToken(Roles.RIGHT_BRACKET); endNode(node); return null; }
final InvocationExpression argument = (InvocationExpression) indexer.getArgument(); final MemberReferenceExpression memberReference = (MemberReferenceExpression) argument.getTarget(); final Expression newTest = memberReference.getTarget(); indexer.replaceWith(newTest);
@Override public Void visitIndexerExpression(final IndexerExpression node, final Void data) { parenthesizeIfRequired(node.getTarget(), PRIMARY); if (node.getTarget() instanceof ArrayCreationExpression) { final ArrayCreationExpression arrayCreation = (ArrayCreationExpression) node.getTarget(); if (_insertParenthesesForReadability || arrayCreation.getInitializer().isNull()) { // require parentheses for "(new int[1])[0]" parenthesize(arrayCreation); } } return super.visitIndexerExpression(node, data); }
public final void setTarget(final Expression value) { setChildByRole(Roles.TARGET_EXPRESSION, value); }
return new IndexerExpression( byteCode.getOffset(), arg1, arg2); new IndexerExpression( byteCode.getOffset(), arg1, arg2), arg3 );
@Override public Void visitIndexerExpression(final IndexerExpression node, final Void ignored) { startNode(node); node.getTarget().acceptVisitor(this, ignored); space(policy.SpaceBeforeMethodCallParentheses); writeToken(Roles.LEFT_BRACKET); node.getArgument().acceptVisitor(this, ignored); writeToken(Roles.RIGHT_BRACKET); endNode(node); return null; }
final InvocationExpression argument = (InvocationExpression) indexer.getArgument(); final MemberReferenceExpression memberReference = (MemberReferenceExpression) argument.getTarget(); final Expression newTest = memberReference.getTarget(); indexer.replaceWith(newTest);
@Override public Void visitIndexerExpression(final IndexerExpression node, final Void data) { parenthesizeIfRequired(node.getTarget(), PRIMARY); if (node.getTarget() instanceof ArrayCreationExpression) { final ArrayCreationExpression arrayCreation = (ArrayCreationExpression) node.getTarget(); if (_insertParenthesesForReadability || arrayCreation.getInitializer().isNull()) { // require parentheses for "(new int[1])[0]" parenthesize(arrayCreation); } } return super.visitIndexerExpression(node, data); }
public final void setArgument(final Expression value) { setChildByRole(Roles.ARGUMENT, value); }
return new IndexerExpression( byteCode.getOffset(), arg1, arg2); new IndexerExpression( byteCode.getOffset(), arg1, arg2), arg3 );
@Override public Void visitIndexerExpression(final IndexerExpression node, final Void ignored) { startNode(node); node.getTarget().acceptVisitor(this, ignored); space(policy.SpaceBeforeMethodCallParentheses); writeToken(Roles.LEFT_BRACKET); node.getArgument().acceptVisitor(this, ignored); writeToken(Roles.RIGHT_BRACKET); endNode(node); return null; }
@Override public boolean matches(final INode other, final Match match) { if (other instanceof IndexerExpression) { final IndexerExpression otherIndexer = (IndexerExpression) other; return !otherIndexer.isNull() && getTarget().matches(otherIndexer.getTarget(), match) && getArgument().matches(otherIndexer.getArgument(), match); } return false; } }
public IndexerExpression( final int offset, final Expression target, final Expression argument) { super( offset); setTarget(target); setArgument(argument); }
public final JavaTokenNode getLeftBracketToken() { return getChildByRole(Roles.LEFT_BRACKET); }
final InvocationExpression argument = (InvocationExpression) indexer.getArgument(); final MemberReferenceExpression memberReference = (MemberReferenceExpression) argument.getTarget(); final Expression newTest = memberReference.getTarget(); indexer.replaceWith(newTest);
@Override public Void visitIndexerExpression(final IndexerExpression node, final Void data) { parenthesizeIfRequired(node.getTarget(), PRIMARY); if (node.getTarget() instanceof ArrayCreationExpression) { final ArrayCreationExpression arrayCreation = (ArrayCreationExpression) node.getTarget(); if (_insertParenthesesForReadability || arrayCreation.getInitializer().isNull()) { // require parentheses for "(new int[1])[0]" parenthesize(arrayCreation); } } return super.visitIndexerExpression(node, data); }
public final void setTarget(final Expression value) { setChildByRole(Roles.TARGET_EXPRESSION, value); }