1
2
3
4
5
6
7 package org.mule.util.counters.impl;
8
9 import org.mule.util.counters.CounterFactory.Type;
10
11 public class Number extends AbstractCounter
12 {
13
14 private double value = 0.0;
15
16 public Number(String name)
17 {
18 super(name, Type.NUMBER);
19 }
20
21 public synchronized double increment()
22 {
23 this.value++;
24 propagate();
25 return this.value;
26 }
27
28 public synchronized double incrementBy(double value)
29 {
30 this.value += value;
31 propagate();
32 return this.value;
33 }
34
35 public synchronized double decrement()
36 {
37 this.value--;
38 propagate();
39 return this.value;
40 }
41
42 public synchronized void setRawValue(double value)
43 {
44 this.value = value;
45 propagate();
46 }
47
48 public synchronized double nextValue()
49 {
50 return this.value;
51 }
52
53 }