Klasse SimpleCounter
- Alle implementierten Schnittstellen:
net.simplace.sim.util.FWSimFieldContainer
Counting
Counter is incremented, if the input variable iDoCount is true.
Resetting the counter
If iReset is true, the counter is reset before an potential increment.
Customization
Increment and start value are customizable. Default increment is 1, start value is 0.
Cyclic counting
If cMin and cMax are set and cMax is bigger than cMin, then the counter counts cyclic (like a clock). The value of Counter will always be shifted between cMix and cMax (both inclusive).
If the Counter equals the (possibly shifted) cStartValue, a cycle is completed and the CycleNumber is incremented.
Examples
Example 1
For cStartValue=1, cIncrement=1, cMin=1, cMax=10 the counter will start with 1 and give following sequence:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, ...
Example 2 - Countdown
For cStartValue=3, cIncrement=-1, cMin=0, cMax=10 the counter will start with 1 and give following sequence:
3, 2, 1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 10, 9 ...
Example 2 - Clock
For cStartValue=18, cIncrement=5, cMin=1, cMax=12 the counter will start with 6 and give following sequence:
6, 11, 4, 9, 2, 7, 12, 5, 10, 3, 8, 1, 6, 11, 4, ...
(18 corresponds to 6 p.m., five hours later it will be 11 p.m, another five hours later 4 a.m. etc.)
- Autor:
- Gunther Krauss, gk@uni-bonn.de
Component Variables
| Content Type | Name | Description | Data Type | Unit | Min Value | Max Value | Default Value |
|---|---|---|---|---|---|---|---|
| constant | cIncrement | increment of counter | INT | - | - | 1 | |
| constant | cMax | maximal value of the counter of a cyclic counter | INT | - | - | - | |
| constant | cMin | minimal value of the counter of a cyclic counter | INT | - | - | - | |
| constant | cStartValue | start value of counter | INT | - | - | 0 | |
| input | iDoCount | counter is incremented if true | BOOLEAN | - | - | false | |
| input | iReset | resets the counter to its start value if true | BOOLEAN | - | - | false | |
| out | Counter | actual value of the counter | INT | - | - | 1 | |
| out | CycleNumber | number of cycles when counting between cMin and cMax | INT | - | - | 0 | |
| out | NumberOfResets | number of resets | INT | - | - | 0 | |
| out | TotalCount | total count starting from 0 and incremented by 1 | INT | - | - | 0 |
-
Verschachtelte Klassen - Übersicht
Von Klasse geerbte verschachtelte Klassen/Schnittstellen net.simplace.sim.model.FWSimComponent
net.simplace.sim.model.FWSimComponent.TEST_STATE -
Feldübersicht
Von Klasse geerbte Felder net.simplace.sim.model.FWSimComponent
iFieldMap, iFrequence, iInputMap, iJexlRule, iMasterComponentGroup, iName, iOrderNumber, isComponentGroup, iSimComponentElement, iSimModel, iVarMap -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected net.simplace.sim.model.FWSimComponentclone(net.simplace.sim.util.FWSimVarMap aVarMap) Create the FWSimVariables as interface for this SimComponentprotected IntegerfillTestVariables(int aParamIndex, net.simplace.sim.model.FWSimComponent.TEST_STATE aDefineOrCheck) called for single component test to check the components algorithm.protected voidinit()Initializes the fields by getting input and output FWSimVariables from VarMapprotected voidprocess()Process the algorithm and write the results back to VarMapVon Klasse geerbte Methoden net.simplace.sim.model.FWSimComponent
addVariable, bind, checkCondition, createSimComponent, createSimComponent, createSimComponent, createSimComponent, doProcess, getConstantVariables, getContentType, getCreateFormXML, getDescription, getEditFormXML, getFieldMap, getFrequence, getFrequenceRuleScript, getInputs, getInputVariables, getMasterComponentGroup, getName, getOrderNumber, getOutputVariables, getVariable, getVariableField, getVarMap, initialize, isConditionCheck, isVariableAvailable, performLinks, performLinks, readInputs, removeVariable, reset, runComponentTest, setVariablesDefault, toComponentLinkingXML, toDocXML, toGroupXML, toOutputDefinitionXML, toResourcesDataXML, toResourcesDefinitionXML, toString, toXML, writeVarInfos
-
Konstruktordetails
-
SimpleCounter
public SimpleCounter()Empty constructor used by class.forName()
-
-
Methodendetails
-
createVariables
Create the FWSimVariables as interface for this SimComponent- Angegeben von:
createVariablesin Schnittstellenet.simplace.sim.util.FWSimFieldContainer- Angegeben von:
createVariablesin Klassenet.simplace.sim.model.FWSimComponent- Siehe auch:
-
init
protected void init()Initializes the fields by getting input and output FWSimVariables from VarMap- Angegeben von:
initin Klassenet.simplace.sim.model.FWSimComponent- Siehe auch:
-
process
protected void process()Process the algorithm and write the results back to VarMap- Angegeben von:
processin Klassenet.simplace.sim.model.FWSimComponent- Siehe auch:
-
cyclic
-
fillTestVariables
public HashMap<String,net.simplace.sim.util.FWSimVariable<?>> fillTestVariables(int aParamIndex, net.simplace.sim.model.FWSimComponent.TEST_STATE aDefineOrCheck) called for single component test to check the components algorithm.- Angegeben von:
fillTestVariablesin Klassenet.simplace.sim.model.FWSimComponent- Siehe auch:
-
clone
protected net.simplace.sim.model.FWSimComponent clone(net.simplace.sim.util.FWSimVarMap aVarMap) - Angegeben von:
clonein Klassenet.simplace.sim.model.FWSimComponent- Siehe auch:
-