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 } func (p *Psd) AsdGroups() []*proto.AsdGroup { return p.asdGroups } func (p *Psd) FindAsdGroup(group int32) *proto.AsdGroup { for _, asdGroup := range p.asdGroups { if asdGroup.Group == group { return asdGroup } } return nil } 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 }