状态机高阶讲解-02

261
00:11:22,483 --> 00:11:25,260
或依赖于这个,在这里表达

262
00:11:26,780 --> 00:11:30,000
Moore是说什么,在这里表达

263
00:11:30,280 --> 00:11:30,523


264
00:11:30,523 --> 00:11:33,443
在状态里表达,状态的什么

265
00:11:33,443 --> 00:11:34,660
入口

266
00:11:34,940 --> 00:11:37,450
出口,这个地方表达

267
00:11:37,880 --> 00:11:40,340
这边有

268
00:11:40,620 --> 00:11:42,510
输出

269
00:11:43,360 --> 00:11:44,382
效果

270
00:11:44,382 --> 00:11:45,150
在这里

271
00:11:45,610 --> 00:11:48,270
在状态里面表达

272
00:11:50,650 --> 00:11:52,900
当然这两个你也可以把它

273
00:11:53,280 --> 00:11:54,240
互相换

274
00:11:54,240 --> 00:11:57,313
无非是把这个东西换一个地方

275
00:11:57,313 --> 00:11:57,890
对不对

276
00:12:00,110 --> 00:12:02,360
简单的基本上都能够换过来

277
00:12:06,720 --> 00:12:07,890
这是

278
00:12:08,770 --> 00:12:10,447
发展的历史

279
00:12:10,447 --> 00:12:11,790
那后来的

280
00:12:12,590 --> 00:12:14,410
下一步就是

281
00:12:18,090 --> 00:12:18,990
这个

282
00:12:19,930 --> 00:12:20,646
David

283
00:12:20,646 --> 00:12:21,720
Harel

284
00:12:21,720 --> 00:12:25,168


285
00:12:25,168 --> 00:12:25,567
这个教授,写的这个文章

286
00:12:25,567 --> 00:12:31,490
状态图,Statechart这个文章

287
00:12:35,160 --> 00:12:37,580
实际上就是把前面的

288
00:12:37,990 --> 00:12:38,850

289
00:12:40,750 --> 00:12:42,350
提供的各种元素

290
00:12:42,350 --> 00:12:44,180
包括刚才Moore

291
00:12:44,480 --> 00:12:45,495
Mealy

292
00:12:45,495 --> 00:12:46,510
这些

293
00:12:46,910 --> 00:12:48,375
都包含进来

294
00:12:48,375 --> 00:12:50,330
把它都放进来

295
00:12:50,820 --> 00:12:51,890
而且呢

296
00:12:52,900 --> 00:12:55,180
把状态机分了层

297
00:12:55,960 --> 00:12:56,292


298
00:12:56,292 --> 00:12:57,952
提供了分层

299
00:12:57,952 --> 00:12:59,280
还有分区

300
00:12:59,900 --> 00:13:00,205


301
00:13:00,205 --> 00:13:02,953
分成正交的若干个区

302
00:13:02,953 --> 00:13:04,480
然后呢,分层

303
00:13:04,850 --> 00:13:07,096
实际上就是区和区之间

304
00:13:07,096 --> 00:13:09,093
就相当于可以and嘛

305
00:13:09,093 --> 00:13:09,592
对吧

306
00:13:09,592 --> 00:13:11,090
这边可以

307
00:13:12,940 --> 00:13:14,437
可以同时并存的

308
00:13:14,437 --> 00:13:15,935
而这边只能是或

309
00:13:15,935 --> 00:13:16,363
对吧

310
00:13:16,363 --> 00:13:18,288
一个状态内

311
00:13:18,288 --> 00:13:20,000
这个只能是或

312
00:13:23,220 --> 00:13:25,385
同时还有入口出口活动

313
00:13:25,385 --> 00:13:27,550
这个也放进来了

314
00:13:30,110 --> 00:13:32,830
那这个就是目前我们UML

315
00:13:35,100 --> 00:13:36,630
或者SysML

316
00:13:37,300 --> 00:13:39,930
所使用的这个状态机的

317
00:13:42,570 --> 00:13:43,562
雏形

318
00:13:43,562 --> 00:13:46,210
就是在这个

319
00:13:46,490 --> 00:13:47,390
基础上

320
00:13:48,580 --> 00:13:51,940
来制定了现在UML、SysML的规范

321
00:13:59,090 --> 00:14:03,474
那UML的状态机的元模型是这样的

322
00:14:03,474 --> 00:14:04,790
这2.5.1的

323
00:14:05,870 --> 00:14:10,071
2.5.1这个状态机的元模型

324
00:14:10,071 --> 00:14:12,639
你看,状态机分了几个区

325
00:14:12,639 --> 00:14:14,040
这是区嘛

326
00:14:14,350 --> 00:14:15,504
分区嘛,对吧

327
00:14:15,504 --> 00:14:17,352
然后里面有状态

328
00:14:17,352 --> 00:14:19,200
然后这个迁移,对吧

329
00:14:21,490 --> 00:14:23,410
状态,迁移

330
00:14:23,910 --> 00:14:25,070
类似这样的

331
00:14:29,590 --> 00:14:31,945
相当于把它给形式化

332
00:14:31,945 --> 00:14:34,300
因为Harel这个

