Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Counter |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
3 | * The software in this package is published under the terms of the CPAL v1.0 | |
4 | * license, a copy of which has been included with this distribution in the | |
5 | * LICENSE.txt file. | |
6 | */ | |
7 | package org.mule.util.counters; | |
8 | ||
9 | /** | |
10 | * This interface is the interface implemented for all counter types. A Counter can | |
11 | * represent a real counter or a virtual counter that will be computed using one or | |
12 | * more other counters.<br/> | |
13 | * <h3>Real counters</h3> | |
14 | * are counters which represent real values. The user will call methods of such | |
15 | * counters to modify the associated value of the counter. | |
16 | * <h3>Computed counters</h3> | |
17 | * are computed using one or more associated counters. Such counters represent | |
18 | * operations computed on associated counters. Usually, these counters will never be | |
19 | * used directly, but will only used to retrieve the computed values. | |
20 | */ | |
21 | public interface Counter | |
22 | { | |
23 | ||
24 | /** | |
25 | * Accessor for the counter type. | |
26 | * | |
27 | * @return the type of the counter | |
28 | */ | |
29 | CounterFactory.Type getType(); | |
30 | ||
31 | /** | |
32 | * Accessor for the counter's name. | |
33 | * | |
34 | * @return the name of the counter | |
35 | */ | |
36 | String getName(); | |
37 | ||
38 | /** | |
39 | * Increment the counter's value by 1.0. | |
40 | * | |
41 | * @return the new value of the counter | |
42 | */ | |
43 | double increment(); | |
44 | ||
45 | /** | |
46 | * Increment the counter's value by the specified amount. | |
47 | * | |
48 | * @param value the amount to increment the counter by | |
49 | * @return the new value of the counter | |
50 | */ | |
51 | double incrementBy(double value); | |
52 | ||
53 | /** | |
54 | * Decrement the counter's value by 1.0. | |
55 | * | |
56 | * @return the new value of the counter | |
57 | */ | |
58 | double decrement(); | |
59 | ||
60 | /** | |
61 | * Set the counter's value to a new value. | |
62 | * | |
63 | * @param value the new value of the counter | |
64 | */ | |
65 | void setRawValue(double value); | |
66 | ||
67 | /** | |
68 | * Compute and return the value of the counter. | |
69 | * | |
70 | * @return the value of the counter | |
71 | */ | |
72 | double nextValue(); | |
73 | ||
74 | } |