|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--project1.ProductId
|
+--project1.ProductItem
|
+--project1.ProductItemGroup
ProductItemGroup class is used to create product trees of mixed child entities.
| Field Summary |
| Fields inherited from class project1.ProductItem |
name |
| Constructor Summary | |
ProductItemGroup()
Constructor |
|
ProductItemGroup(java.util.Collection o)
Constructor |
|
ProductItemGroup(java.lang.String isim)
Constructor |
|
| Method Summary | |
boolean |
add(java.lang.Object obj)
|
boolean |
addAll(java.util.Collection collection)
|
void |
addProduct(ProductItem p)
Method |
void |
addProduct(ProductItemGroup p)
Method |
void |
clear()
|
boolean |
contains(java.lang.Object obj)
|
boolean |
containsAll(java.util.Collection collection)
|
boolean |
isEmpty()
|
java.util.Iterator |
iterator()
|
void |
manufactureProduct(int amount)
Method |
boolean |
prepareForManufacture(int amount)
Method |
void |
printGroup()
Method prints the whole product tree |
void |
printGroup(ProductItemGroup pp)
Method |
boolean |
remove(java.lang.Object obj)
|
boolean |
removeAll(java.util.Collection collection)
|
void |
removeProduct(ProductItem p)
Method |
void |
removeProduct(ProductItemGroup pp)
Method |
boolean |
retainAll(java.util.Collection collection)
|
int |
size()
|
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] obj)
|
| Methods inherited from class project1.ProductItem |
changeBegValid, changeEndValid |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
equals, hashCode |
| Constructor Detail |
public ProductItemGroup()
public ProductItemGroup(java.lang.String isim)
isim - sets the namepublic ProductItemGroup(java.util.Collection o)
o - adds o to the product tree, where o is another product tree| Method Detail |
public void addProduct(ProductItem p)
p - add this productpublic void addProduct(ProductItemGroup p)
p - add this product treepublic boolean prepareForManufacture(int amount)
amount - prepare manufacture of this amount of product, using the product tree
In the project documentation, we were asked to both return false and throw an exception.
Although, I implemented both, since we can not realize both, I choose returning false.
This method should check that for each type=4 product in the productgroup, there is enough in the stock to produce the given amount.
If for any productItem, there is not enough stock, it should give an exception error and return false; otherwise it should return true;public void manufactureProduct(int amount)
amount - produce by the specified amount
This method first checks if the associated machine is ready – if so manufactures the given productgroup by the given amount.
In doing so, it decreases the stock amounts of all the used components by the given amount and increases the stock amount of the
produced product by the given given amount.public void removeProduct(ProductItem p)
p - remove product p from the product treepublic void removeProduct(ProductItemGroup pp)
public void printGroup()
public void printGroup(ProductItemGroup pp)
pp - print the sub-product tree pppublic boolean add(java.lang.Object obj)
add in interface java.util.Collectionpublic boolean addAll(java.util.Collection collection)
addAll in interface java.util.Collectionpublic void clear()
clear in interface java.util.Collectionpublic boolean contains(java.lang.Object obj)
contains in interface java.util.Collectionpublic boolean containsAll(java.util.Collection collection)
containsAll in interface java.util.Collectionpublic boolean isEmpty()
isEmpty in interface java.util.Collectionpublic java.util.Iterator iterator()
iterator in interface java.util.Collectionpublic boolean remove(java.lang.Object obj)
remove in interface java.util.Collectionpublic boolean removeAll(java.util.Collection collection)
removeAll in interface java.util.Collectionpublic boolean retainAll(java.util.Collection collection)
retainAll in interface java.util.Collectionpublic int size()
size in interface java.util.Collectionpublic java.lang.Object[] toArray()
toArray in interface java.util.Collectionpublic java.lang.Object[] toArray(java.lang.Object[] obj)
toArray in interface java.util.Collection
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||