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
|
fxTheadExecution| Constructor and Description |
|---|
AmountablePrice() |
AmountablePrice(int amount,
double totalPrice)
Constructor initalizing the amountablePrice with an amount and average price.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int amount,
int avgPrice)
Add a number items
|
javafx.beans.binding.NumberBinding |
avgPriceProperty() |
boolean |
equals(Object o) |
int |
getAVGPrice()
Retrieve the average price of one item
|
double |
getSum()
Get the total cum of the amount.
|
int |
hashCode() |
void |
remove(int amount)
Remove a number of items
|
void |
reset()
Set the amount to 0.
|
String |
toString() |
add, amountProperty, getAmount, setAmountprivate final javafx.beans.property.DoubleProperty sum
public AmountablePrice()
public AmountablePrice(int amount,
double totalPrice)
amount - totalPrice - 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>public boolean equals(Object o)
equals in class BaseAmountable<T extends IAmountable>public int hashCode()
hashCode in class BaseAmountable<T extends IAmountable>public double getSum()
Copyright © 2011-2017 Sahits GmbH. All Rights Reserved.