From 55b39689100ae69e0a84adf9f79c2c82ce2d2d0b Mon Sep 17 00:00:00 2001 From: nimec01 <24428341+nimec01@users.noreply.github.com> Date: Mon, 23 Dec 2024 17:01:59 +0100 Subject: [PATCH 1/2] add option to prevent transitions where start and target are equal --- src/Modelling/StateDiagram/Config.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Modelling/StateDiagram/Config.hs b/src/Modelling/StateDiagram/Config.hs index 90bd685..9044e67 100644 --- a/src/Modelling/StateDiagram/Config.hs +++ b/src/Modelling/StateDiagram/Config.hs @@ -59,6 +59,7 @@ data SDConfig , preventMultiEdgesInOriginalDiagram :: Maybe Bool , compoundsHaveNames :: Maybe Bool , enforceOutgoingEdgesFromNormalAndHierarchical :: Bool + , preventTransitionsToItself :: Bool , chartLimits :: ChartLimits , extraConstraint :: String } deriving (Show,Eq) @@ -92,6 +93,7 @@ defaultSDConfigScenario1 , preventMultiEdgesInOriginalDiagram = Nothing , compoundsHaveNames = Just False , enforceOutgoingEdgesFromNormalAndHierarchical = True + , preventTransitionsToItself = False , chartLimits = ChartLimits { regionsStates = 0 , hierarchicalStates = 1 @@ -129,6 +131,7 @@ defaultSDConfigScenario2 , preventMultiEdgesInOriginalDiagram = Nothing , compoundsHaveNames = Just False , enforceOutgoingEdgesFromNormalAndHierarchical = True + , preventTransitionsToItself = False , chartLimits = ChartLimits { regionsStates = 1 , hierarchicalStates = 0 @@ -166,6 +169,7 @@ defaultSDConfigScenario3 , preventMultiEdgesInOriginalDiagram = Nothing , compoundsHaveNames = Just False , enforceOutgoingEdgesFromNormalAndHierarchical = True + , preventTransitionsToItself = False , chartLimits = ChartLimits { regionsStates = 0 , hierarchicalStates = 1 @@ -303,6 +307,7 @@ sdConfigToAlloy SDConfig { bitwidth , preventMultiEdgesInOriginalDiagram , compoundsHaveNames , enforceOutgoingEdgesFromNormalAndHierarchical + , preventTransitionsToItself , chartLimits = ChartLimits { regionsStates , hierarchicalStates , regions @@ -354,6 +359,7 @@ pred scenarioConfig #{oB} preventMultiEdgesInOriginalDiagram} #{if preventNestedEndNodes then "disj[EndNodes, allContainedNodes]" else ""} #{if enforceOutgoingEdgesFromNormalAndHierarchical then "all s : (NormalStates + HierarchicalStates) | some (Flows <: from).s" else ""} + #{if preventTransitionsToItself then "no s : States | s in (Flows <: from).s.to" else ""} #{lowerBound startNodes "StartNodes"} #{lowerBound shallowHistoryNodes "ShallowHistoryNodes"} #{lowerBound deepHistoryNodes "DeepHistoryNodes"} From 4a5a887b0aa2d2cc6c05b93d511f5e9741eaf91e Mon Sep 17 00:00:00 2001 From: nimec01 <24428341+nimec01@users.noreply.github.com> Date: Mon, 30 Dec 2024 15:09:32 +0100 Subject: [PATCH 2/2] rename option --- src/Modelling/StateDiagram/Config.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Modelling/StateDiagram/Config.hs b/src/Modelling/StateDiagram/Config.hs index 9044e67..8ef19e5 100644 --- a/src/Modelling/StateDiagram/Config.hs +++ b/src/Modelling/StateDiagram/Config.hs @@ -59,7 +59,7 @@ data SDConfig , preventMultiEdgesInOriginalDiagram :: Maybe Bool , compoundsHaveNames :: Maybe Bool , enforceOutgoingEdgesFromNormalAndHierarchical :: Bool - , preventTransitionsToItself :: Bool + , preventSelfLoops :: Bool , chartLimits :: ChartLimits , extraConstraint :: String } deriving (Show,Eq) @@ -93,7 +93,7 @@ defaultSDConfigScenario1 , preventMultiEdgesInOriginalDiagram = Nothing , compoundsHaveNames = Just False , enforceOutgoingEdgesFromNormalAndHierarchical = True - , preventTransitionsToItself = False + , preventSelfLoops = False , chartLimits = ChartLimits { regionsStates = 0 , hierarchicalStates = 1 @@ -131,7 +131,7 @@ defaultSDConfigScenario2 , preventMultiEdgesInOriginalDiagram = Nothing , compoundsHaveNames = Just False , enforceOutgoingEdgesFromNormalAndHierarchical = True - , preventTransitionsToItself = False + , preventSelfLoops = False , chartLimits = ChartLimits { regionsStates = 1 , hierarchicalStates = 0 @@ -169,7 +169,7 @@ defaultSDConfigScenario3 , preventMultiEdgesInOriginalDiagram = Nothing , compoundsHaveNames = Just False , enforceOutgoingEdgesFromNormalAndHierarchical = True - , preventTransitionsToItself = False + , preventSelfLoops = False , chartLimits = ChartLimits { regionsStates = 0 , hierarchicalStates = 1 @@ -307,7 +307,7 @@ sdConfigToAlloy SDConfig { bitwidth , preventMultiEdgesInOriginalDiagram , compoundsHaveNames , enforceOutgoingEdgesFromNormalAndHierarchical - , preventTransitionsToItself + , preventSelfLoops , chartLimits = ChartLimits { regionsStates , hierarchicalStates , regions @@ -359,7 +359,7 @@ pred scenarioConfig #{oB} preventMultiEdgesInOriginalDiagram} #{if preventNestedEndNodes then "disj[EndNodes, allContainedNodes]" else ""} #{if enforceOutgoingEdgesFromNormalAndHierarchical then "all s : (NormalStates + HierarchicalStates) | some (Flows <: from).s" else ""} - #{if preventTransitionsToItself then "no s : States | s in (Flows <: from).s.to" else ""} + #{if preventSelfLoops then "no s : States | s in (Flows <: from).s.to" else ""} #{lowerBound startNodes "StartNodes"} #{lowerBound shallowHistoryNodes "ShallowHistoryNodes"} #{lowerBound deepHistoryNodes "DeepHistoryNodes"}