LibMachine
Functions
process
Routes the input products to functions handeling the specific machine type, returning the output products.
function process(MACHINE_TYPE _machineType, Product[] memory _inputs)
internal
view
returns (Product[] memory _output);
Parameters
Name | Type | Description |
---|---|---|
_machineType | MACHINE_TYPE | The type of the machine to process the products. |
_inputs | Product[] | An array of products to be processed. |
Returns
Name | Type | Description |
---|---|---|
_output | Product[] | An array of resultant products after processing. |
splitter
Splits a single input product into two output products of equal amount.
function splitter(Product memory _input) internal pure returns (Product[] memory _outputs);
Parameters
Name | Type | Description |
---|---|---|
_input | Product | Product to be processed. |
Returns
Name | Type | Description |
---|---|---|
_outputs | Product[] | An array containing two products |
mixer
Mixes two input products, transforming them into a single output product based on a recipe
Amount returned will be the lowest of the two inputs
function mixer(Product[] memory _inputs) internal view returns (Product[] memory _outputs);
Parameters
Name | Type | Description |
---|---|---|
_inputs | Product[] | An array of products |
Returns
Name | Type | Description |
---|---|---|
_outputs | Product[] | An array of products |
defaultMachine
Processes a singleinput product through a specified machine type, creating one ot two output product.
function defaultMachine(MACHINE_TYPE _machineType, Product memory _input)
internal
view
returns (Product[] memory _outputs);
Parameters
Name | Type | Description |
---|---|---|
_machineType | MACHINE_TYPE | The type of machine to process the input product. |
_input | Product | Input product |
Returns
Name | Type | Description |
---|---|---|
_outputs | Product[] | An array of output products |
getLowestAmountProduct
function getLowestAmountProduct(Product memory _A, Product memory _B)
internal
pure
returns (Product memory _lowestAmountProduct);