Added comments to Production Drop. Fixes #10
This commit is contained in:
		
					parent
					
						
							
								e192181ac8
							
						
					
				
			
			
				commit
				
					
						2fda0e577e
					
				
			
		
					 1 changed files with 14 additions and 0 deletions
				
			
		|  | @ -2,6 +2,8 @@ package feragstring | ||||||
| 
 | 
 | ||||||
| import "fmt" | import "fmt" | ||||||
| 
 | 
 | ||||||
|  | // ProductionDrop is the struct for one production drop | ||||||
|  | // underneath a route | ||||||
| type ProductionDrop struct { | type ProductionDrop struct { | ||||||
| 	FeragMessage | 	FeragMessage | ||||||
| 	agentName         string | 	agentName         string | ||||||
|  | @ -11,6 +13,7 @@ type ProductionDrop struct { | ||||||
| 	topsheetData      string | 	topsheetData      string | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // TopsheetData returns the formatted topsheet data segment | ||||||
| func (pd *ProductionDrop) TopsheetData() string { | func (pd *ProductionDrop) TopsheetData() string { | ||||||
| 	if pd.topsheetData == "" { | 	if pd.topsheetData == "" { | ||||||
| 		return "" | 		return "" | ||||||
|  | @ -30,6 +33,7 @@ func (pd *ProductionDrop) TopsheetData() string { | ||||||
| 	return message(&fm, tsdSegment) | 	return message(&fm, tsdSegment) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // SetTopsheetData sets the topsheet data to a given string | ||||||
| func (pd *ProductionDrop) SetTopsheetData(topsheetData string) { | func (pd *ProductionDrop) SetTopsheetData(topsheetData string) { | ||||||
| 	pd.topsheetData = topsheetData | 	pd.topsheetData = topsheetData | ||||||
| } | } | ||||||
|  | @ -38,22 +42,28 @@ func (pd *ProductionDrop) SetDontProduce() { | ||||||
| 	pd.dontProduce = true | 	pd.dontProduce = true | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // NumberOfCopies returns the formatted number of copies in the route | ||||||
| func (pd *ProductionDrop) NumberOfCopies() string { | func (pd *ProductionDrop) NumberOfCopies() string { | ||||||
| 	return fmt.Sprintf("+13%05d", pd.numberOfCopies) | 	return fmt.Sprintf("+13%05d", pd.numberOfCopies) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // SetNumberOfCopies sets the number of copies in the production drop | ||||||
| func (pd *ProductionDrop) SetNumberOfCopies(numberOfCopies int) { | func (pd *ProductionDrop) SetNumberOfCopies(numberOfCopies int) { | ||||||
| 	pd.numberOfCopies = numberOfCopies | 	pd.numberOfCopies = numberOfCopies | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // AgentName returns the formatted agent name | ||||||
| func (pd *ProductionDrop) AgentName() string { | func (pd *ProductionDrop) AgentName() string { | ||||||
| 	return fmt.Sprintf("+12%-10s", pd.agentName) | 	return fmt.Sprintf("+12%-10s", pd.agentName) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // SetAgentName sets the agent name to a given string | ||||||
| func (pd *ProductionDrop) SetAgentName(agentName string) { | func (pd *ProductionDrop) SetAgentName(agentName string) { | ||||||
| 	pd.agentName = agentName | 	pd.agentName = agentName | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // NewProductionDrop instantiates a new production drop | ||||||
|  | // struct and returns a pointer to it. | ||||||
| func NewProductionDrop() *ProductionDrop { | func NewProductionDrop() *ProductionDrop { | ||||||
| 	pd := ProductionDrop{ | 	pd := ProductionDrop{ | ||||||
| 		FeragMessage: FeragMessage{ | 		FeragMessage: FeragMessage{ | ||||||
|  | @ -65,6 +75,8 @@ func NewProductionDrop() *ProductionDrop { | ||||||
| 	return &pd | 	return &pd | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // Payload returns the formatted FERAG string | ||||||
|  | // for embedding in the message | ||||||
| func (pd *ProductionDrop) Payload() string { | func (pd *ProductionDrop) Payload() string { | ||||||
| 	data := pd.AgentName() | 	data := pd.AgentName() | ||||||
| 	data += pd.NumberOfCopies() | 	data += pd.NumberOfCopies() | ||||||
|  | @ -72,6 +84,8 @@ func (pd *ProductionDrop) Payload() string { | ||||||
| 	return data | 	return data | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | // Message returns the formatted FERAG string | ||||||
|  | // for the production drop | ||||||
| func (pd *ProductionDrop) Message() string { | func (pd *ProductionDrop) Message() string { | ||||||
| 	message := pd.FeragMessage.MessageTemplate() | 	message := pd.FeragMessage.MessageTemplate() | ||||||
| 	return message(&pd.FeragMessage, pd.Payload()) | 	return message(&pd.FeragMessage, pd.Payload()) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue