All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.mcs.jmeasurement.example.DataPointStore Maven / Gradle / Ivy

There is a newer version: 1.1.226
Show newest version
/*
 * 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());
      }
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy