Skip to content

Commit f34f63b

Browse files
committed
review
1 parent c8ca64c commit f34f63b

File tree

6 files changed

+25
-35
lines changed

6 files changed

+25
-35
lines changed

src/main/java/edu/ie3/datamodel/io/extractor/HasEm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import java.util.Optional;
1010

1111
/**
12-
* Interface that should be implemented by all elements holding one or more {@link
12+
* Interface that should be implemented by all elements that can be controlled by {@link
1313
* edu.ie3.datamodel.models.input.EmInput} elements and should be processable by the {@link
1414
* Extractor}.
1515
*/

src/main/java/edu/ie3/datamodel/models/input/EmInput.java

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class EmInput extends AssetInput implements HasEm {
2121
* Optional UUID of the parent {@link EmInput} that is controlling this em unit. If null, this em
2222
* unit is not em-controlled.
2323
*/
24-
private final EmInput parentEm;
24+
private final EmInput controllingEm;
2525

2626
/**
2727
* Constructor for an operated energy management system
@@ -31,18 +31,18 @@ public class EmInput extends AssetInput implements HasEm {
3131
* @param operator of the asset
3232
* @param operationTime time for which the entity is operated
3333
* @param emControlStrategy the control strategy
34-
* @param parentEm The {@link EmInput} controlling this em unit. Null, if not applicable.
34+
* @param controllingEm The {@link EmInput} controlling this em unit. Null, if not applicable.
3535
*/
3636
public EmInput(
3737
UUID uuid,
3838
String id,
3939
OperatorInput operator,
4040
OperationTime operationTime,
4141
String emControlStrategy,
42-
EmInput parentEm) {
42+
EmInput controllingEm) {
4343
super(uuid, id, operator, operationTime);
4444
this.controlStrategy = emControlStrategy;
45-
this.parentEm = parentEm;
45+
this.controllingEm = controllingEm;
4646
}
4747

4848
/**
@@ -51,22 +51,18 @@ public EmInput(
5151
* @param uuid of the input entity
5252
* @param id of the asset
5353
* @param emControlStrategy the control strategy
54-
* @param parentEm The {@link EmInput} controlling this em unit. Null, if not applicable.
54+
* @param controllingEm The {@link EmInput} controlling this em unit. Null, if not applicable.
5555
*/
56-
public EmInput(UUID uuid, String id, String emControlStrategy, EmInput parentEm) {
56+
public EmInput(UUID uuid, String id, String emControlStrategy, EmInput controllingEm) {
5757
super(uuid, id);
5858
this.controlStrategy = emControlStrategy;
59-
this.parentEm = parentEm;
59+
this.controllingEm = controllingEm;
6060
}
6161

6262
public String getControlStrategy() {
6363
return controlStrategy;
6464
}
6565

66-
public Optional<EmInput> getParentEm() {
67-
return Optional.ofNullable(parentEm);
68-
}
69-
7066
@Override
7167
public EmInputCopyBuilder copy() {
7268
return new EmInputCopyBuilder(this);
@@ -78,12 +74,12 @@ public boolean equals(Object o) {
7874
if (!(o instanceof EmInput emInput)) return false;
7975
if (!super.equals(o)) return false;
8076
return Objects.equals(controlStrategy, emInput.controlStrategy)
81-
&& Objects.equals(parentEm, emInput.parentEm);
77+
&& Objects.equals(controllingEm, emInput.controllingEm);
8278
}
8379

8480
@Override
8581
public int hashCode() {
86-
return Objects.hash(super.hashCode(), controlStrategy, parentEm);
82+
return Objects.hash(super.hashCode(), controlStrategy, controllingEm);
8783
}
8884

8985
@Override
@@ -100,13 +96,13 @@ public String toString() {
10096
+ ", controlStrategy="
10197
+ getControlStrategy()
10298
+ ", parentEm="
103-
+ getParentEm().map(UniqueEntity::getUuid).map(UUID::toString).orElse("")
99+
+ getControllingEm().map(UniqueEntity::getUuid).map(UUID::toString).orElse("")
104100
+ "}";
105101
}
106102

107103
@Override
108104
public Optional<EmInput> getControllingEm() {
109-
return Optional.ofNullable(parentEm);
105+
return Optional.ofNullable(controllingEm);
110106
}
111107

112108
public static class EmInputCopyBuilder extends AssetInputCopyBuilder<EmInputCopyBuilder> {
@@ -118,7 +114,7 @@ public static class EmInputCopyBuilder extends AssetInputCopyBuilder<EmInputCopy
118114
protected EmInputCopyBuilder(EmInput entity) {
119115
super(entity);
120116
this.controlStrategy = entity.getControlStrategy();
121-
this.parentEm = entity.parentEm;
117+
this.parentEm = entity.controllingEm;
122118
}
123119

124120
public EmInputCopyBuilder controlStrategy(String controlStrategy) {

src/main/java/edu/ie3/datamodel/models/input/system/SystemParticipantInput.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@ public ReactivePowerCharacteristic getqCharacteristics() {
8585
return qCharacteristics;
8686
}
8787

88-
/*
89-
public Optional<EmInput> getEm() {
90-
return Optional.ofNullable(em);
91-
}
92-
*/
93-
9488
@Override
9589
public List<NodeInput> allNodes() {
9690
return Collections.singletonList(node);
@@ -134,7 +128,7 @@ public String toString() {
134128
+ node.getUuid()
135129
+ ", qCharacteristics='"
136130
+ qCharacteristics
137-
+ "', em="
131+
+ "', controllingEm="
138132
+ getControllingEm().map(UniqueEntity::getUuid).map(UUID::toString).orElse("")
139133
+ '}';
140134
}

src/test/groovy/edu/ie3/datamodel/io/extractor/ExtractorTest.groovy

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ExtractorTest extends Specification {
5858
sptd.fixedFeedInInput.operator,
5959
sptd.fixedFeedInInput.node.operator,
6060
sptd.fixedFeedInInput.controllingEm.get(),
61-
sptd.fixedFeedInInput.controllingEm.get().parentEm.get()
61+
sptd.fixedFeedInInput.controllingEm.get().controllingEm.get()
6262
]
6363

6464
sptd.wecInput || [
@@ -67,7 +67,7 @@ class ExtractorTest extends Specification {
6767
sptd.wecInput.operator,
6868
sptd.wecInput.node.operator,
6969
sptd.wecInput.controllingEm.get(),
70-
sptd.wecInput.controllingEm.get().parentEm.get()
70+
sptd.wecInput.controllingEm.get().controllingEm.get()
7171
]
7272
sptd.chpInput || [
7373
sptd.chpInput.node,
@@ -78,31 +78,31 @@ class ExtractorTest extends Specification {
7878
sptd.chpInput.thermalStorage.thermalBus,
7979
sptd.chpInput.thermalStorage.thermalBus.operator,
8080
sptd.chpInput.controllingEm.get(),
81-
sptd.chpInput.controllingEm.get().parentEm.get()
81+
sptd.chpInput.controllingEm.get().controllingEm.get()
8282
]
8383
sptd.bmInput || [
8484
sptd.bmInput.node,
8585
sptd.bmInput.type,
8686
sptd.bmInput.operator,
8787
sptd.bmInput.node.operator,
8888
sptd.bmInput.controllingEm.get(),
89-
sptd.bmInput.controllingEm.get().parentEm.get()
89+
sptd.bmInput.controllingEm.get().controllingEm.get()
9090
]
9191
sptd.evInput || [
9292
sptd.evInput.node,
9393
sptd.evInput.type,
9494
sptd.evInput.operator,
9595
sptd.evInput.node.operator,
9696
sptd.evInput.controllingEm.get(),
97-
sptd.evInput.controllingEm.get().parentEm.get()
97+
sptd.evInput.controllingEm.get().controllingEm.get()
9898
]
9999
sptd.storageInput || [
100100
sptd.storageInput.node,
101101
sptd.storageInput.type,
102102
sptd.storageInput.operator,
103103
sptd.storageInput.node.operator,
104104
sptd.storageInput.controllingEm.get(),
105-
sptd.storageInput.controllingEm.get().parentEm.get()
105+
sptd.storageInput.controllingEm.get().controllingEm.get()
106106
]
107107
sptd.hpInput || [
108108
sptd.hpInput.node,
@@ -112,7 +112,7 @@ class ExtractorTest extends Specification {
112112
sptd.hpInput.thermalBus.operator,
113113
sptd.hpInput.node.operator,
114114
sptd.hpInput.controllingEm.get(),
115-
sptd.hpInput.controllingEm.get().parentEm.get()
115+
sptd.hpInput.controllingEm.get().controllingEm.get()
116116
]
117117

118118
gtd.lineGraphicCtoD || [
@@ -168,7 +168,7 @@ class ExtractorTest extends Specification {
168168
sptd.fixedFeedInInput.node,
169169
sptd.fixedFeedInInput.node.operator,
170170
sptd.fixedFeedInInput.controllingEm.get(),
171-
sptd.fixedFeedInInput.controllingEm.get().parentEm.get(),
171+
sptd.fixedFeedInInput.controllingEm.get().controllingEm.get(),
172172
sptd.fixedFeedInInput.controllingEm.get().operator
173173
] as Set
174174
}

src/test/groovy/edu/ie3/datamodel/io/factory/input/participant/EmInputFactoryTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class EmInputFactoryTest extends Specification {
5555
assert operator == operatorInput
5656
assert id == parameter["id"]
5757
assert controlStrategy == parameter["controlstrategy"]
58-
assert parentEm == Optional.of(parentEmUnit)
58+
assert controllingEm == Optional.of(parentEmUnit)
5959
}
6060
}
6161

@@ -88,7 +88,7 @@ class EmInputFactoryTest extends Specification {
8888
assert operator == operatorInput
8989
assert id == parameter["id"]
9090
assert controlStrategy == parameter["controlstrategy"]
91-
assert parentEm == Optional.empty()
91+
assert controllingEm == Optional.empty()
9292
}
9393
}
9494

src/test/groovy/edu/ie3/datamodel/models/input/system/EmInputTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class EmInputTest extends Specification {
8686
assert operator == emInput.operator
8787
assert id == emInput.id
8888
assert controlStrategy == newStrat
89-
assert parentEm == Optional.of(givenParentEm)
89+
assert controllingEm == Optional.of(givenParentEm)
9090
}
9191
}
9292
}

0 commit comments

Comments
 (0)