rts-sim-module/repository/psd.go

52 lines
1013 B
Go
Raw Permalink Normal View History

package repository
import "joylink.club/rtsssimulation/repository/model/proto"
type Psd struct {
Identity
platform *Platform
asdAmount int32
asdGroups []*proto.AsdGroup
componentGroups []*ElectronicComponentGroup
}
func newPsd(id string, asdAmount int32, asdGroups []*proto.AsdGroup) *Psd {
return &Psd{
Identity: identity{id, proto.DeviceType_DeviceType_Psd},
asdAmount: asdAmount,
asdGroups: asdGroups,
}
}
func (p *Psd) Platform() *Platform {
return p.platform
}
func (p *Psd) AsdAmount() int32 {
return p.asdAmount
}
2023-10-23 17:35:57 +08:00
func (p *Psd) AsdGroups() []*proto.AsdGroup {
return p.asdGroups
2023-10-23 17:35:57 +08:00
}
func (p *Psd) FindAsdGroup(group int32) *proto.AsdGroup {
for _, asdGroup := range p.asdGroups {
if asdGroup.Group == group {
return asdGroup
}
}
return nil
2023-10-23 17:35:57 +08:00
}
2023-12-08 18:03:12 +08:00
func (p *Psd) FindFirstAsdGroup() *proto.AsdGroup {
if len(p.asdGroups) >= 1 {
return p.asdGroups[0]
}
return nil
}
func (p *Psd) ComponentGroups() []*ElectronicComponentGroup {
return p.componentGroups
2023-10-23 17:35:57 +08:00
}