Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5827 amar.kumar 1
/*
2
 *	Copyright 2005 stat4j.org
3
 *
4
 *   Licensed under the Apache License, Version 2.0 (the "License");
5
 *   you may not use this file except in compliance with the License.
6
 *	You may obtain a copy of the License at
7
 *
8
 *       http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 *   Unless required by applicable law or agreed to in writing, software
11
 *   distributed under the License is distributed on an "AS IS" BASIS,
12
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *   See the License for the specific language governing permissions and
14
 *   limitations under the License.
15
 */
16
package net.sourceforge.stat4j.calculators;
17
 
18
import net.sourceforge.stat4j.Calculator;
19
import net.sourceforge.stat4j.Statistic;
20
 
21
/**
22
 * Name:		CalculatorAdapter.java
23
 * Date:		Aug 30, 2004
24
 * Description:
25
 * 
26
 * 
27
 * @author Lara D'Abreo
28
 */
29
public abstract class CalculatorAdapter implements Calculator {
30
 
31
	protected Statistic statistic;
32
	protected String name;
33
	protected boolean applyImmediate;
34
	protected boolean applyImmediatePreset;
35
	protected long timestamp;
36
 
37
 
38
 
39
	public CalculatorAdapter() {
40
		applyImmediatePreset = false;
41
	}
42
 
43
 
44
	public String getName() {
45
		return name;
46
	}
47
 
48
	public void init(String name) {
49
		this.name = name;
50
	}
51
 
52
 
53
 
54
	/**
55
	 * @return
56
	 */
57
	public Statistic getStatistic() {
58
		return statistic;
59
	}
60
 
61
	/**
62
	 * @param statistic
63
	 */
64
	public void setStatistic(Statistic statistic) {
65
		this.statistic = statistic;
66
		if (!isApplyImmediatePreset()) {
67
			setApplyImmediate(!statistic.isDual());
68
		}
69
	}
70
 
71
	/**
72
	 * @return
73
	 */
74
	public long getTimestamp() {
75
		return timestamp;
76
	}
77
 
78
	/**
79
	 * @param l
80
	 */
81
	public void setTimestamp(long l) {
82
		timestamp = l;
83
	}
84
 
85
 
86
 
87
	/**
88
	 * @return
89
	 */
90
	public boolean isApplyImmediate() {
91
		return applyImmediate;
92
	}
93
 
94
	/**
95
	 * @param b
96
	 */
97
	public void setApplyImmediate(boolean b) {
98
		applyImmediate = b;
99
	}
100
 
101
	/**
102
	 * @return
103
	 */
104
	public boolean isApplyImmediatePreset() {
105
		return applyImmediatePreset;
106
	}
107
 
108
	/**
109
	 * @param b
110
	 */
111
	public void setApplyImmediatePreset(boolean b) {
112
		applyImmediatePreset = b;
113
	}
114
 
115
}