Class Inventory
java.lang.Object
com.xavierloeraflores.inventorymanagement.Inventory
A class representing the inventory
which contains all parts and products.
- Author:
- xavierloeraflores
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAdds a part to the allParts list of the inventory.static voidaddProduct(Product newProduct) Adds a product to the allProducts list of the inventory.static booleandeletePart(Part selectedPart) Takes an index value pointing to a part in the inventory to delete it and return true or false if successfulstatic booleandeleteProduct(Product selectedProduct) Takes an index value pointing to a product in the inventory to delete it and return true or false if successfulstatic javafx.collections.ObservableList<Part>Returns the full list of parts in the inventorystatic javafx.collections.ObservableList<Product>Returns the full list of product in the inventorystatic PartlookupPart(int partId) Looks up a part given a partID and returns the result.static javafx.collections.ObservableList<Part>lookupPart(String partName) Looks up parts given a partName and returns the resultstatic ProductlookupProduct(int productId) Looks up a product given a productId and returns the result.static javafx.collections.ObservableList<Product>lookupProduct(String productName) Looks up products given a productName and returns the resultstatic voidupdatePart(int index, Part newPart) Takes an index value pointing to a part in the inventory and updates it with the given newPartstatic voidupdateProduct(int index, Product newProduct) Takes an index value pointing to a product in the inventory and updates it with the given newProduct
-
Field Details
-
allParts
The [observableArrayList] of parts in the inventory. -
allProducts
The [observableArrayList] of products in the inventory.
-
-
Constructor Details
-
Inventory
public Inventory()
-
-
Method Details
-
addPart
Adds a part to the allParts list of the inventory.- Parameters:
newPart- The [Part] object part to be added to the allParts of the inventory.
-
addProduct
Adds a product to the allProducts list of the inventory.- Parameters:
newProduct- The [Product] object part to be added to the allProducts of the inventory.
-
lookupPart
Looks up a part given a partID and returns the result.- Parameters:
partId- [int] partId value to be looked up- Returns:
- Part matching the given partId value or null if not found
-
lookupProduct
Looks up a product given a productId and returns the result.- Parameters:
productId- [int] productId value to be looked up- Returns:
- Product matching the given productId value or null if not found
-
lookupPart
Looks up parts given a partName and returns the result- Parameters:
partName- [string] value partName to be looked up- Returns:
- ObservableList
matching the given partName value or null if not found
-
lookupProduct
Looks up products given a productName and returns the result- Parameters:
productName- [string] value productName to be looked up- Returns:
- ObservableList
matching the given productName value or null if not found
-
updatePart
Takes an index value pointing to a part in the inventory and updates it with the given newPart- Parameters:
index- [int] index value pointing to the index of the part to be edited part in inventorynewPart- [Part] newPart value which will replace the old part
-
updateProduct
Takes an index value pointing to a product in the inventory and updates it with the given newProduct- Parameters:
index- [int] index value pointing to the index of the product to be edited part in inventorynewProduct- [Product] newProduct value which will replace the old product
-
deletePart
Takes an index value pointing to a part in the inventory to delete it and return true or false if successful- Parameters:
selectedPart- [Part] newPart value which will be deleted- Returns:
- true if the part was successfully delete or false if no deletion was made
-
deleteProduct
Takes an index value pointing to a product in the inventory to delete it and return true or false if successful- Parameters:
selectedProduct- [Product] selectedProduct value which will be deleted- Returns:
- true if the product was successfully delete or false if no deletion was made
-
getAllParts
Returns the full list of parts in the inventory- Returns:
- ObservableList
list of parts in the inventory
-
getAllProducts
Returns the full list of product in the inventory- Returns:
- ObservableList
list of product in the inventory
-