Introduced type ControlCharacterSet (+14)
This commit is contained in:
parent
76bb097d90
commit
085ed0c8ad
2 changed files with 48 additions and 19 deletions
41
control_character.go
Normal file
41
control_character.go
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
package feragstring
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
type ControlCharacterSet struct {
|
||||||
|
DontProduce bool
|
||||||
|
BundlesToSecondaryExit bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewControlCharacterSet() *ControlCharacterSet {
|
||||||
|
cc := ControlCharacterSet{
|
||||||
|
DontProduce: false,
|
||||||
|
BundlesToSecondaryExit: false,
|
||||||
|
}
|
||||||
|
return &cc
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cc *ControlCharacterSet) SetDontProduce() {
|
||||||
|
cc.DontProduce = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cc *ControlCharacterSet) SetBundlesToSecondaryExit() {
|
||||||
|
cc.BundlesToSecondaryExit = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cc *ControlCharacterSet) GetControlCharactersMessage() string {
|
||||||
|
var ccCount int
|
||||||
|
var ccString string
|
||||||
|
if cc.DontProduce == true {
|
||||||
|
ccString += "D"
|
||||||
|
ccCount++
|
||||||
|
}
|
||||||
|
if cc.BundlesToSecondaryExit == true {
|
||||||
|
ccString += "T"
|
||||||
|
ccCount++
|
||||||
|
}
|
||||||
|
if ccCount == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("+14%-16s", ccString)
|
||||||
|
}
|
|
@ -4,10 +4,11 @@ import "fmt"
|
||||||
|
|
||||||
type ProductionDrop struct {
|
type ProductionDrop struct {
|
||||||
FeragMessage
|
FeragMessage
|
||||||
agentName string
|
agentName string
|
||||||
numberOfCopies int
|
numberOfCopies int
|
||||||
dontProduce bool
|
ControlCharacters ControlCharacterSet
|
||||||
topsheetData string
|
dontProduce bool
|
||||||
|
topsheetData string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pd *ProductionDrop) TopsheetData() string {
|
func (pd *ProductionDrop) TopsheetData() string {
|
||||||
|
@ -33,19 +34,6 @@ func (pd *ProductionDrop) SetTopsheetData(topsheetData string) {
|
||||||
pd.topsheetData = topsheetData
|
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() {
|
func (pd *ProductionDrop) SetDontProduce() {
|
||||||
pd.dontProduce = true
|
pd.dontProduce = true
|
||||||
}
|
}
|
||||||
|
@ -72,7 +60,7 @@ func NewProductionDrop() *ProductionDrop {
|
||||||
messageStart: "2403",
|
messageStart: "2403",
|
||||||
messageEnd: "!",
|
messageEnd: "!",
|
||||||
},
|
},
|
||||||
dontProduce: false,
|
ControlCharacters: ControlCharacterSet{},
|
||||||
}
|
}
|
||||||
return &pd
|
return &pd
|
||||||
}
|
}
|
||||||
|
@ -80,7 +68,7 @@ func NewProductionDrop() *ProductionDrop {
|
||||||
func (pd *ProductionDrop) Payload() string {
|
func (pd *ProductionDrop) Payload() string {
|
||||||
data := pd.AgentName()
|
data := pd.AgentName()
|
||||||
data += pd.NumberOfCopies()
|
data += pd.NumberOfCopies()
|
||||||
data += pd.ControlCharacter()
|
data += pd.ControlCharacters.GetControlCharactersMessage()
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue