-
Notifications
You must be signed in to change notification settings - Fork 5
/
EmInput.java
139 lines (119 loc) · 3.77 KB
/
EmInput.java
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/*
* © 2022. TU Dortmund University,
* Institute of Energy Systems, Energy Efficiency and Energy Economics,
* Research group Distribution grid planning and operation
*/
package edu.ie3.datamodel.models.input;
import edu.ie3.datamodel.models.OperationTime;
import edu.ie3.datamodel.models.UniqueEntity;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
public class EmInput extends AssetInput {
/** Reference to the control strategy to be used for this model */
private final String controlStrategy;
/**
* Optional UUID of the parent {@link EmInput} that is controlling this em unit. If null, this em
* unit is not em-controlled.
*/
private final EmInput parentEm;
/**
* Constructor for an operated energy management system
*
* @param uuid of the input entity
* @param id of the asset
* @param operator of the asset
* @param operationTime time for which the entity is operated
* @param emControlStrategy the control strategy
* @param parentEm The {@link EmInput} controlling this em unit. Null, if not applicable.
*/
public EmInput(
UUID uuid,
String id,
OperatorInput operator,
OperationTime operationTime,
String emControlStrategy,
EmInput parentEm) {
super(uuid, id, operator, operationTime);
this.controlStrategy = emControlStrategy;
this.parentEm = parentEm;
}
/**
* Constructor for an operated energy management system
*
* @param uuid of the input entity
* @param id of the asset
* @param emControlStrategy the control strategy
* @param parentEm The {@link EmInput} controlling this em unit. Null, if not applicable.
*/
public EmInput(UUID uuid, String id, String emControlStrategy, EmInput parentEm) {
super(uuid, id);
this.controlStrategy = emControlStrategy;
this.parentEm = parentEm;
}
public String getControlStrategy() {
return controlStrategy;
}
public Optional<EmInput> getParentEm() {
return Optional.ofNullable(parentEm);
}
@Override
public EmInputCopyBuilder copy() {
return new EmInputCopyBuilder(this);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof EmInput emInput)) return false;
if (!super.equals(o)) return false;
return Objects.equals(controlStrategy, emInput.controlStrategy)
&& Objects.equals(parentEm, emInput.parentEm);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), controlStrategy, parentEm);
}
@Override
public String toString() {
return "EmInput{"
+ "uuid="
+ getUuid()
+ ", id='"
+ getId()
+ ", operator="
+ getOperator().getUuid()
+ ", operationTime="
+ getOperationTime()
+ ", controlStrategy="
+ getControlStrategy()
+ ", parentEm="
+ getParentEm().map(UniqueEntity::getUuid).map(UUID::toString).orElse("")
+ '}';
}
public static class EmInputCopyBuilder extends AssetInputCopyBuilder<EmInputCopyBuilder> {
private String controlStrategy;
private EmInput parentEm;
protected EmInputCopyBuilder(EmInput entity) {
super(entity);
this.controlStrategy = entity.getControlStrategy();
this.parentEm = entity.parentEm;
}
public EmInputCopyBuilder controlStrategy(String controlStrategy) {
this.controlStrategy = controlStrategy;
return this;
}
public EmInputCopyBuilder parentEm(EmInput parentEm) {
this.parentEm = parentEm;
return thisInstance();
}
@Override
public EmInput build() {
return new EmInput(
getUuid(), getId(), getOperator(), getOperationTime(), controlStrategy, parentEm);
}
@Override
protected EmInputCopyBuilder thisInstance() {
return this;
}
}
}