-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTransactionEntity.java
More file actions
51 lines (38 loc) · 1.23 KB
/
TransactionEntity.java
File metadata and controls
51 lines (38 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package BitcoinEcon;
import java.lang.*;
import GenCol.entity;
public class TransactionEntity extends entity {
private Transaction transaction;
public TransactionEntity(Transaction aTransaction) {
this.transaction = aTransaction;
}
public boolean greaterThan(entity ent) {
return (this.transaction.price > ((TransactionEntity) ent).getv().price);
}
public void setv(Transaction t) {
transaction = t;
}
public Transaction getv() {
return transaction;
}
public void print() {
System.out.print(transaction);
}
public boolean equal(entity ent) {
// System.out.println(v + " " + ((doubleEnt)ent).getv());
return (Math.abs(this.transaction.price - ((TransactionEntity) ent).getv().price) < 0.0000001);
}
public boolean equals(Object ent) { // needed for Relation
if (!(ent instanceof TransactionEntity))
return false;
return equal((entity) ent);
}
public entity copy() {
TransactionEntity ip = new TransactionEntity(transaction);
return (entity) ip;
}
// This function should not be used
public String getName() {
return Double.toString(transaction.price);
}
}