57 lines
1.2 KiB
Go
57 lines
1.2 KiB
Go
package tmodel
|
||
|
||
import (
|
||
"joylink.club/rtsssimulation/umi"
|
||
)
|
||
|
||
// 站台一侧屏蔽门模型
|
||
type PsdModel struct {
|
||
DeviceModel
|
||
//屏蔽门所包含的单元
|
||
Cells []*PsdCellModel
|
||
//屏蔽门移动从0-100耗时,单位ms
|
||
MoveTime int64
|
||
}
|
||
|
||
func NewPsdModel(id string) *PsdModel {
|
||
return &PsdModel{DeviceModel: DeviceModel{Id: id, Type: umi.Psd}, Cells: make([]*PsdCellModel, 0)}
|
||
}
|
||
func (me *PsdModel) addCell(cell *PsdCellModel) {
|
||
me.Cells = append(me.Cells, cell)
|
||
}
|
||
|
||
// 屏蔽门移动从0-100耗时,单位ms
|
||
func (me *PsdModel) MovingTime() int64 {
|
||
return me.MoveTime
|
||
}
|
||
|
||
// 屏蔽门的所有单元门
|
||
func (me *PsdModel) AllDeviceCells() []umi.IDeviceModel {
|
||
rt := make([]umi.IDeviceModel, 0, len(me.Cells))
|
||
for _, cell := range me.Cells {
|
||
rt = append(rt, cell)
|
||
}
|
||
return rt
|
||
}
|
||
|
||
/////////////////////////////////////////////
|
||
|
||
// 站台一侧屏蔽门单元模型
|
||
type PsdCellModel struct {
|
||
DeviceModel
|
||
//该屏蔽门单元所属的屏蔽门
|
||
psd umi.IDeviceModel
|
||
}
|
||
|
||
func NewPsdCellModel(id string, psdModel *PsdModel) *PsdCellModel {
|
||
cell := &PsdCellModel{
|
||
DeviceModel: DeviceModel{Id: id, Type: umi.PsdCell},
|
||
psd: psdModel,
|
||
}
|
||
psdModel.addCell(cell)
|
||
return cell
|
||
}
|
||
func (me *PsdCellModel) Psd() *PsdModel {
|
||
return me.psd.(*PsdModel)
|
||
}
|