2023-10-12 17:55:40 +08:00
|
|
|
package repository
|
|
|
|
|
|
|
|
import "joylink.club/rtsssimulation/repository/model/proto"
|
|
|
|
|
|
|
|
type Psd struct {
|
|
|
|
Identity
|
2023-11-01 16:52:03 +08:00
|
|
|
platform *Platform
|
|
|
|
asdAmount int32
|
|
|
|
asdGroups []*proto.AsdGroup
|
2023-10-12 17:55:40 +08:00
|
|
|
componentGroups []*ElectronicComponentGroup
|
|
|
|
}
|
|
|
|
|
2023-11-01 16:52:03 +08:00
|
|
|
func newPsd(id string, asdAmount int32, asdGroups []*proto.AsdGroup) *Psd {
|
2023-10-12 17:55:40 +08:00
|
|
|
return &Psd{
|
2023-11-01 16:52:03 +08:00
|
|
|
Identity: identity{id, proto.DeviceType_DeviceType_Psd},
|
|
|
|
asdAmount: asdAmount,
|
|
|
|
asdGroups: asdGroups,
|
2023-10-12 17:55:40 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-01 16:52:03 +08:00
|
|
|
func (p *Psd) Platform() *Platform {
|
|
|
|
return p.platform
|
2023-10-19 17:09:47 +08:00
|
|
|
}
|
|
|
|
|
2023-11-01 16:52:03 +08:00
|
|
|
func (p *Psd) AsdAmount() int32 {
|
|
|
|
return p.asdAmount
|
2023-10-12 17:55:40 +08:00
|
|
|
}
|
2023-10-23 17:35:57 +08:00
|
|
|
|
2023-11-01 16:52:03 +08:00
|
|
|
func (p *Psd) AsdGroups() []*proto.AsdGroup {
|
|
|
|
return p.asdGroups
|
2023-10-23 17:35:57 +08:00
|
|
|
}
|
|
|
|
|
2023-11-01 16:52:03 +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-11-01 16:52:03 +08:00
|
|
|
func (p *Psd) ComponentGroups() []*ElectronicComponentGroup {
|
|
|
|
return p.componentGroups
|
2023-10-23 17:35:57 +08:00
|
|
|
}
|