38 lines
641 B
Go
38 lines
641 B
Go
package model
|
|
|
|
import "joylink.club/rtsssimulation/state"
|
|
|
|
type IDeviceModel interface {
|
|
GetId() string
|
|
IsSame(other IDeviceModel) bool
|
|
GetType() state.DeviceType
|
|
}
|
|
|
|
// 设备模型基础信息
|
|
type DeviceModel struct {
|
|
// 设备id
|
|
Id string
|
|
// 设备类型
|
|
Type state.DeviceType
|
|
}
|
|
|
|
func (me *DeviceModel) GetId() string {
|
|
return me.Id
|
|
}
|
|
func (me *DeviceModel) IsSame(other IDeviceModel) bool {
|
|
return me.Id == other.GetId()
|
|
}
|
|
func (me *DeviceModel) GetType() state.DeviceType {
|
|
return me.Type
|
|
}
|
|
|
|
// 端口定义,如轨道、区段、道岔的端口
|
|
type PortEnum = int8
|
|
|
|
// 具体端口枚举
|
|
const (
|
|
A PortEnum = iota
|
|
B
|
|
C
|
|
)
|