public abstract class SlidingWindow extends org.palladiosimulator.commons.designpatterns.AbstractObservable<ISlidingWindowListener>
SlidingWindowRecorder
.ISlidingWindowListener
s, e.g., certain
SlidingWindowAggregator
s.ISlidingWindowMoveOnStrategy
that
defines how the collected data (i.e., the measurements) is adjusted when the window moves
forward.KeepLastElementPriorToLowerBoundStrategy
,
SlidingWindowAggregator
,
SlidingWindowUtilizationAggregator
Constructor and Description |
---|
SlidingWindow(javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> windowLength,
javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> increment,
javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> initialLowerBound,
org.palladiosimulator.metricspec.MetricDescription acceptedMetrics,
ISlidingWindowMoveOnStrategy moveOnStrategy)
Initializes a new instance of the
SlidingWindow class with the given parameters. |
SlidingWindow(javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> windowLength,
javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> increment,
org.palladiosimulator.metricspec.MetricDescription acceptedMetrics,
ISlidingWindowMoveOnStrategy moveOnStrategy)
Initializes a new instance of the
SlidingWindow class with the given parameters. |
SlidingWindow(javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> windowLength,
org.palladiosimulator.metricspec.MetricDescription acceptedMetrics,
ISlidingWindowMoveOnStrategy moveOnStrategy)
Initializes a new instance of the
SlidingWindow class with the given parameters. |
Modifier and Type | Method and Description |
---|---|
void |
addMeasurement(org.palladiosimulator.measurementframework.MeasuringValue newMeasurement)
Adds a new measurement to the data this window collects.
|
void |
addObserver(ISlidingWindowListener arg0)
Attaches a
ISlidingWindowListener instance to this window.Most commonly, the given listener is a SlidingWindowAggregator . |
void |
flush()
Discards the data (i.e., the measurements) currently collected by this window.
|
org.palladiosimulator.metricspec.MetricDescription |
getAcceptedMetric()
Gets the metric this window accepts.
|
java.util.List<ISlidingWindowListener> |
getAttachedObservers()
Gets the currently attached observers.
|
javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> |
getCurrentLowerBound()
Gets the current lower (i.e., left) bound of the window.
|
javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> |
getCurrentUpperBound()
Gets the current upper bound of the window.
|
javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> |
getEffectiveWindowLength()
Gets the current, effective window length.
|
javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> |
getIncrement()
Gets the value this window's lower bound is incremented by once the window moves on.
|
int |
getNumberOfElements()
Gets the number of currently collected measurements.
|
boolean |
isEmpty()
Indicates if there are currently measurements available.
|
public SlidingWindow(javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> windowLength, org.palladiosimulator.metricspec.MetricDescription acceptedMetrics, ISlidingWindowMoveOnStrategy moveOnStrategy)
SlidingWindow
class with the given parameters.windowLength
- The length of the window, given in any arbitrary Duration
. Additionally,
this measure also denotes the window increment.acceptedMetrics
- As each window only accepts measurements that adhere to a certain metric, a
MetricDescription
of must be specified.moveOnStrategy
- The ISlidingWindowMoveOnStrategy
instance that defines how the collected
data (i.e., the measurements) is adjusted when the window moves forward.java.lang.IllegalArgumentException
- In one of the following cases:
acceptedMetrics
or moveOnStrategy
is null
SlidingWindow(Measure, Measure, MetricDescription,
ISlidingWindowMoveOnStrategy)
public SlidingWindow(javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> windowLength, javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> increment, org.palladiosimulator.metricspec.MetricDescription acceptedMetrics, ISlidingWindowMoveOnStrategy moveOnStrategy)
SlidingWindow
class with the given parameters.windowLength
- The length of the window, given in any arbitrary Duration
.increment
- This Measure
indicates the increment by what the window is moved on, given
in any arbitrary Duration
.acceptedMetrics
- As each window only accepts measurements that adhere to a certain metric, a
MetricDescription
of must be specified.moveOnStrategy
- The ISlidingWindowMoveOnStrategy
instance that defines how the collected
data (i.e., the measurements) is adjusted when the window moves forward.java.lang.IllegalArgumentException
- In one of the following cases:
acceptedMetrics
or moveOnStrategy
is null
public SlidingWindow(javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> windowLength, javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> increment, javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> initialLowerBound, org.palladiosimulator.metricspec.MetricDescription acceptedMetrics, ISlidingWindowMoveOnStrategy moveOnStrategy)
SlidingWindow
class with the given parameters.windowLength
- The length of the window, given in any arbitrary Duration
.increment
- This Measure
indicates the increment by what the window is moved on, given
in any arbitrary Duration
.initialLowerBound
- This Measure
indicates the lower bound value at which the algorithm starts
aggregating, given in any arbitrary Duration
.acceptedMetrics
- As each window only accepts measurements that adhere to a certain metric, a
MetricDescription
of must be specified.moveOnStrategy
- The ISlidingWindowMoveOnStrategy
instance that defines how the collected
data (i.e., the measurements) is adjusted when the window moves forward.java.lang.IllegalArgumentException
- In one of the following cases:
acceptedMetrics
or moveOnStrategy
is null
public void addMeasurement(org.palladiosimulator.measurementframework.MeasuringValue newMeasurement)
newMeasurement
- The MeasuringValue
instance to add.java.lang.IllegalArgumentException
- If the given measurement is null
or does not adhere to the metric this
window accepts.public final void flush()
public final org.palladiosimulator.metricspec.MetricDescription getAcceptedMetric()
MetricDescription
denoting the metric this window accepts.SlidingWindow#addMeasurement(Measurement)
public final javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> getCurrentLowerBound()
Measure
denoting the current upper bound.getEffectiveWindowLength()
,
getCurrentUpperBound()
public javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> getCurrentUpperBound()
Measure
denoting the current upper bound.SimulationGovernedSlidingWindow#getEffectiveWindowLength()
public javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> getEffectiveWindowLength()
SlidingWindow(Measure, MetricDescription, ISlidingWindowMoveOnStrategy)
or
SlidingWindow(Measure, Measure, MetricDescription, ISlidingWindowMoveOnStrategy)
.Measure
denoting the instantaneous effective window length.getCurrentUpperBound()
public final javax.measure.Measure<java.lang.Double,javax.measure.quantity.Duration> getIncrement()
Measure
denoting the window increment.SlidingWindow(Measure, MetricDescription, ISlidingWindowMoveOnStrategy)
,
SlidingWindow(Measure, Measure, MetricDescription,
ISlidingWindowMoveOnStrategy)
public final boolean isEmpty()
false
, if yes, otherwise true
public final int getNumberOfElements()
public final void addObserver(ISlidingWindowListener arg0)
ISlidingWindowListener
instance to this window.SlidingWindowAggregator
.addObserver
in interface org.palladiosimulator.commons.designpatterns.IAbstractObservable<ISlidingWindowListener>
addObserver
in class org.palladiosimulator.commons.designpatterns.AbstractObservable<ISlidingWindowListener>
arg0
- The listener to attach.java.lang.IllegalArgumentException
- If the given listener is null
or expects a metric other than this
window's accepted one.ISlidingWindowListener.getExpectedWindowDataMetric()
public final java.util.List<ISlidingWindowListener> getAttachedObservers()
ISlidingWindowListener
s.