You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Instanceof.java 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* *******************************************************************
  2. * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Eclipse Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://www.eclipse.org/legal/epl-v10.html
  8. *
  9. * Contributors:
  10. * PARC initial implementation
  11. * ******************************************************************/
  12. package org.aspectj.weaver.ast;
  13. import org.aspectj.weaver.UnresolvedType;
  14. public class Instanceof extends Test {
  15. Var var;
  16. UnresolvedType type;
  17. public Instanceof(Var left, UnresolvedType right) {
  18. super();
  19. this.var = left;
  20. this.type = right;
  21. }
  22. public void accept(ITestVisitor v) {
  23. v.visit(this);
  24. }
  25. public String toString() {
  26. return "(" + var + " instanceof " + type + ")";
  27. }
  28. public boolean equals(Object other) {
  29. if (other instanceof Instanceof) {
  30. Instanceof o = (Instanceof) other;
  31. return o.var.equals(var) && o.type.equals(type);
  32. } else {
  33. return false;
  34. }
  35. }
  36. public int hashCode() {
  37. return var.hashCode()*37+type.hashCode();
  38. }
  39. public Var getVar() {
  40. return var;
  41. }
  42. public UnresolvedType getType() {
  43. return type;
  44. }
  45. }