de.mcs.jmeasurement.example.DataPointStore Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of JMeasurement Show documentation
Show all versions of JMeasurement Show documentation
JMeasurement profiling programs in production enviroment
/*
* MCS Media Computer Software
* Copyright (c) 2005 by MCS
* --------------------------------------
* Created on 23.04.2005 by w.klaas
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.mcs.jmeasurement.example;
import de.mcs.jmeasurement.MeasureDataCallback;
import de.mcs.jmeasurement.MeasurePoint;
import de.mcs.jmeasurement.Monitor;
/**
* This class simply add the measured data to the userdata of the measurePoint.
* The userdata object must be an instance of UserDataStore.
*
* @author w.klaas
*/
public class DataPointStore implements MeasureDataCallback {
/**
* @see de.mcs.jmeasurement.MeasureDataCallback#setMonitor(de.mcs.jmeasurement.MeasurePoint,
* de.mcs.jmeasurement.Monitor)
* @param point
* the measurepoint, where the data will be added.
* @param monitor
* the monitor with the data to be added.
*/
public final void setMonitor(final MeasurePoint point, final Monitor monitor) {
Object userData = point.getUserData();
if (null != userData) {
if (userData instanceof UserDataStore) {
UserDataStore dataStore = (UserDataStore) userData;
dataStore.addData(monitor.getAccrued());
}
}
}
}