Package jsl.modeling.elements.variable
Class AggregateCounter
- java.lang.Object
-
- jsl.simulation.ModelElement
-
- jsl.modeling.elements.variable.Aggregatable
-
- jsl.modeling.elements.variable.Aggregate
-
- jsl.modeling.elements.variable.AggregateCounter
-
- All Implemented Interfaces:
CounterActionIfc,DefaultReportingOptionIfc,ObservableIfc,GetNameIfc,GetValueIfc,IdentityIfc,PreviousValueIfc
public class AggregateCounter extends Aggregate implements CounterActionIfc
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jsl.simulation.ModelElement
ModelElement.EventBuilderIfc<T>, ModelElement.EventScheduler<T>, ModelElement.ModelElementComparator, ModelElement.RequestBuilder, ModelElement.RequestDurationIfc, ModelElement.RequestTimeIfc, ModelElement.RequestUsingIfc, ModelElement.TimedUpdateEventAction, ModelElement.TimeUnitIfc<T>, ModelElement.WarmUpEventAction
-
-
Field Summary
Fields Modifier and Type Field Description protected CountermyAggCounterThis is used to remember the aggregate value when any of its aggregatable's change-
Fields inherited from class jsl.modeling.elements.variable.Aggregate
myNumInitialized, myNumWarmedUp, myVariables
-
Fields inherited from class jsl.modeling.elements.variable.Aggregatable
myAggregates
-
Fields inherited from class jsl.simulation.ModelElement
AFTER_EXPERIMENT, AFTER_REPLICATION, BEFORE_EXPERIMENT, BEFORE_REPLICATION, CONDITIONAL_ACTION_REGISTRATION, DEFAULT_TIMED_EVENT_PRIORITY, INITIALIZED, MONTE_CARLO, myAfterExperimentOption, myAfterReplicationOption, myBeforeExperimentOption, myBeforeReplicationOption, myInitializationOption, myLengthOfWarmUp, myModelElements, myMonteCarloOption, myObservableComponent, myReplicationEndedOption, myTimedUpdateActionListener, myTimedUpdateEvent, myTimedUpdateInterval, myTimedUpdateOption, myTimedUpdatePriority, myWarmUpActionListener, myWarmUpEvent, myWarmUpIndicator, myWarmUpOption, myWarmUpPriority, NONE, REMOVED_FROM_MODEL, REPLICATION_ENDED, TIME_UNIT_DAY, TIME_UNIT_HOUR, TIME_UNIT_MILLISECOND, TIME_UNIT_MINUTE, TIME_UNIT_SECOND, TIME_UNIT_WEEK, TIMED_UPDATE, UPDATE, WARMUP
-
-
Constructor Summary
Constructors Constructor Description AggregateCounter(ModelElement parent)AggregateCounter(ModelElement parent, java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddCounterActionListener(CounterActionListenerIfc action)Adds a counter action listener.voidaddStoppingAction()Tells the Counter to add an CounterActionIfc that will automatically stop the replication when the counter limit is reached.booleancheckForCounterLimitReachedState()Returns true if the counter's last observer state is equal to COUNTER_LIMIT_REACHEDStatisticAccessorIfcgetAcrossReplicationStatistic()doublegetCounterActionLimit()booleangetDefaultReportingOption()Returns the default reporting option.doublegetPreviousValue()Gets the previous number from the sequence of valuesdoublegetValue()This method simply returns the value.protected voidinitializeAggregate()Sub-classes must implement this method to properly initialize the aggregate after all its variables have been initializedbooleanremoveCounterActionListener(CounterActionListenerIfc action)Removes the counter action listenerprotected voidremovedFromModel()This method should be overridden by subclasses that need actions performed when a model element is removed from a model after the replication has started.voidsetDefaultReportingOption(boolean flag)Sets the default reporting option.protected voidvalueChangedBeforeReplication(Aggregatable variable)Sub-classes must implement this method to properly react to a change in the variable with respect to its form of aggregationprotected voidvalueChangedDuringReplication(Aggregatable variable)Sub-classes must implement this method to properly react to a change in the variable with respect to its form of aggregationprotected voidvariableAddedBeforeReplication(Aggregatable variable)Sub-classes must implement this method to properly react to the subscription of a new variable to the aggregate.protected voidvariableAddedDuringReplication(Aggregatable variable)Sub-classes must implement this method to properly react to the subscription of a new variable to the aggregate.protected voidvariableRemovedBeforeReplication(Aggregatable variable)Sub-classes must implement this method to properly react to the removal of a variable from the aggregate.protected voidvariableRemovedDuringReplication(Aggregatable variable)Sub-classes must implement this method to properly react to the removal of a variable from the aggregate.protected voidwarmUpAggregate()Sub-classes must implement this method to properly warm up the aggregate after all its variables have been warmed up-
Methods inherited from class jsl.modeling.elements.variable.Aggregate
afterReplication, avgValues, beforeExperiment, countNumToInitialize, countNumToWarmUp, initialized, removedFromModel, subscribeTo, sumValues, unsubscribeFrom, warmedUp
-
Methods inherited from class jsl.modeling.elements.variable.Aggregatable
attachAggregate, detachAggregate, initialize_, notifyAggregatesOfInitialization, notifyAggregatesOfModelRemoval, notifyAggregatesOfValueChange, notifyAggregatesOfWarmUp, warmUp_
-
Methods inherited from class jsl.simulation.ModelElement
addObserver, addObserverToModelElements, afterExperiment, afterExperiment_, afterReplication_, asString, beforeExperiment_, beforeReplication, beforeReplication_, buildEventGenerator, cancelTimedUpdateEvent, cancelWarmUpEvent, changeParentModelElement, checkForAfterExperiment, checkForAfterReplication, checkForBeforeExperiment, checkForBeforeReplication, checkForConditionalActionRegistration, checkForInitialize, checkForMonteCarlo, checkForRemoveFromModel, checkForReplicationEnded, checkForTimedUpdate, checkForUpdate, checkForWarmUp, checkObserverState, checkWarmUpOption, clearModelElementObservers, contains, countObservers, createEntity, createEntity, createQObject, day, deleteObserver, deleteObserverFromModelElements, deleteObservers, findModelElementWithWarmUpEvent, getAfterExperimentOption, getAfterReplicationOption, getAllCounters, getAllModelElements, getAllRandomElements, getAllResponseVariables, getAllVariables, getBeforeExperimentOption, getBeforeReplicationOption, getChildModelElementIterator, getCurrentReplicationNumber, getDefaultEntityType, getExecutive, getExperiment, getId, getInitializationOption, getInitializationOrderAsString, getLeftPreOrderTraversalCount, getLengthOfWarmUp, getModel, getModelElementCompartor, getModelElementsAsString, getModelElementsAsString, getModelElementsAsString, getMonteCarloOption, getName, getNumberOfModelElements, getObserverState, getParentModelElement, getPreviousObserverState, getReplicationEndedOption, getRightPreOrderTraversalCount, getSimulation, getSpatialModel, getStringLabel, getThisElementsCounters, getThisElementsModelElements, getThisElementsRandomVariables, getThisElementsResponseVariables, getThisElementsVariables, getTime, getTimedUpdateInterval, getTimedUpdateOption, getUpdateNotificationFlag, getVariable, getWarmUpEventTime, getWarmUpOption, hour, indent, initialize, isTimedUpdateEventScheduled, isWarmedUp, isWarmUpEventScheduled, isWarmUpScheduled, millisecond, minute, montecarlo, montecarlo_, notifyAfterExperimentObservers, notifyAfterReplicationObservers, notifyBeforeExperimentObservers, notifyBeforeReplicationObservers, notifyConditionalActionRegistrationObservers, notifyInitializationObservers, notifyMonteCarloObservers, notifyObservers, notifyObservers, notifyRemovingFromModelObservers, notifyReplicationEndedObservers, notifyTimedUpdateObservers, notifyUpdateObservers, notifyWarmUpObservers, registerConditionalActions, registerConditionalActions_, removeFromModel, replicationEnded, replicationEnded_, schedule, second, seize, setAfterExperimentOption, setAfterExperimentOptionForModelElements, setAfterReplicationOption, setAfterReplicationOptionForModelElements, setBeforeExperimentOption, setBeforeExperimentOptionForModelElements, setBeforeReplicationOption, setBeforeReplicationOptionForModelElements, setInitializationOption, setInitializationOptionForModelElements, setLengthOfWarmUp, setModel, setMonteCarloOption, setMonteCarloOptionForModelElements, setName, setObserverState, setParentModelElement, setReplicationEndedOption, setReplicationEndedOptionForModelElements, setSpatialModel, setStringLabel, setTimedUpdateInterval, setTimedUpdateOption, setTimedUpdateOptionForModelElements, setUpdateNotificationFlag, setWarmUpOption, setWarmUpOptionForModelElements, stopExecutive, stopExecutive, timedUpdate, timedUpdate_, toString, update, useControls, warmUp, week
-
-
-
-
Field Detail
-
myAggCounter
protected Counter myAggCounter
This is used to remember the aggregate value when any of its aggregatable's change
-
-
Constructor Detail
-
AggregateCounter
public AggregateCounter(ModelElement parent)
- Parameters:
parent-
-
AggregateCounter
public AggregateCounter(ModelElement parent, java.lang.String name)
- Parameters:
parent-name-
-
-
Method Detail
-
getDefaultReportingOption
public boolean getDefaultReportingOption()
Description copied from interface:DefaultReportingOptionIfcReturns the default reporting option. True means that the response should appear on the default reports- Specified by:
getDefaultReportingOptionin interfaceDefaultReportingOptionIfc- Returns:
-
setDefaultReportingOption
public void setDefaultReportingOption(boolean flag)
Description copied from interface:DefaultReportingOptionIfcSets the default reporting option. True means the response will appear on default reports- Specified by:
setDefaultReportingOptionin interfaceDefaultReportingOptionIfc
-
getPreviousValue
public double getPreviousValue()
Description copied from interface:PreviousValueIfcGets the previous number from the sequence of values- Specified by:
getPreviousValuein interfacePreviousValueIfc- Returns:
- a double representing the last value in the sequence
-
getValue
public double getValue()
Description copied from interface:GetValueIfcThis method simply returns the value.- Specified by:
getValuein interfaceGetValueIfc- Returns:
- The value.
-
valueChangedBeforeReplication
protected void valueChangedBeforeReplication(Aggregatable variable)
Description copied from class:AggregateSub-classes must implement this method to properly react to a change in the variable with respect to its form of aggregation- Specified by:
valueChangedBeforeReplicationin classAggregate- Parameters:
variable- The variable that has just changed
-
variableAddedBeforeReplication
protected void variableAddedBeforeReplication(Aggregatable variable)
Description copied from class:AggregateSub-classes must implement this method to properly react to the subscription of a new variable to the aggregate. Note that the variable is already in the aggregate's list of variables when this method is invoked- Specified by:
variableAddedBeforeReplicationin classAggregate- Parameters:
variable- The variable that has been added to the aggregate
-
variableRemovedBeforeReplication
protected void variableRemovedBeforeReplication(Aggregatable variable)
Description copied from class:AggregateSub-classes must implement this method to properly react to the removal of a variable from the aggregate. Note that the variable is no longer in the aggregate's list of variables when this method is invoked- Specified by:
variableRemovedBeforeReplicationin classAggregate- Parameters:
variable- The variable that has been removed from the aggregate
-
addCounterActionListener
public boolean addCounterActionListener(CounterActionListenerIfc action)
Description copied from interface:CounterActionIfcAdds a counter action listener. It will be called if the counter's limit is set and it is reached.- Specified by:
addCounterActionListenerin interfaceCounterActionIfc- Returns:
-
addStoppingAction
public void addStoppingAction()
Description copied from interface:CounterActionIfcTells the Counter to add an CounterActionIfc that will automatically stop the replication when the counter limit is reached.- Specified by:
addStoppingActionin interfaceCounterActionIfc
-
checkForCounterLimitReachedState
public boolean checkForCounterLimitReachedState()
Description copied from interface:CounterActionIfcReturns true if the counter's last observer state is equal to COUNTER_LIMIT_REACHED- Specified by:
checkForCounterLimitReachedStatein interfaceCounterActionIfc- Returns:
-
getCounterActionLimit
public double getCounterActionLimit()
- Specified by:
getCounterActionLimitin interfaceCounterActionIfc- Returns:
- Returns the counter's limit.
-
removeCounterActionListener
public boolean removeCounterActionListener(CounterActionListenerIfc action)
Description copied from interface:CounterActionIfcRemoves the counter action listener- Specified by:
removeCounterActionListenerin interfaceCounterActionIfc- Returns:
-
getAcrossReplicationStatistic
public StatisticAccessorIfc getAcrossReplicationStatistic()
- Returns:
- a statistical accessor for across replication statistics
- See Also:
AcrossReplicationStatisticIfc.getAcrossReplicationStatistic()
-
valueChangedDuringReplication
protected void valueChangedDuringReplication(Aggregatable variable)
Description copied from class:AggregateSub-classes must implement this method to properly react to a change in the variable with respect to its form of aggregation- Specified by:
valueChangedDuringReplicationin classAggregate- Parameters:
variable- The variable that has just changed
-
variableAddedDuringReplication
protected void variableAddedDuringReplication(Aggregatable variable)
Description copied from class:AggregateSub-classes must implement this method to properly react to the subscription of a new variable to the aggregate. Note that the variable is already in the aggregate's list of variables when this method is invoked- Specified by:
variableAddedDuringReplicationin classAggregate- Parameters:
variable- The variable that has been added to the aggregate
-
variableRemovedDuringReplication
protected void variableRemovedDuringReplication(Aggregatable variable)
Description copied from class:AggregateSub-classes must implement this method to properly react to the removal of a variable from the aggregate. Note that the variable is no longer in the aggregate's list of variables when this method is invoked- Specified by:
variableRemovedDuringReplicationin classAggregate- Parameters:
variable- The variable that has been removed from the aggregate
-
initializeAggregate
protected void initializeAggregate()
Description copied from class:AggregateSub-classes must implement this method to properly initialize the aggregate after all its variables have been initialized- Specified by:
initializeAggregatein classAggregate
-
warmUpAggregate
protected void warmUpAggregate()
Description copied from class:AggregateSub-classes must implement this method to properly warm up the aggregate after all its variables have been warmed up- Specified by:
warmUpAggregatein classAggregate
-
removedFromModel
protected void removedFromModel()
Description copied from class:AggregatableThis method should be overridden by subclasses that need actions performed when a model element is removed from a model after the replication has started.- Overrides:
removedFromModelin classAggregatable
-
-