public class OdgMdlStates
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private static class |
OdgMdlStates.ProcessStateTransCreateAndConnect
This is a helper class for data during
processStateTransCreateAndConnect(OdgGBlock) |
| Modifier and Type | Field and Description |
|---|---|
CreateModuleStateM_FBcl |
crStm |
(package private) OdgModule |
gMdl |
java.util.Map<java.lang.Integer,OdgGState> |
idxGState
Index of all graphic GBlocks which presents
FBlock_FBcl or FBtype_FBcl,
sorted by graphic position or posNr do get reproducible output. |
java.util.TreeMap<java.lang.String,OdgGState> |
idxGStateByName
Index of all graphic FBlocks sorted by the name designation in graphic
|
java.util.Map<java.lang.Integer,OdgGBlock> |
idxGStateTransCond
Index of all graphic FBlocks sorted by graphic position or posNr do get reproducible output
|
java.util.Map<java.lang.String,OdgGBlock> |
idxGStateTransCondByName
Index of all graphic FBlocks sorted by name only used to ensure unique names
|
Write_Module_FBwr |
mdlw
The real module.
|
(package private) Prj_FBcl |
prj
The project used for the translation session.
|
| Constructor and Description |
|---|
OdgMdlStates(OdgModule gMdl) |
| Modifier and Type | Method and Description |
|---|---|
private void |
checkCreateStateDirectConn(OdgGState gState) |
private void |
completeParentWithDefaultTrans()
Completes the
OdgGBlock.sName of all states from idxGState with the name
of the parent state due to an incoming OdgConnection.ECkind.stateTransDefault connection. |
private void |
createExprFromText(OdgGBlock gExpr,
java.lang.String text,
java.lang.String sDefaultOperator)
This is (TODO should be ) a common possibility to create
DinExpr_FBcl due to the given expression. |
private void |
createFBclState(OdgGState gState) |
private OdgGBlock |
createStateTrans(OdgGBlock stateSrc,
OdgGBlock stateDst,
java.lang.String text,
OdgConnection gConOrig) |
private void |
createTextualConnectionsInStateTrans(OdgGBlock trans,
java.lang.String text) |
private java.util.List<OdgGState> |
detectStatesConnectedViaStateTransInSameLevel(OdgGState gStateSrc)
Builds a List of all immediately reached states by
OdgConnection.ECkind.stateTrans
either as direct connection or as connection over one Transition. |
private void |
joinStateSameLevel()
This operation checks all
OdgGState in idxGState and follows
the transition of kind OdgConnection.ECkind.stateTrans. |
(package private) void |
prepareStates()
Prepare all states:
_A_: First the situation of enclosing and parent states is clarified.
|
private void |
processStateConnections(OdgGBlock gState)
This seems to be the older contribution, todo cleanup. care about 'gcon.kind() ... case eventflow:'
|
private void |
processStateTransCreateAndConnect(OdgGBlock gStateTrans)
Processes the raw given StateTrans GBlock from graphic.
|
private void |
replaceNameFreeStates()
Some States are only drawn because access to outputs.
|
private int |
searchParentNamePos(java.lang.String sName)
Searches the first occurrence of "-" or "||" in sName
|
private int |
searchParticularNameEnd(java.lang.String sName)
Searches the first occurrence of "-" or "||" in sName
|
private void |
setStateFBclSameLevel(OdgGState gState)
Sets the information of states of same level in the FBcl state.
|
private void |
setStateParentAndChildren(CreateFBstate_FBcl wState) |
private void |
setUniqueParentInSameStatelevel(java.util.Map<OdgGState,OdgGState> statesSameLevel,
int idSamelevel)
Sets the same properties of all states of the same nested and parallel level.
|
private void |
supplementEnclosingStates(OdgGBlock gState,
java.util.TreeMap<java.lang.String,java.lang.String> idxStateAndParent) |
private void |
toso() |
public final java.util.Map<java.lang.Integer,OdgGState> idxGState
FBlock_FBcl or FBtype_FBcl,
sorted by graphic position or posNr do get reproducible output.
The GBlocks are also contained in #idxAllGBlockByGpos for complete report.public final java.util.TreeMap<java.lang.String,OdgGState> idxGStateByName
public final java.util.Map<java.lang.Integer,OdgGBlock> idxGStateTransCond
public final java.util.Map<java.lang.String,OdgGBlock> idxGStateTransCondByName
final OdgModule gMdl
final Prj_FBcl prj
public final Write_Module_FBwr mdlw
public final CreateModuleStateM_FBcl crStm
OdgMdlStates(OdgModule gMdl)
void prepareStates()
completeParentWithDefaultTrans(), supplementEnclosingStates(OdgGBlock, TreeMap),
joinStateSameLevel().
OdgGBlock.sName of the states is replaced, '||' and '-' replaced by '_' to ensure, it is an identifier.
Write_FBlock_FBwr for all states, register in OdgGBlock.fbw and store it in
Write_Module_FBwr#idxStateOFB.
This is done calling Write_Module_FBwr#getCreateState(String, String, org.vishia.fbcl.fblock.XY_FBcl, String).
Now the states are known in the FBcl oriented Module.
Write_Module_FBwr#idxStateOFB #setStateParentAndChildren(Write_FBlock_FBwr)
private void completeParentWithDefaultTrans()
OdgGBlock.sName of all states from idxGState with the name
of the parent state due to an incoming OdgConnection.ECkind.stateTransDefault connection.
This is one of the graphical alternative instead assembly the state in its enclosing parent state.
private void supplementEnclosingStates(OdgGBlock gState, java.util.TreeMap<java.lang.String,java.lang.String> idxStateAndParent)
private void joinStateSameLevel()
OdgGState in idxGState and follows
the transition of kind OdgConnection.ECkind.stateTrans.
This transitions should connect only states of the same nested or parallel level.
OdgConnection.ECkind.stateTrans check
is created by detectStatesConnectedViaStateTransInSameLevel(OdgGState). Here internally it is the variable 'statesDst'.
HashMap 'statesProcessed' is used to ensure that each state is processed only once.
This is because the same state will be found also in 'stateDst'.
idxGState is found to process (not stored already in HashMap 'statesProcessed'),
then is assumes, it is a not processed level.
HashMap 'statesSameLevel' is created to gather all states of the same level,
this 'gState' is the first member.
detectStatesConnectedViaStateTransInSameLevel(OdgGState).
They are then stored in 'statesSameLevel', as well as all states in the given graphical enclosing state.
Note that states of the same level connected with OdgConnection.ECkind.stateTrans can be arranged in different enclosing states.
HashMap 'statesProcessed'.
The first found not processed state from this 'statesSameLevel' is now processed furthermore in this loop.
HashMap 'statesProcessed').
HashMap 'statesSameLevel'. This HashMap is copied to a simple LinkedList 'listStatesSameLevel'.
This is done in the operation setUniqueParentInSameStatelevel(Map, int).
It stores this list in OdgGState.listStatesSameLevel.
createFBclState(OdgGState)
this information is then stored last in State_FBcl.listStateSameLevel for the whole graphic (all pages).
OdgGBlock.sName are completed possible till the root parent,
OdgGState.listStatesSameLevel is set with the same list in all states from the same level.
OdgGState.idSameLevel is set.
Din_FBcl pin is set with the same value.
private java.util.List<OdgGState> detectStatesConnectedViaStateTransInSameLevel(OdgGState gStateSrc)
OdgConnection.ECkind.stateTrans
either as direct connection or as connection over one Transition.gStateSrc - private void setUniqueParentInSameStatelevel(java.util.Map<OdgGState,OdgGState> statesSameLevel, int idSamelevel)
joinStateSameLevel().
statesSameLevel - Map contains all states.private void replaceNameFreeStates()
idxGState all top states are extracted, stored internally in 'idxNameTopStates'.
This is often exact one top state, but sometimes more as one if the module has more as one independent state machine.
If a top state does not exist, "StM" is set as name of the top state, and 'bNoTopState' = true.
idxGState all states are examined whether they ends with "-<&TopState>" whereby <&TopState> is one of the given top states.
NavigableMap 'idxNames'.
NavigableMap.ceilingKey(Object) with its OdgGBlock.sName as key.
They should be found by the first hit, because anywhere other the same state should be existing in the graphic with this name,
which has the information about the parents and the root, and starts with the same name.
This name is taken.
NavigableMap with allprivate void checkCreateStateDirectConn(OdgGState gState)
private OdgGBlock createStateTrans(OdgGBlock stateSrc, OdgGBlock stateDst, java.lang.String text, OdgConnection gConOrig)
private void createFBclState(OdgGState gState)
private void setStateFBclSameLevel(OdgGState gState)
wState - private void setStateParentAndChildren(CreateFBstate_FBcl wState)
private void processStateTransCreateAndConnect(OdgGBlock gStateTrans)
#checkCreateStateDirectConn(OdgGBlock) called before.
#processFBlockPinGraphicConnectionTextual(OdgGPin)
OdgGBlock.fbPinSrc and OdgGBlock.fbPinDst
for the given state transition OdgGBlock with its pins OdgGBlock.idxPin from graphic
and builds the real necessary either OdgGPin and OdgConnection for further standard processing to FBcl-data
or builds immediately the FBcl level pins and connections, though it is before
execution of OdgModule.createFBPins_duetoGBlockPins() and OdgModule.createFBclConnectionsFromGraphic().
OdgNameTypeArray.descr are processed.
That are events and conditions for the transition from other GBlocks.
it is done on Odg level (not for FBcl blocks) because the appropriate FBcl level blocks and pins may not existing till now.
let's create and wire later for FBcl level.
StateTransCond (derived from FBexpr_FBcl and the appropriated Write_FBlock_FBwr for it
is created. Note that creation of the necessary Write_FBlock_FBwr instances is also done for other OdgGBlock.
The reference to it is stored in 'gStateTrans': OdgGBlock.fbw, and also the type in OdgGBlock.fbt.
The type for the 'gStateTrans' is StdLibFBlocks_FBcl.fbtStateTrans_OFB or 'ExprEv_OFB',
which has the necessary 'true' output in the type.
OdgGBlock.fbPinSrc. It checks all connections:
OdgConnection.ECkind.stateTrans or 'stateTransChg' or also 'stateTransDefault',
then it is a graphic connection to the destination state.
It means OdgConnection.piDst and its OdgGPin.fbg as 'gStateDst' should be instance of OdgGState.
Then the appropriate CreateFBstate_FBcl 'crStateDst' is gotten from its OdgGBlock.fbw.
FBexpr_FBcl is completed left side with the stateDst name.
createTextualConnectionsInStateTrans(OdgGBlock, String) is called.
The transition can especially have an event to switch the state also on the outgoing connection.
This is often sensible for Join-transitions as information for the whole transition.
The event should be recognize before the following step:
OdgConnection.ECkind.eventflow, then an event flow is drawn
from the transition to any evin pin. This is the transition event operation.
Then the event flow is changed from the fbPinSrc pin to the true event pin.
OdgGBlock.fbPinDst. It checks all connections:
OdgConnection.ECkind.stateTrans or 'stateTransChg' or also 'stateTransDefault'
have the OdgGBlock 'gStateSrc' as source, it is the only one or more source states for the transition.
OdgGBlock.fbw.
#searchCrStateParent(CreateFBstate_FBcl, List) the parent state
CreateFBstate_FBcl 'crStateDst' this evin 'set' in is
Write_Module_FBwr.idxAllFBlock and Write_Module_FBwr.idxFBexpr
Module_FBcl.idxFBlock
gStateTrans - private void processStateConnections(OdgGBlock gState)
gState - private void toso()
private void createTextualConnectionsInStateTrans(OdgGBlock trans, java.lang.String text)
private void createExprFromText(OdgGBlock gExpr, java.lang.String text, java.lang.String sDefaultOperator)
DinExpr_FBcl due to the given expression.text - private int searchParticularNameEnd(java.lang.String sName)
sName - private int searchParentNamePos(java.lang.String sName)
sName -