동작을 이해하는 가장 쉬운 방법 : 멤버 변수의 값을 변경할 수 있습니다. 예.
class MyClass
{
public Integer i = 0;
public void Operation1(){
i++; //This could be an interpretation of of opaque action from an Activity
};
public void RunStateMachine(){
//You can use state's entry/doActivity/exit behavior. E.g. put "i++" in any of them
//You can use transition's effect behavior. E.g. put "i++" in it
//state's entry/doActivity/exit, transition's effect can specify to another behavior, e.g. run another Activity or statemachine,
//UML provides a good recursive way to let user to model what ever they wanted.
//NOTE: When using statemachine as behavior, you should know that the context (e.g. MyClass my = new MyClass(); here my is the context) of the statemachine
//is expecting an EventOccurence if the transitions has triggers.
//If no triggers are defined in any of the transitions in a statemachine, it can be think of being downgraded as an activity
// (well, it is not conforming to UML, but you can think in that way.)
}
}
상태 머신은 프로그램의 다른/가능한 상태 (활동 없음), 휴면 상태, 실행 중, 대기 중 등의 객체/모듈 상태와 같은 것을 나타내는 데 사용됩니다. D –
당신의 코멘트에 대해 @ user2511414 감사하지만 UML 사양 을 통해 읽으 셨습니다. 동작 (13 절 Common Behavior)은 세 가지 메커니즘을 통해 지정할 수 있습니다 : State Machines, 활동 및 상호 작용 다음 세 가지 방법 중 어느 것을 사용해야하는지는 주로 행동. – user2019510
나는 상태 머신에서 행동을 나타낼 것이지만 일반적으로 (예 : 실행 상태, 지속,로드, 종료 등), 각 주에는 어떤 활동이 포함될 것입니다. –