333
00:14:34,580 --> 00:14:37,220
文章里面,他只提供了图形

334
00:14:37,640 --> 00:14:41,100
他并没有提供形式化的表示法

335
00:14:42,640 --> 00:14:44,850
也没有提供元模型

336
00:14:45,970 --> 00:14:48,350
UML提供元模型

337
00:14:51,900 --> 00:14:53,610
那现在也有一些

338
00:14:57,160 --> 00:14:58,960
文本的

339
00:15:00,650 --> 00:15:03,740
用文本来表达模型的

340
00:15:04,650 --> 00:15:04,890


341
00:15:04,890 --> 00:15:06,576
一些标准

342
00:15:06,576 --> 00:15:10,190
比如说,一会会讲W3C这个

343
00:15:10,690 --> 00:15:14,171
SCXML,Statechart XML 

344
00:15:14,171 --> 00:15:18,520
状态图XML,等等

345
00:15:22,110 --> 00:15:23,900
那么在UML

346
00:15:28,500 --> 00:15:30,590
这个标准里面

347
00:15:31,690 --> 00:15:33,610
它分为两种

348
00:15:33,610 --> 00:15:35,530
一个叫行为状态机

349
00:15:35,530 --> 00:15:37,450
一个叫协议状态机

350
00:15:37,450 --> 00:15:37,930
那实际上

351
00:15:38,760 --> 00:15:41,280
我们平时说的状态机就是指的

352
00:15:41,280 --> 00:15:42,720
行为状态机,行为是什么

353
00:15:42,720 --> 00:15:43,080
就是

354
00:15:43,360 --> 00:15:45,190
刚才讲这个输出嘛

355
00:15:47,510 --> 00:15:47,785


356
00:15:47,785 --> 00:15:49,160
或者效果

357
00:15:50,010 --> 00:15:51,870
那协议状态机是什么

358
00:15:51,870 --> 00:15:52,490
就是把

359
00:15:52,770 --> 00:15:55,719
那个行为部分砍掉,没有输出

360
00:15:55,719 --> 00:15:57,307
输出就是action

361
00:15:57,307 --> 00:15:57,761
对吧

362
00:15:57,761 --> 00:16:00,030
就是刚才讲的那个action

363
00:16:04,910 --> 00:16:06,808
action可能发生在哪里

364
00:16:06,808 --> 00:16:07,520
发生在

365
00:16:08,470 --> 00:16:11,690
这个地方,也可能发生在这个状态的入口

366
00:16:11,970 --> 00:16:14,075
进入,在状态里面发生

367
00:16:14,075 --> 00:16:16,648
也可能在迁移的时候发生

368
00:16:16,648 --> 00:16:16,882


369
00:16:16,882 --> 00:16:19,690
那现在这个协议状态机就把

370
00:16:20,620 --> 00:16:22,205
这个就砍掉了

371
00:16:22,205 --> 00:16:23,337
就保留协议

372
00:16:23,337 --> 00:16:24,470
就保留那个

373
00:16:24,750 --> 00:16:26,030
输入的部分

374
00:16:26,360 --> 00:16:30,570
就相当于定义了一些可以接受的输入

375
00:16:32,290 --> 00:16:33,820
但是的话我们

376
00:16:35,260 --> 00:16:36,160
这个

377
00:16:37,010 --> 00:16:38,400
协议状态机

378
00:16:39,320 --> 00:16:39,592


379
00:16:39,592 --> 00:16:43,130
我们在软件开发里面用得并不多

380
00:16:44,640 --> 00:16:47,311
我们说状态机指的就是行为状态机

381
00:16:47,311 --> 00:16:48,480
因为我们毕竟要

382
00:16:48,940 --> 00:16:50,350
把这个

383
00:16:50,870 --> 00:16:52,830
软件给运转起来嘛

384
00:16:52,830 --> 00:16:53,320
对吧

385
00:16:53,320 --> 00:16:53,565


386
00:16:53,565 --> 00:16:54,790
要有输出嘛

387
00:16:55,980 --> 00:16:58,206
所以呢,这个就不用管它了

388
00:16:58,206 --> 00:17:00,061
不用管它,UML标准

389
00:17:00,061 --> 00:17:02,473
你搜状态机,有两个状态机

390
00:17:02,473 --> 00:17:03,215
一个行为

391
00:17:03,215 --> 00:17:04,329
一个是协议

392
00:17:04,329 --> 00:17:06,370
这个协议就是行为的

393
00:17:06,740 --> 00:17:08,068
删减版

394
00:17:08,068 --> 00:17:09,840
你可以这样理解

395
00:17:10,560 --> 00:17:13,474
把输出部分给砍掉之后

396
00:17:13,474 --> 00:17:15,660
剩下的就是协议部分

397
00:17:17,810 --> 00:17:19,000
接下来呢

398
00:17:19,380 --> 00:17:21,860
我们首先来看

399
00:17:22,600 --> 00:17:25,040
学习状态机

400
00:17:25,660 --> 00:17:28,478
建模的这个技能的目的

401
00:17:28,478 --> 00:17:29,760
或者用途

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值