Skip to content

Commit 71c3a4e

Browse files
chore: add medical technology entity
1 parent 7ba42d9 commit 71c3a4e

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
package entity.medicaltechnology;
10+
11+
import entity.room.RoomID;
12+
13+
import java.util.Objects;
14+
import java.util.Optional;
15+
16+
/**
17+
* Describe a medical technology used inside the operating block.
18+
*/
19+
public class MedicalTechnology {
20+
private final MedicalTechnologyID id;
21+
private final MedicalTechnologyType type;
22+
private final Optional<RoomID> roomID;
23+
24+
/**
25+
* Default constructor.
26+
* @param id the id.
27+
* @param type the type.
28+
* @param roomID the room id.
29+
*/
30+
public MedicalTechnology(final MedicalTechnologyID id, final MedicalTechnologyType type, final Optional<RoomID> roomID) {
31+
this.id = id;
32+
this.type = type;
33+
this.roomID = roomID;
34+
}
35+
36+
/**
37+
* Constructor of a medical technology that is not placed inside any room.
38+
* @param id the id.
39+
* @param type the type.
40+
*/
41+
public MedicalTechnology(final MedicalTechnologyID id, final MedicalTechnologyType type) {
42+
this(id, type, Optional.empty());
43+
}
44+
45+
/**
46+
* Get the id of the medical technology.
47+
* @return the id
48+
*/
49+
public MedicalTechnologyID getId() {
50+
return this.id;
51+
}
52+
53+
/**
54+
* Get the type of the medical technology.
55+
* @return the type
56+
*/
57+
public MedicalTechnologyType getType() {
58+
return this.type;
59+
}
60+
61+
/**
62+
* Get the room where the medical technology is currently placed.
63+
* @return the room id
64+
*/
65+
public Optional<RoomID> getRoomID() {
66+
return this.roomID;
67+
}
68+
69+
@Override
70+
public final boolean equals(final Object other) {
71+
if (this == other) {
72+
return true;
73+
}
74+
if (other == null || this.getClass() != other.getClass()) {
75+
return false;
76+
}
77+
final MedicalTechnology that = (MedicalTechnology) other;
78+
return this.getId().equals(that.getId());
79+
}
80+
81+
@Override
82+
public final int hashCode() {
83+
return Objects.hash(this.getId());
84+
}
85+
}

0 commit comments

Comments
 (0)