Last change
on this file since 7 was 5, checked in by Bart Vastenhouw, 5 years ago |
Intermediate update
|
File size:
1.2 KB
|
Line | |
---|
1 | package tudelft.mentalhealth.motivatepersisting;
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Describes the current situation of the patient.
|
---|
5 | */
|
---|
6 | public class Situation {
|
---|
7 | private final PclTrend pcl;
|
---|
8 | private final Trust trust;
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * The current situation of the patient.
|
---|
12 | *
|
---|
13 | * @param pcl the {@link PclTrend} of the patient
|
---|
14 | * @param trust the {@link Trust} of the patient
|
---|
15 | */
|
---|
16 | public Situation(PclTrend pcl, Trust trust) {
|
---|
17 | if (pcl == null || trust == null) {
|
---|
18 | throw new NullPointerException("pcl and trust must be not null");
|
---|
19 | }
|
---|
20 | this.pcl = pcl;
|
---|
21 | this.trust = trust;
|
---|
22 | }
|
---|
23 |
|
---|
24 | @Override
|
---|
25 | public String toString() {
|
---|
26 | return "<" + pcl + "," + trust + ">";
|
---|
27 | }
|
---|
28 |
|
---|
29 | @Override
|
---|
30 | public int hashCode() {
|
---|
31 | final int prime = 31;
|
---|
32 | int result = 1;
|
---|
33 | result = prime * result + ((pcl == null) ? 0 : pcl.hashCode());
|
---|
34 | result = prime * result + ((trust == null) ? 0 : trust.hashCode());
|
---|
35 | return result;
|
---|
36 | }
|
---|
37 |
|
---|
38 | @Override
|
---|
39 | public boolean equals(Object obj) {
|
---|
40 | if (this == obj)
|
---|
41 | return true;
|
---|
42 | if (obj == null)
|
---|
43 | return false;
|
---|
44 | if (getClass() != obj.getClass())
|
---|
45 | return false;
|
---|
46 | Situation other = (Situation) obj;
|
---|
47 | if (pcl != other.pcl)
|
---|
48 | return false;
|
---|
49 | if (trust != other.trust)
|
---|
50 | return false;
|
---|
51 | return true;
|
---|
52 | }
|
---|
53 |
|
---|
54 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.