2005-08-17 15:45:10 +00:00
|
|
|
(*****************************************************************************
|
2005-08-18 05:55:15 +00:00
|
|
|
* su4sml - a SecureUML repository for SML
|
2005-08-17 15:45:10 +00:00
|
|
|
*
|
|
|
|
* state_machine.sig - generic state machines
|
|
|
|
* Copyright (C) 2005 Achim D. Brucker <brucker@inf.ethz.ch>
|
|
|
|
* Jürgen Doser <doserj@inf.ethz.ch>
|
|
|
|
* Burkhart Wolff <bwolff@inf.ethz.ch>
|
|
|
|
*
|
|
|
|
* This file is part of su4sml.
|
|
|
|
*
|
|
|
|
* su4sml is free software; you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU General Public License as published by the Free
|
|
|
|
* Software Foundation; either version 2 of the License, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* su4sml is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
******************************************************************************)
|
|
|
|
|
2006-12-08 17:16:33 +00:00
|
|
|
(** repository datatypes and helper functions for UML statemachines *)
|
2006-04-27 14:27:16 +00:00
|
|
|
signature REP_STATE_MACHINE =
|
|
|
|
sig
|
|
|
|
|
|
|
|
type StateVertex_Id
|
|
|
|
type Transition_Id
|
2006-05-03 17:29:43 +00:00
|
|
|
|
2006-04-27 14:27:16 +00:00
|
|
|
datatype Procedure = Proc_mk of {proc_id : string,
|
2006-05-03 17:29:43 +00:00
|
|
|
language : string,
|
|
|
|
body : string,
|
|
|
|
expression : string }
|
|
|
|
|
2006-04-27 14:27:16 +00:00
|
|
|
(* perhaps this type has to be changes according to what we can expect *)
|
|
|
|
(* from CASE tools *)
|
|
|
|
type Guard = Rep_OclTerm.OclTerm
|
|
|
|
|
2006-05-03 17:29:43 +00:00
|
|
|
type Parameter = string * Rep_OclType.OclType
|
2006-04-27 14:27:16 +00:00
|
|
|
|
|
|
|
datatype Event = SignalEvent of Parameter list
|
2006-05-03 17:29:43 +00:00
|
|
|
| CallEvent of Rep_OclType.Path * Parameter list
|
|
|
|
(* | TimeEvent of Parameter list *)
|
|
|
|
(* | ChangeEvent of Parameter list *)
|
2006-04-27 14:27:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
datatype Transition = T_mk of {trans_id: Transition_Id,
|
|
|
|
source : StateVertex_Id,
|
|
|
|
target : StateVertex_Id,
|
|
|
|
guard : Guard option,
|
|
|
|
trigger : Event option,
|
|
|
|
effect : Procedure option
|
|
|
|
(* mmm : StateVertexId option *)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type PseudoStateVars = XMI_StateMachines.PseudoStateVars
|
|
|
|
|
|
|
|
datatype StateVertex =
|
|
|
|
State_CompositeState
|
|
|
|
of {name : string,
|
|
|
|
state_id : StateVertex_Id,
|
|
|
|
outgoing : Transition_Id list,
|
|
|
|
incoming : Transition_Id list,
|
|
|
|
subvertex : StateVertex list,
|
|
|
|
isConcurrent : bool
|
|
|
|
(* submachine : StateMachine *
|
|
|
|
{isDynamic : bool
|
|
|
|
(* + dynamicArguments
|
|
|
|
+ dynamicMultiplicity *)} option *)}
|
|
|
|
(* variant for Subactivity State *)
|
|
|
|
| State_SimpleState
|
|
|
|
of {name : string,
|
|
|
|
state_id : StateVertex_Id,
|
|
|
|
outgoing : Transition_Id list,
|
|
|
|
incoming : Transition_Id list}
|
|
|
|
| SimpleState_ActionState (* from ActivityGraphs *)
|
|
|
|
of {name : string,
|
|
|
|
state_id : StateVertex_Id,
|
|
|
|
outgoing : Transition_Id list,
|
|
|
|
incoming : Transition_Id list,
|
|
|
|
isDynamic : bool
|
|
|
|
(* + dynamicArguments + dynamicMultiplicity *)}
|
|
|
|
| SimpleState_ObjectflowState (* from ActivityGraphs *)
|
|
|
|
of {state_id : StateVertex_Id,
|
|
|
|
outgoing : Transition_Id list,
|
|
|
|
incoming : Transition_Id list,
|
|
|
|
isSynch : bool,
|
|
|
|
parameter : Parameter list,
|
|
|
|
types : Rep_OclType.Path list (* Classifier_Id *)}
|
|
|
|
| State_FinalState
|
|
|
|
of {state_id : StateVertex_Id,
|
|
|
|
incoming : Transition_Id list}
|
|
|
|
| PseudoState
|
|
|
|
of {state_id : StateVertex_Id,
|
|
|
|
kind : PseudoStateVars,
|
|
|
|
outgoing : Transition_Id list,
|
|
|
|
incoming : Transition_Id list}
|
|
|
|
| SyncState
|
|
|
|
of {state_id : StateVertex_Id,
|
|
|
|
outgoing : Transition_Id list,
|
|
|
|
incoming : Transition_Id list}
|
|
|
|
(* | StubState *)
|
|
|
|
and StateMachine = SM_mk of {top : StateVertex,
|
|
|
|
transition : Transition list}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2005-09-07 17:06:26 +00:00
|
|
|
structure Rep_StateMachine : REP_STATE_MACHINE =
|
|
|
|
struct
|
2005-08-17 15:45:10 +00:00
|
|
|
|
2005-09-07 17:06:26 +00:00
|
|
|
type StateVertex_Id = string
|
|
|
|
type Transition_Id = string
|
2005-08-17 15:45:10 +00:00
|
|
|
|
2005-11-11 16:15:47 +00:00
|
|
|
|
2006-02-02 15:11:48 +00:00
|
|
|
|
|
|
|
datatype Procedure = Proc_mk of {proc_id : string,
|
|
|
|
language : string,
|
|
|
|
body : string,
|
2006-04-07 12:04:18 +00:00
|
|
|
expression : string }
|
2005-08-17 15:45:10 +00:00
|
|
|
|
2005-11-11 16:15:47 +00:00
|
|
|
type Guard = Rep_OclTerm.OclTerm
|
|
|
|
type Parameter = string * Rep_OclType.OclType
|
2005-08-17 15:45:10 +00:00
|
|
|
|
2005-09-05 16:26:07 +00:00
|
|
|
datatype Event = SignalEvent of Parameter list
|
2005-11-11 16:15:47 +00:00
|
|
|
| CallEvent of Rep_OclType.Path * Parameter list
|
2005-09-05 16:26:07 +00:00
|
|
|
(* | TimeEvent of Parameter list *)
|
|
|
|
(* | ChangeEvent of Parameter list *)
|
2005-08-17 15:45:10 +00:00
|
|
|
|
|
|
|
|
2005-10-28 15:52:01 +00:00
|
|
|
datatype Transition = T_mk of {trans_id : Transition_Id,
|
|
|
|
source : StateVertex_Id,
|
2005-09-05 16:26:07 +00:00
|
|
|
target : StateVertex_Id,
|
|
|
|
guard : Guard option,
|
|
|
|
trigger : Event option,
|
2006-02-02 15:11:48 +00:00
|
|
|
effect : Procedure option
|
2005-08-17 15:45:10 +00:00
|
|
|
(* mmm : StateVertexId option *)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-28 15:52:01 +00:00
|
|
|
type PseudoStateVars = XMI_StateMachines.PseudoStateVars
|
2005-08-17 15:45:10 +00:00
|
|
|
|
|
|
|
datatype StateVertex =
|
2005-10-28 15:52:01 +00:00
|
|
|
State_CompositeState
|
2006-02-03 09:51:43 +00:00
|
|
|
of {name : string,
|
|
|
|
state_id : StateVertex_Id,
|
2005-10-28 15:52:01 +00:00
|
|
|
outgoing : Transition_Id list,
|
2005-09-05 16:26:07 +00:00
|
|
|
incoming : Transition_Id list,
|
2005-10-28 15:52:01 +00:00
|
|
|
subvertex : StateVertex list,
|
|
|
|
isConcurrent : bool
|
|
|
|
(*submachine : StateMachine *
|
2005-09-05 16:26:07 +00:00
|
|
|
{isDynamic : bool
|
|
|
|
(* + dynamicArguments
|
2005-10-28 15:52:01 +00:00
|
|
|
+ dynamicMultiplicity *)} option *)}
|
2005-09-05 16:26:07 +00:00
|
|
|
(* variant for Subactivity State *)
|
2005-08-17 15:45:10 +00:00
|
|
|
| State_SimpleState
|
2006-02-02 15:11:48 +00:00
|
|
|
of {name : string,
|
|
|
|
state_id : StateVertex_Id,
|
2005-10-28 15:52:01 +00:00
|
|
|
outgoing : Transition_Id list,
|
|
|
|
incoming : Transition_Id list}
|
2005-09-05 16:26:07 +00:00
|
|
|
| SimpleState_ActionState (* from ActivityGraphs *)
|
2006-02-02 15:11:48 +00:00
|
|
|
of {name : string,
|
|
|
|
state_id : StateVertex_Id,
|
2005-10-28 15:52:01 +00:00
|
|
|
outgoing : Transition_Id list,
|
|
|
|
incoming : Transition_Id list,
|
|
|
|
isDynamic : bool
|
2005-09-05 16:26:07 +00:00
|
|
|
(* + dynamicArguments + dynamicMultiplicity *)}
|
|
|
|
| SimpleState_ObjectflowState (* from ActivityGraphs *)
|
2005-10-28 15:52:01 +00:00
|
|
|
of {state_id : StateVertex_Id,
|
|
|
|
outgoing : Transition_Id list,
|
|
|
|
incoming : Transition_Id list,
|
|
|
|
isSynch : bool,
|
2005-09-05 16:26:07 +00:00
|
|
|
parameter : Parameter list,
|
2005-09-07 18:23:24 +00:00
|
|
|
types : Rep_OclType.Path list (* Classifier_Id *)}
|
2005-08-17 15:45:10 +00:00
|
|
|
| State_FinalState
|
2005-10-28 15:52:01 +00:00
|
|
|
of {state_id : StateVertex_Id,
|
|
|
|
incoming : Transition_Id list}
|
2005-08-17 15:45:10 +00:00
|
|
|
| PseudoState
|
2005-10-28 15:52:01 +00:00
|
|
|
of {state_id : StateVertex_Id,
|
|
|
|
kind : PseudoStateVars,
|
2005-09-05 16:26:07 +00:00
|
|
|
outgoing : Transition_Id list,
|
2005-10-28 15:52:01 +00:00
|
|
|
incoming : Transition_Id list}
|
2005-08-17 15:45:10 +00:00
|
|
|
| SyncState
|
2005-10-28 15:52:01 +00:00
|
|
|
of {state_id : StateVertex_Id,
|
|
|
|
outgoing : Transition_Id list,
|
|
|
|
incoming : Transition_Id list}
|
2005-08-17 15:45:10 +00:00
|
|
|
(* | StubState *)
|
2005-10-28 15:52:01 +00:00
|
|
|
and StateMachine = SM_mk of {top : StateVertex,
|
2005-11-11 16:15:47 +00:00
|
|
|
transition : Transition list}
|
2005-08-17 15:45:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
end
|