List of usage examples for org.eclipse.jdt.core.dom Assignment getOperator
public Assignment.Operator getOperator()
From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java
License:Open Source License
@Override public boolean visit(Assignment node) { node.getLeftHandSide().accept(this); this.fBuffer.append(node.getOperator().toString()); node.getRightHandSide().accept(this); return false; }
From source file:boa.datagen.util.Java7Visitor.java
License:Apache License
@Override public boolean visit(Assignment node) { boa.types.Ast.Expression.Builder b = boa.types.Ast.Expression.newBuilder(); // b.setPosition(pos.build()); node.getLeftHandSide().accept(this); b.addExpressions(expressions.pop()); node.getRightHandSide().accept(this); b.addExpressions(expressions.pop()); if (node.getOperator() == Assignment.Operator.ASSIGN) b.setKind(boa.types.Ast.Expression.ExpressionKind.ASSIGN); else if (node.getOperator() == Assignment.Operator.BIT_AND_ASSIGN) b.setKind(boa.types.Ast.Expression.ExpressionKind.ASSIGN_BITAND); else if (node.getOperator() == Assignment.Operator.BIT_OR_ASSIGN) b.setKind(boa.types.Ast.Expression.ExpressionKind.ASSIGN_BITOR); else if (node.getOperator() == Assignment.Operator.BIT_XOR_ASSIGN) b.setKind(boa.types.Ast.Expression.ExpressionKind.ASSIGN_BITXOR); else if (node.getOperator() == Assignment.Operator.DIVIDE_ASSIGN) b.setKind(boa.types.Ast.Expression.ExpressionKind.ASSIGN_DIV); else if (node.getOperator() == Assignment.Operator.LEFT_SHIFT_ASSIGN) b.setKind(boa.types.Ast.Expression.ExpressionKind.ASSIGN_LSHIFT); else if (node.getOperator() == Assignment.Operator.MINUS_ASSIGN) b.setKind(boa.types.Ast.Expression.ExpressionKind.ASSIGN_SUB); else if (node.getOperator() == Assignment.Operator.PLUS_ASSIGN) b.setKind(boa.types.Ast.Expression.ExpressionKind.ASSIGN_ADD); else if (node.getOperator() == Assignment.Operator.REMAINDER_ASSIGN) b.setKind(boa.types.Ast.Expression.ExpressionKind.ASSIGN_MOD); else if (node.getOperator() == Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN) b.setKind(boa.types.Ast.Expression.ExpressionKind.ASSIGN_RSHIFT); else if (node.getOperator() == Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN) b.setKind(boa.types.Ast.Expression.ExpressionKind.ASSIGN_UNSIGNEDRSHIFT); else if (node.getOperator() == Assignment.Operator.TIMES_ASSIGN) b.setKind(boa.types.Ast.Expression.ExpressionKind.ASSIGN_MULT); expressions.push(b.build());// w w w. j a va 2 s.c o m return false; }
From source file:ca.mcgill.cs.swevo.jayfx.ASTCrawler.java
License:Open Source License
@Override public boolean visit(final FieldAccess pNode) { final IVariableBinding lBinding = (IVariableBinding) pNode.getName().resolveBinding(); if (lBinding == null) { ASTCrawler.log("Null binding 1 for " + pNode.toString()); return false; }/* www. j av a 2 s . c o m*/ this.addAccessRelation(lBinding); final Assignment assignment = ASTCrawler.getAssignment(pNode); if (assignment != null) { this.addSetsRelation(lBinding); if (!(assignment.getOperator() == Assignment.Operator.ASSIGN)) this.addGetsRelation(lBinding); } else this.addGetsRelation(lBinding); return true; }
From source file:ca.mcgill.cs.swevo.jayfx.ASTCrawler.java
License:Open Source License
@Override public boolean visit(final QualifiedName pNode) { final IBinding lBinding = pNode.resolveBinding(); if (lBinding == null) { ASTCrawler.log("Null binding 3 for " + pNode); return false; }/*from w w w. ja v a2s. co m*/ if (lBinding.getKind() == IBinding.VARIABLE) if (((IVariableBinding) lBinding).isField() && this.aCurrMethod != null) { this.addAccessRelation((IVariableBinding) lBinding); final Assignment assignment = ASTCrawler.getAssignment(pNode); if (assignment != null) { this.addSetsRelation((IVariableBinding) lBinding); if (!(assignment.getOperator() == Assignment.Operator.ASSIGN)) this.addGetsRelation((IVariableBinding) lBinding); } else this.addGetsRelation((IVariableBinding) lBinding); } return false; }
From source file:ca.mcgill.cs.swevo.jayfx.ASTCrawler.java
License:Open Source License
@Override public boolean visit(final SimpleName pNode) { final IBinding lBinding = pNode.resolveBinding(); if (lBinding == null) // Occurs for all labels (e.g., loop labels) // log( "Null binding 4 for " + pNode ); return false; if (lBinding.getKind() == IBinding.VARIABLE) if (((IVariableBinding) lBinding).isField()) { this.addAccessRelation((IVariableBinding) lBinding); final Assignment assignment = ASTCrawler.getAssignment(pNode); if (assignment != null) { this.addSetsRelation((IVariableBinding) lBinding); if (!(assignment.getOperator() == Assignment.Operator.ASSIGN)) this.addGetsRelation((IVariableBinding) lBinding); } else this.addGetsRelation((IVariableBinding) lBinding); }/*ww w . ja v a 2 s . c om*/ return false; }
From source file:ca.mcgill.cs.swevo.jayfx.ASTCrawler.java
License:Open Source License
@Override public boolean visit(final SuperFieldAccess pNode) { final IVariableBinding lBinding = (IVariableBinding) pNode.getName().resolveBinding(); if (lBinding == null) { ASTCrawler.log("Null binding 2 for" + pNode); return false; }/*from w w w. j a v a 2s . c o m*/ this.addAccessRelation(lBinding); final Assignment assignment = ASTCrawler.getAssignment(pNode); if (assignment != null) { this.addSetsRelation(lBinding); if (!(assignment.getOperator() == Assignment.Operator.ASSIGN)) this.addGetsRelation(lBinding); } else this.addGetsRelation(lBinding); return true; }
From source file:coloredide.utils.CopiedNaiveASTFlattener.java
License:Open Source License
public boolean visit(Assignment node) { node.getLeftHandSide().accept(this); this.buffer.append(node.getOperator().toString()); node.getRightHandSide().accept(this); return false; }
From source file:com.bsiag.eclipse.jdt.java.formatter.linewrap.WrapPreparator.java
License:Open Source License
@Override public boolean visit(Assignment node) { this.wrapIndexes.add(this.tm.firstIndexIn(node.getRightHandSide(), -1)); int operatorIndex = this.tm.firstIndexBefore(node.getRightHandSide(), -1); while (this.tm.get(operatorIndex).isComment()) operatorIndex--;// w w w.j a v a2 s . c o m assert node.getOperator().toString().equals(this.tm.toString(operatorIndex)); this.wrapParentIndex = operatorIndex; this.wrapGroupEnd = this.tm.lastIndexIn(node.getRightHandSide(), -1); handleWrap(this.options.alignment_for_assignment); return true; }
From source file:com.bsiag.eclipse.jdt.java.formatter.SpacePreparator.java
License:Open Source License
@Override public boolean visit(Assignment node) { handleOperator(node.getOperator().toString(), node.getRightHandSide(), this.options.insert_space_before_assignment_operator, this.options.insert_space_after_assignment_operator); return true;//ww w .j a v a 2 s . co m }
From source file:com.google.dart.java2dart.SyntaxTranslator.java
License:Open Source License
@Override public boolean visit(org.eclipse.jdt.core.dom.Assignment node) { Expression left = translate(node.getLeftHandSide()); Expression right = translate(node.getRightHandSide()); // operator// w w w. j a v a 2s. co m TokenType tokenType = null; org.eclipse.jdt.core.dom.Assignment.Operator javaOperator = node.getOperator(); if (javaOperator == org.eclipse.jdt.core.dom.Assignment.Operator.ASSIGN) { tokenType = TokenType.EQ; } if (javaOperator == org.eclipse.jdt.core.dom.Assignment.Operator.PLUS_ASSIGN) { tokenType = TokenType.PLUS_EQ; } if (javaOperator == org.eclipse.jdt.core.dom.Assignment.Operator.MINUS_ASSIGN) { tokenType = TokenType.MINUS_EQ; } if (javaOperator == org.eclipse.jdt.core.dom.Assignment.Operator.TIMES_ASSIGN) { tokenType = TokenType.STAR_EQ; } if (javaOperator == org.eclipse.jdt.core.dom.Assignment.Operator.DIVIDE_ASSIGN) { tokenType = TokenType.SLASH_EQ; } if (javaOperator == org.eclipse.jdt.core.dom.Assignment.Operator.REMAINDER_ASSIGN) { tokenType = TokenType.PERCENT_EQ; } if (javaOperator == org.eclipse.jdt.core.dom.Assignment.Operator.LEFT_SHIFT_ASSIGN) { tokenType = TokenType.LT_LT_EQ; } if (javaOperator == org.eclipse.jdt.core.dom.Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN || javaOperator == org.eclipse.jdt.core.dom.Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN) { tokenType = TokenType.GT_GT_EQ; } if (javaOperator == org.eclipse.jdt.core.dom.Assignment.Operator.BIT_XOR_ASSIGN) { tokenType = TokenType.CARET_EQ; } if (javaOperator == org.eclipse.jdt.core.dom.Assignment.Operator.BIT_OR_ASSIGN) { tokenType = TokenType.BAR_EQ; } if (javaOperator == org.eclipse.jdt.core.dom.Assignment.Operator.BIT_AND_ASSIGN) { tokenType = TokenType.AMPERSAND_EQ; } Assert.isNotNull(tokenType, "No token for: " + javaOperator); // done return done(new AssignmentExpression(left, new Token(tokenType, 0), right)); }