Skip to content

Commit

Permalink
Catch up changes on further files
Browse files Browse the repository at this point in the history
  • Loading branch information
ckittl committed Jan 6, 2022
1 parent a862eb5 commit 7bc434f
Show file tree
Hide file tree
Showing 23 changed files with 80 additions and 83 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Use enhanced switch statements
- Replace lambdas with method references
- Use `Stream#toList`
- Adapt visibility for JUnit 5
- Fix JavaDoc creation
- Create JavaDoc with java 17 instead of java 8
- Let JavDoc pass, if there are warnings **ATTENTION:** Should be removed, when JavaDoc is fixed! (cf. Issue [#494](https://github.com/ie3-institute/PowerSystemDataModel/issues/494))
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/edu/ie3/datamodel/models/OperationTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public Optional<ClosedInterval<ZonedDateTime>> getOperationLimit() {
*/
public boolean includes(ZonedDateTime date) {
Optional<ClosedInterval<ZonedDateTime>> optOperationTime = getOperationLimit();
return !optOperationTime.isPresent() || optOperationTime.get().includes(date);
return optOperationTime.isEmpty() || optOperationTime.get().includes(date);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,33 +85,33 @@ public RawGridElements(List<AssetInput> rawGridElements) {
/* init sets */
this.nodes =
rawGridElements.parallelStream()
.filter(gridElement -> gridElement instanceof NodeInput)
.map(nodeInput -> (NodeInput) nodeInput)
.filter(NodeInput.class::isInstance)
.map(NodeInput.class::cast)
.collect(Collectors.toSet());
this.lines =
rawGridElements.parallelStream()
.filter(gridElement -> gridElement instanceof LineInput)
.map(lineInput -> (LineInput) lineInput)
.filter(LineInput.class::isInstance)
.map(LineInput.class::cast)
.collect(Collectors.toSet());
this.transformer2Ws =
rawGridElements.parallelStream()
.filter(gridElement -> gridElement instanceof Transformer2WInput)
.map(trafo2wInput -> (Transformer2WInput) trafo2wInput)
.filter(Transformer2WInput.class::isInstance)
.map(Transformer2WInput.class::cast)
.collect(Collectors.toSet());
this.transformer3Ws =
rawGridElements.parallelStream()
.filter(gridElement -> gridElement instanceof Transformer3WInput)
.map(trafo3wInput -> (Transformer3WInput) trafo3wInput)
.filter(Transformer3WInput.class::isInstance)
.map(Transformer3WInput.class::cast)
.collect(Collectors.toSet());
this.switches =
rawGridElements.parallelStream()
.filter(gridElement -> gridElement instanceof SwitchInput)
.map(switchInput -> (SwitchInput) switchInput)
.filter(SwitchInput.class::isInstance)
.map(SwitchInput.class::cast)
.collect(Collectors.toSet());
this.measurementUnits =
rawGridElements.parallelStream()
.filter(gridElement -> gridElement instanceof MeasurementUnitInput)
.map(measurementUnitInput -> (MeasurementUnitInput) measurementUnitInput)
.filter(MeasurementUnitInput.class::isInstance)
.map(MeasurementUnitInput.class::cast)
.collect(Collectors.toSet());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,53 +107,53 @@ public SystemParticipants(List<SystemParticipantInput> systemParticipants) {
/* init sets */
this.bmPlants =
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof BmInput)
.map(bmInput -> (BmInput) bmInput)
.filter(BmInput.class::isInstance)
.map(BmInput.class::cast)
.collect(Collectors.toSet());
this.chpPlants =
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof ChpInput)
.map(chpInput -> (ChpInput) chpInput)
.filter(ChpInput.class::isInstance)
.map(ChpInput.class::cast)
.collect(Collectors.toSet());
this.evCS =
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof EvcsInput)
.map(evcsInput -> (EvcsInput) evcsInput)
.filter(EvcsInput.class::isInstance)
.map(EvcsInput.class::cast)
.collect(Collectors.toSet());
this.evs =
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof EvInput)
.map(evInput -> (EvInput) evInput)
.filter(EvInput.class::isInstance)
.map(EvInput.class::cast)
.collect(Collectors.toSet());
this.fixedFeedIns =
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof FixedFeedInInput)
.map(fixedFeedInInpu -> (FixedFeedInInput) fixedFeedInInpu)
.filter(FixedFeedInInput.class::isInstance)
.map(FixedFeedInInput.class::cast)
.collect(Collectors.toSet());
this.heatPumps =
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof HpInput)
.map(hpInput -> (HpInput) hpInput)
.filter(HpInput.class::isInstance)
.map(HpInput.class::cast)
.collect(Collectors.toSet());
this.loads =
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof LoadInput)
.map(loadInput -> (LoadInput) loadInput)
.filter(LoadInput.class::isInstance)
.map(LoadInput.class::cast)
.collect(Collectors.toSet());
this.pvPlants =
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof PvInput)
.map(pvInput -> (PvInput) pvInput)
.filter(PvInput.class::isInstance)
.map(PvInput.class::cast)
.collect(Collectors.toSet());
this.storages =
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof StorageInput)
.map(storageInput -> (StorageInput) storageInput)
.filter(StorageInput.class::isInstance)
.map(StorageInput.class::cast)
.collect(Collectors.toSet());
this.wecPlants =
systemParticipants.parallelStream()
.filter(gridElement -> gridElement instanceof WecInput)
.map(wecInput -> (WecInput) wecInput)
.filter(WecInput.class::isInstance)
.map(WecInput.class::cast)
.collect(Collectors.toSet());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public abstract class GraphicInput extends InputEntity {
* @param graphicLayer Description of the graphic layer, this graphic is located on
* @param path A graphic representation as path
*/
public GraphicInput(UUID uuid, String graphicLayer, LineString path) {
protected GraphicInput(UUID uuid, String graphicLayer, LineString path) {
super(uuid);
this.graphicLayer = graphicLayer;
this.path =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
/** Abstract class (only for grouping all reactive power characteristics together */
public abstract class ReactivePowerCharacteristic
extends CharacteristicInput<Dimensionless, Dimensionless> {
public ReactivePowerCharacteristic(
protected ReactivePowerCharacteristic(
SortedSet<CharacteristicPoint<Dimensionless, Dimensionless>> characteristicPoints,
String prefix,
int decimalPlaces) {
super(characteristicPoints, prefix, decimalPlaces);
}

public ReactivePowerCharacteristic(
protected ReactivePowerCharacteristic(
String input,
Unit<Dimensionless> abscissaUnit,
Unit<Dimensionless> ordinateUnit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public abstract class SystemParticipantTypeInput extends AssetTypeInput {
* @param sRated Rated apparent power
* @param cosPhiRated Power factor for this type of system participant
*/
public SystemParticipantTypeInput(
protected SystemParticipantTypeInput(
UUID uuid,
String id,
ComparableQuantity<Currency> capex,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public abstract class ResultEntity extends UniqueEntity {
* @param time date and time when the result is produced
* @param inputModel uuid of the input model that produces the result
*/
public ResultEntity(ZonedDateTime time, UUID inputModel) {
protected ResultEntity(ZonedDateTime time, UUID inputModel) {
super();
this.time = time;
this.inputModel = inputModel;
Expand All @@ -38,7 +38,7 @@ public ResultEntity(ZonedDateTime time, UUID inputModel) {
* @param time date and time when the result is produced
* @param inputModel uuid of the input model that produces the result
*/
public ResultEntity(UUID uuid, ZonedDateTime time, UUID inputModel) {
protected ResultEntity(UUID uuid, ZonedDateTime time, UUID inputModel) {
super(uuid);
this.time = time;
this.inputModel = inputModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public abstract class ConnectorResult extends ResultEntity {
* @param iBMag electric current magnitude @ port B, normally provided in Ampere
* @param iBAng electric current angle @ Port B in degree
*/
public ConnectorResult(
protected ConnectorResult(
ZonedDateTime time,
UUID inputModel,
ComparableQuantity<ElectricCurrent> iAMag,
Expand All @@ -64,7 +64,7 @@ public ConnectorResult(
* @param iBMag electric current magnitude @ port B, normally provided in Ampere
* @param iBAng electric current angle @ Port B in degree
*/
public ConnectorResult(
protected ConnectorResult(
UUID uuid,
ZonedDateTime time,
UUID inputModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public abstract class TransformerResult extends ConnectorResult {
* @param iBAng electric current angle @ Port B in degree
* @param tapPos the current position of the transformers tap changer
*/
public TransformerResult(
protected TransformerResult(
ZonedDateTime time,
UUID inputModel,
ComparableQuantity<ElectricCurrent> iAMag,
Expand All @@ -55,7 +55,7 @@ public TransformerResult(
* @param iBAng electric current angle @ Port B in degree
* @param tapPos the current position of the transformers tap changer
*/
public TransformerResult(
protected TransformerResult(
UUID uuid,
ZonedDateTime time,
UUID inputModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public abstract class ElectricalEnergyStorageResult extends SystemParticipantRes
/** State of Charge (SoC) in % */
private final ComparableQuantity<Dimensionless> soc;

public ElectricalEnergyStorageResult(
protected ElectricalEnergyStorageResult(
ZonedDateTime time,
UUID inputModel,
ComparableQuantity<Power> p,
Expand All @@ -29,7 +29,7 @@ public ElectricalEnergyStorageResult(
this.soc = soc.to(StandardUnits.SOC);
}

public ElectricalEnergyStorageResult(
protected ElectricalEnergyStorageResult(
UUID uuid,
ZonedDateTime time,
UUID inputModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public abstract class SystemParticipantResult extends ResultEntity {
* @param p active power output normally provided in MW
* @param q reactive power output normally provided in MVAr
*/
public SystemParticipantResult(
protected SystemParticipantResult(
ZonedDateTime time,
UUID inputModel,
ComparableQuantity<Power> p,
Expand All @@ -45,7 +45,7 @@ public SystemParticipantResult(
* @param p active power output normally provided in MW
* @param q reactive power output normally provided in MVAr
*/
public SystemParticipantResult(
protected SystemParticipantResult(
UUID uuid,
ZonedDateTime time,
UUID inputModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public abstract class SystemParticipantWithHeatResult extends SystemParticipantR
* @param q reactive power output normally provided in MVAr
* @param qDot thermal power output normally provided in MW
*/
public SystemParticipantWithHeatResult(
protected SystemParticipantWithHeatResult(
ZonedDateTime time,
UUID inputModel,
ComparableQuantity<Power> p,
Expand All @@ -42,7 +42,7 @@ public SystemParticipantWithHeatResult(
* @param q reactive power output normally provided in MVAr
* @param qDot thermal power output normally provided in MW
*/
public SystemParticipantWithHeatResult(
protected SystemParticipantWithHeatResult(
UUID uuid,
ZonedDateTime time,
UUID inputModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public abstract class ThermalSinkResult extends ThermalUnitResult {
* @param inputModel uuid of the input model that produces the result
* @param qDot thermal heat demand of the sink
*/
public ThermalSinkResult(ZonedDateTime time, UUID inputModel, ComparableQuantity<Power> qDot) {
protected ThermalSinkResult(ZonedDateTime time, UUID inputModel, ComparableQuantity<Power> qDot) {
super(time, inputModel, qDot);
}

Expand All @@ -36,7 +36,7 @@ public ThermalSinkResult(ZonedDateTime time, UUID inputModel, ComparableQuantity
* @param inputModel uuid of the input model that produces the result
* @param qDot thermal heat demand of the sink
*/
public ThermalSinkResult(
protected ThermalSinkResult(
UUID uuid, ZonedDateTime time, UUID inputModel, ComparableQuantity<Power> qDot) {
super(uuid, time, inputModel, qDot);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public abstract class ThermalStorageResult extends ThermalUnitResult {
* @param energy Currently stored energy
* @param qDot Heat power flowing into (&gt; 0) or coming from (&lt; 0) the storage
*/
public ThermalStorageResult(
protected ThermalStorageResult(
ZonedDateTime time,
UUID inputModel,
ComparableQuantity<Energy> energy,
Expand All @@ -48,7 +48,7 @@ public ThermalStorageResult(
* @param energy Currently stored energy
* @param qDot Heat power flowing into (&gt; 0) or coming from (&lt; 0) the storage
*/
public ThermalStorageResult(
protected ThermalStorageResult(
UUID uuid,
ZonedDateTime time,
UUID inputModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public abstract class ThermalUnitResult extends ResultEntity {
* @param inputModel The input model's UUID, the result is related to
* @param qDot Average thermal power exchanged with the unit
*/
public ThermalUnitResult(ZonedDateTime time, UUID inputModel, ComparableQuantity<Power> qDot) {
protected ThermalUnitResult(ZonedDateTime time, UUID inputModel, ComparableQuantity<Power> qDot) {
super(time, inputModel);
this.qDot = qDot;
}
Expand All @@ -42,7 +42,7 @@ public ThermalUnitResult(ZonedDateTime time, UUID inputModel, ComparableQuantity
* @param inputModel The input model's UUID, the result is related to
* @param qDot Average thermal power exchanged with the unit
*/
public ThermalUnitResult(
protected ThermalUnitResult(
UUID uuid, ZonedDateTime time, UUID inputModel, ComparableQuantity<Power> qDot) {
super(uuid, time, inputModel);
this.qDot = qDot;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
public abstract class TimeSeriesEntry<V extends Value> extends UniqueEntity {
protected final V value;

public TimeSeriesEntry(UUID uuid, V value) {
protected TimeSeriesEntry(UUID uuid, V value) {
super(uuid);
this.value = value;
}

public TimeSeriesEntry(V value) {
protected TimeSeriesEntry(V value) {
this(UUID.randomUUID(), value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
/** Describes a TimeSeries with repetitive values that can be calculated from a pattern */
public abstract class RepetitiveTimeSeries<E extends TimeSeriesEntry<V>, V extends Value>
extends TimeSeries<E, V> {
public RepetitiveTimeSeries(Set<E> entries) {
protected RepetitiveTimeSeries(Set<E> entries) {
super(entries);
}

public RepetitiveTimeSeries(UUID uuid, Set<E> entries) {
protected RepetitiveTimeSeries(UUID uuid, Set<E> entries) {
super(uuid, entries);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ private ContainerNodeUpdateUtil() {
*/
public static GridContainer updateGridWithNodes(
GridContainer grid, Map<NodeInput, NodeInput> oldToNewNodes) {
if (grid instanceof JointGridContainer) {
return updateGridWithNodes((JointGridContainer) grid, oldToNewNodes);
if (grid instanceof JointGridContainer jointGridContainer) {
return updateGridWithNodes(jointGridContainer, oldToNewNodes);
} else {
return updateGridWithNodes((SubGridContainer) grid, oldToNewNodes);
}
Expand Down Expand Up @@ -216,7 +216,7 @@ private static SystemParticipants updateSystemParticipantsWithNodes(
return sysPart;
}
})
.collect(Collectors.toList());
.toList();
return new SystemParticipants(sysParts);
}

Expand Down

0 comments on commit 7bc434f

Please sign in to comment.