01: /*
02: * MCS Media Computer Software
03: * Copyright (c) 2005 by MCS
04: * --------------------------------------
05: * Created on 23.04.2005 by w.klaas
06: *
07: * Licensed under the Apache License, Version 2.0 (the "License");
08: * you may not use this file except in compliance with the License.
09: * You may obtain a copy of the License at
10: *
11: * http://www.apache.org/licenses/LICENSE-2.0
12: *
13: * Unless required by applicable law or agreed to in writing, software
14: * distributed under the License is distributed on an "AS IS" BASIS,
15: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16: * See the License for the specific language governing permissions and
17: * limitations under the License.
18: */
19: package de.mcs.jmeasurement.example;
20:
21: import de.mcs.jmeasurement.MeasureDataCallback;
22: import de.mcs.jmeasurement.MeasurePoint;
23: import de.mcs.jmeasurement.Monitor;
24:
25: /**
26: * This class simply add the measured data to the userdata of the measurePoint.
27: * The userdata object must be an instance of UserDataStore.
28: *
29: * @author w.klaas
30: */
31: public class DataPointStore implements MeasureDataCallback {
32:
33: /**
34: * @see de.mcs.jmeasurement.MeasureDataCallback#setMonitor(de.mcs.jmeasurement.MeasurePoint,
35: * de.mcs.jmeasurement.Monitor)
36: * @param point
37: * the measurepoint, where the data will be added.
38: * @param monitor
39: * the monitor with the data to be added.
40: */
41: public final void setMonitor(final MeasurePoint point,
42: final Monitor monitor) {
43: Object userData = point.getUserData();
44: if (null != userData) {
45: if (userData instanceof UserDataStore) {
46: UserDataStore dataStore = (UserDataStore) userData;
47: dataStore.addData(monitor.getAccrued());
48: }
49: }
50: }
51:
52: }
|