1 2 package SOFA.SOFAnode.Made.CDL; 3 4 class UnaryOperator { 5 public int kind; 6 7 public UnaryOperator(int op) { 8 kind = op; 9 } 10 11 12 public boolean isCompatible(CompExprOper e) { 13 switch (kind) { 14 case CompExprKind.e_unplus: 15 if ((e.type()==CompExprKind.e_int) || 16 (e.type()==CompExprKind.e_float) || 17 (e.type()==CompExprKind.e_fixed) || 18 (e.type()==CompExprKind.e_all)) 19 return true; 20 else 21 return false; 22 case CompExprKind.e_unminus: 23 if ((e.type()==CompExprKind.e_int) || 24 (e.type()==CompExprKind.e_float) || 25 (e.type()==CompExprKind.e_fixed) || 26 (e.type()==CompExprKind.e_all)) 27 return true; 28 else 29 return false; 30 case CompExprKind.e_untilde: 31 if ((e.type()==CompExprKind.e_int)|| 32 (e.type()==CompExprKind.e_all)) 33 return true; 34 default: return false; 35 } 36 } 37 } 38 | Popular Tags |