1 2 12 package com.versant.core.jdo.query; 13 14 17 public class UnaryOpNode extends UnaryNode { 18 19 public static final int OP_MINUS = 1; 20 public static final int OP_PLUS = 2; 21 public static final int OP_TILDE = 3; 22 public static final int OP_BANG = 4; 23 24 27 public int op; 28 29 public UnaryOpNode(Node child, int op) { 30 super(child); 31 this.op = op; 32 } 33 34 public Object accept(NodeVisitor visitor, Object [] results) { 35 return visitor.visitUnaryOpNode(this, results); 36 } 37 38 public String toString() { 39 return super.toString() + " " + toOpString(op); 40 } 41 42 public static String toOpString(int op) { 43 switch (op) { 44 case OP_MINUS: 45 return "-"; 46 case OP_PLUS: 47 return "+"; 48 case OP_TILDE: 49 return "~"; 50 case OP_BANG: 51 return "!"; 52 } 53 return "Unknown(" + op + ")"; 54 } 55 56 public Field visit(MemVisitor visitor, Object obj) { 57 return visitor.visitUnaryOpNode(this, obj); 58 } 59 60 public Object arrive(NodeVisitor v, Object msg) { 61 return v.arriveUnaryOpNode(this, msg); 62 } 63 } 64 65 | Popular Tags |