source: src/main/java/genius/core/analysis/BidPointTime.java

Last change on this file was 127, checked in by Wouter Pasman, 6 years ago

#41 ROLL BACK of rev.126 . So this version is equal to rev. 125

File size: 2.2 KB
Line 
1package genius.core.analysis;
2
3import genius.core.Bid;
4
5/**
6 * Specialized version of a BidPoint for the case that there are two agents.
7 * In this case, the time of offering the bid can be recorded.
8 *
9 * @author Alex Dirkzwager
10 */
11public class BidPointTime extends BidPoint{
12
13 /** Time at which the bid was offered to the opponent. */
14 private double time;
15
16 /**
17 * Create a BidPointTime object, which is a tuple of a specific
18 * bid, the utility of this bid for both agents, and the time at
19 * which the bid was offered.
20 *
21 * @param bid of which the utilities are recorded.
22 * @param utilityA utility of the agent for agent A.
23 * @param utilityB utility of the agent for agent B.
24 * @param time at which the bid was offered.
25 */
26 public BidPointTime(Bid bid, Double utilityA, Double utilityB, double time) {
27 super(bid, utilityA, utilityB);
28 this.time = time;
29 }
30
31 /**
32 * @return string representation of the object..
33 */
34 @Override
35 public String toString(){
36 return "BidPointTime ["+getBid()+" utilA["+getUtilityA()+"],utilB["+getUtilityB()+"], Time["+time+"]]";
37 }
38
39 /**
40 * @return hashcode of this object.
41 */
42 @Override
43 public int hashCode() {
44 final int prime = 31;
45 int result = super.hashCode();
46 long temp;
47 temp = Double.doubleToLongBits(time);
48 result = prime * result + (int) (temp ^ (temp >>> 32));
49 return result;
50 }
51
52 /**
53 * @param obj object to which this object is compared.
54 * @return true if this object is equal to the given object.
55 */
56 @Override
57 public boolean equals(Object obj) {
58 if (this == obj)
59 return true;
60 if (!super.equals(obj))
61 return false;
62 if (getClass() != obj.getClass())
63 return false;
64 BidPointTime other = (BidPointTime) obj;
65 if (Double.doubleToLongBits(time) != Double
66 .doubleToLongBits(other.time))
67 return false;
68 return true;
69 }
70
71 /**
72 * Returns the time at which the bid was offered.
73 * @return time of offering.
74 */
75 public double getTime() {
76 return time;
77 }
78
79 /**
80 * Sets the time at which the bid is offered.
81 * @param time of offering.
82 */
83 public void setTime(double time) {
84 this.time = time;
85 }
86}
Note: See TracBrowser for help on using the repository browser.