Introduced type ControlCharacterSet (+14)

This commit is contained in:
Oliver Jakoubek 2020-07-01 20:30:46 +02:00
commit 085ed0c8ad
2 changed files with 48 additions and 19 deletions

View file

@ -4,10 +4,11 @@ import "fmt"
type ProductionDrop struct {
FeragMessage
agentName string
numberOfCopies int
dontProduce bool
topsheetData string
agentName string
numberOfCopies int
ControlCharacters ControlCharacterSet
dontProduce bool
topsheetData string
}
func (pd *ProductionDrop) TopsheetData() string {
@ -33,19 +34,6 @@ func (pd *ProductionDrop) SetTopsheetData(topsheetData string) {
pd.topsheetData = topsheetData
}
func (pd *ProductionDrop) ControlCharacter() string {
var ccCount int
var cc string
if pd.dontProduce == true {
cc += "D"
ccCount++
}
if ccCount == 0 {
return ""
}
return fmt.Sprintf("+14%-16s", cc)
}
func (pd *ProductionDrop) SetDontProduce() {
pd.dontProduce = true
}
@ -72,7 +60,7 @@ func NewProductionDrop() *ProductionDrop {
messageStart: "2403",
messageEnd: "!",
},
dontProduce: false,
ControlCharacters: ControlCharacterSet{},
}
return &pd
}
@ -80,7 +68,7 @@ func NewProductionDrop() *ProductionDrop {
func (pd *ProductionDrop) Payload() string {
data := pd.AgentName()
data += pd.NumberOfCopies()
data += pd.ControlCharacter()
data += pd.ControlCharacters.GetControlCharactersMessage()
return data
}