Subversion Repositories SmartDukaan

Rev

Rev 31903 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 31903 Rev 32021
Line 7... Line 7...
7
public class AmountModel {
7
public class AmountModel {
8
 
8
 
9
	private double amount;
9
	private double amount;
10
	private AmountType amountType;
10
	private AmountType amountType;
11
	private double value;
11
	private double value;
-
 
12
	private boolean discount = false;
12
 
13
 
13
	public AmountModel() {
14
	public AmountModel() {
14
	}
15
	}
15
 
16
 
16
	public AmountModel(double amount, AmountType amountType) {
17
	public AmountModel(double amount, AmountType amountType) {
Line 24... Line 25...
24
 
25
 
25
	public void setValue(double value) {
26
	public void setValue(double value) {
26
		this.value = value;
27
		this.value = value;
27
	}
28
	}
28
 
29
 
29
	@Override
-
 
30
	public String toString() {
-
 
31
		return "AmountModel{" +
-
 
32
				"amount=" + amount +
-
 
33
				", amountType=" + amountType +
-
 
34
				'}';
-
 
35
	}
-
 
36
 
-
 
37
	@Override
-
 
38
	public boolean equals(Object o) {
-
 
39
		if (this == o) return true;
-
 
40
		if (o == null || getClass() != o.getClass()) return false;
-
 
41
		AmountModel that = (AmountModel) o;
-
 
42
		return Double.compare(that.amount, amount) == 0 && amountType == that.amountType;
-
 
43
	}
-
 
44
 
-
 
45
	@Override
-
 
46
	public int hashCode() {
-
 
47
		return Objects.hash(amount, amountType);
-
 
48
	}
-
 
49
 
-
 
50
	public double getAmount() {
30
	public double getAmount() {
51
		return amount;
31
		return amount;
52
	}
32
	}
53
 
33
 
54
	public void setAmount(double amount) {
34
	public void setAmount(double amount) {
Line 60... Line 40...
60
	}
40
	}
61
 
41
 
62
	public void setAmountType(AmountType amountType) {
42
	public void setAmountType(AmountType amountType) {
63
		this.amountType = amountType;
43
		this.amountType = amountType;
64
	}
44
	}
-
 
45
 
-
 
46
	public boolean isDiscount() {
-
 
47
		return discount;
-
 
48
	}
-
 
49
 
-
 
50
	public void setDiscount(boolean discount) {
-
 
51
		this.discount = discount;
-
 
52
	}
-
 
53
 
-
 
54
	@Override
-
 
55
	public boolean equals(Object o) {
-
 
56
		if (this == o) return true;
-
 
57
		if (o == null || getClass() != o.getClass()) return false;
-
 
58
		AmountModel that = (AmountModel) o;
-
 
59
		return Double.compare(that.amount, amount) == 0 && Double.compare(that.value, value) == 0 && discount == that.discount && amountType == that.amountType;
-
 
60
	}
-
 
61
 
-
 
62
	@Override
-
 
63
	public int hashCode() {
-
 
64
		return Objects.hash(amount, amountType, value, discount);
-
 
65
	}
-
 
66
 
-
 
67
	@Override
-
 
68
	public String toString() {
-
 
69
		return "AmountModel{" +
-
 
70
				"amount=" + amount +
-
 
71
				", amountType=" + amountType +
-
 
72
				", value=" + value +
-
 
73
				", discount=" + discount +
-
 
74
				'}';
-
 
75
	}
65
}
76
}