1 29 package jegg.impl; 30 31 import jegg.Egg; 32 import jegg.EggContext; 33 import jegg.impl.EggContextImpl; 34 35 38 class MessageHandlerA1 implements Egg 39 { 40 private String _name ; 41 private EggContext _context; 42 43 47 public MessageHandlerA1(final String s) 48 { 49 _name = s; 50 } 51 52 public void init() {} 53 54 public void setContext(EggContext c) 55 { 56 _context = c; 57 } 58 59 60 private long _numMessages1 = 0; 61 65 public final long getNumMessages1() 66 { 67 return _numMessages1; 68 } 69 70 private long _numMessages2 = 0; 71 75 public final long getNumMessages2() 76 { 77 return _numMessages2; 78 } 79 80 81 private int _numMessages3; 82 83 87 public final long getNumMessages3() 88 { 89 return _numMessages3; 90 } 91 92 93 private long _sum = 0; 94 95 99 public final long getSum() 100 { 101 return _sum; 102 } 103 104 108 public final void handle(final Object m) 109 { 110 _numMessages1++; 111 _sum += 1; 112 } 113 117 public final void handle(final Long l) 118 { 119 _numMessages2++; 120 _sum += l.longValue(); 121 } 122 123 public final void handle(final Short s) 124 { 125 _numMessages3++; 126 _sum += s.intValue(); 127 } 128 } 129 | Popular Tags |