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

se.l4.vibe.probes.AbstractSampledProbe Maven / Gradle / Ivy

There is a newer version: 0.4.0
Show newest version
package se.l4.vibe.probes;

/**
 * Abstract implementation of {@link SampledProbe}. This class helps with the
 * implementation of {@link #read()} which always return the last value of
 * {@link #sample()}.
 * 
 * @author Andreas Holstenson
 *
 * @param 
 */
public abstract class AbstractSampledProbe
	implements SampledProbe
{
	protected T value;
	
	public AbstractSampledProbe()
	{
	}
	
	@Override
	public final T read()
	{
		return value;
	}

	@Override
	public T sample()
	{
		return (value = sample0());
	}
	
	/**
	 * Perform the real sampling.
	 * 
	 * @return
	 */
	protected abstract T sample0();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy