T - IAmountable implementation that is is collected hereby called itemT - public class AmountablePrice<T extends IAmountable> extends BaseAmountable<T>
IWare object.
Each object in the real world has hits unique price. Since no instances of the
objects are used but only one reference the price information gets lost. The
amountable price tracks the average price of all amounted objects| Type | Property and Description |
|---|---|
javafx.beans.binding.NumberBinding |
avgPrice |
amountProperty| Modifier and Type | Field and Description |
|---|---|
private javafx.beans.property.DoubleProperty |
sum
Total price of all amounted items
|
amount| Constructor and Description |
|---|
AmountablePrice() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int amount,
int avgPrice)
Add a number items
|
javafx.beans.binding.NumberBinding |
avgPriceProperty() |
int |
getAVGPrice()
Retrieve the average price of one item
|
void |
remove(int amount)
Remove a number of items
|
void |
reset()
Set the amount to 0.
|
String |
toString() |
add, amountProperty, getAmountprivate final javafx.beans.property.DoubleProperty sum
public int getAVGPrice()
public javafx.beans.binding.NumberBinding avgPriceProperty()
public void add(int amount,
int avgPrice)
amount - number of the items to be addedavgPrice - average price of one item that is addedpublic void remove(int amount)
remove in class BaseAmountable<T extends IAmountable>amount - of items to be removedpublic void reset()
BaseAmountablereset in class BaseAmountable<T extends IAmountable>public String toString()
toString in class BaseAmountable<T extends IAmountable>Copyright © 2011-2015 Sahits GmbH. All Rights Reserved.