Example usage for org.eclipse.jdt.core.dom PrefixExpression.Operator equals

List of usage examples for org.eclipse.jdt.core.dom PrefixExpression.Operator equals

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom PrefixExpression.Operator equals.

Prototype

@Override
public final boolean equals(Object obj) 

Source Link

Document

The ASTNode implementation of this Object method uses object identity (==).

Usage

From source file:org.autorefactor.refactoring.ASTHelper.java

License:Open Source License

/**
 * Returns whether the provided operator is the same as the one of provided node.
 *
 * @param node the node for which to test the operator
 * @param operator the operator to test/*w  ww . j av  a2  s  .  com*/
 * @return true if the provided node has the provided operator, false otherwise.
 */
public static boolean hasOperator(PrefixExpression node, PrefixExpression.Operator operator) {
    return node != null && operator.equals(node.getOperator());
}

From source file:org.jboss.tools.arquillian.ui.internal.refactoring.AddMissingTypeRefactoring.java

License:Open Source License

private static boolean isLeftValue(ASTNode node) {
    ASTNode parent = node.getParent();//from w w w . j a v a  2s  .  c o m
    if (parent instanceof Assignment) {
        Assignment assignment = (Assignment) parent;
        if (assignment.getLeftHandSide() == node)
            return true;
    }
    if (parent instanceof PostfixExpression)
        return true;
    if (parent instanceof PrefixExpression) {
        PrefixExpression.Operator op = ((PrefixExpression) parent).getOperator();
        if (op.equals(PrefixExpression.Operator.DECREMENT))
            return true;
        if (op.equals(PrefixExpression.Operator.INCREMENT))
            return true;
        return false;
    }
    return false;
}