Skip to content

Commit 7e621a7

Browse files
committed
Merge remote-tracking branch 'origin/ms/#642-find-and-add-standard-asset-types' into ms/#642-find-and-add-standard-asset-types
2 parents 499fefa + 47046c8 commit 7e621a7

24 files changed

+127
-144
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8787
### Changed
8888
- Writers used to write time series are closed right away
8989
- Changed class name in FlexOptionsResult.toString [#693](https://github.com/ie3-institute/PowerSystemDataModel/issues/693)
90+
- Deleted parameter decimalPlaces and changed naming of serialization method [#710](https://github.com/ie3-institute/PowerSystemDataModel/issues/710)
9091

9192
## [2.0.1] - 2021-07-08
9293

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
id 'maven-publish'
55
id 'signing'
66
id 'pmd' // code check, working on source code
7-
id 'com.diffplug.spotless' version '6.12.0'//code format
7+
id 'com.diffplug.spotless' version '6.13.0'//code format
88
id 'com.github.spotbugs' version '5.0.13' // code check, working on byte code
99
id 'de.undercouch.download' version '5.3.0'
1010
id 'kr.motd.sphinx' version '2.10.1' // documentation generation
@@ -73,10 +73,10 @@ dependencies {
7373
implementation 'org.jgrapht:jgrapht-core:1.5.1'
7474

7575
// testing
76-
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.1'
76+
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
7777
testImplementation 'org.spockframework:spock-core:2.3-groovy-3.0'
7878
testImplementation 'org.objenesis:objenesis:3.3' // Mock creation with constructor parameters
79-
testImplementation 'net.bytebuddy:byte-buddy:1.12.19' // Mocks of classes
79+
testImplementation 'net.bytebuddy:byte-buddy:1.12.22' // Mocks of classes
8080

8181
// testcontainers (docker framework for testing)
8282
testImplementation "org.testcontainers:testcontainers:$testcontainersVersion"
@@ -93,7 +93,7 @@ dependencies {
9393

9494
// Databases
9595
implementation 'org.influxdb:influxdb-java:2.23'
96-
implementation 'com.couchbase.client:java-client:3.4.1'
96+
implementation 'com.couchbase.client:java-client:3.4.2'
9797
runtimeOnly 'org.postgresql:postgresql:42.5.1' // postgresql jdbc driver required during runtime
9898

9999
implementation 'commons-io:commons-io:2.11.0' // I/O functionalities

docs/readthedocs/io/csvfiles.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ However, note that this hierarchy is only meant to be used in conjunction with i
194194
The class :code:`DefaultInputHierarchy` offers some helpful methods to validate and create a default input file
195195
hierarchy.
196196

197-
De-Serialization (loading models)
197+
De-serialization (loading models)
198198
=================================
199199
Having an instance of :ref:`Grid Container<grid_container_model>` is most of the time the target whenever you load your
200200
grid. It consists of the three main blocks:

docs/uml/main/input/CharacteristicDatamodelConcept.puml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ package models {
3333
+ {static} REQUIRED_FORMAT: String
3434
- x: ComparableQuantity<A>
3535
- y: ComparableQuantity<O>
36-
+ deSerialize(int): String
36+
+ serialize(): String
3737
- {static} buildExceptionMessage(String): String
3838
- {static} buildExceptionMessage(String, String): String
3939
}
@@ -43,7 +43,7 @@ package models {
4343
# characteristicPrefix: String
4444
# decimalPlaces: int
4545
# points: SortedSet<CharacteristicPoint<A,O>>
46-
+ deSerialize(): String
46+
+ serialize(): String
4747
+ {static} buildStartingRegex(String): String
4848
- extractCoordinateList(String): String
4949
- buildCoordinatesFromString(String, Unit<A>, Unit<O>): SortedSet<CharacteristicPoint<A, O>>

src/main/java/edu/ie3/datamodel/io/connectors/CsvFileConnector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ CsvFileDefinition buildFileDefinition(T timeSeries, String[] headLineElements, S
333333
/**
334334
* Builds a new file definition consisting of file name and head line elements
335335
*
336-
* @param clz Class that is meant to be de-serialized into this file
336+
* @param clz Class that is meant to be serialized into this file
337337
* @param headLineElements Array of head line elements
338338
* @param csvSep Separator for csv columns
339339
* @return A suitable file definition

src/main/java/edu/ie3/datamodel/io/processor/EntityProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import org.slf4j.LoggerFactory;
1818

1919
/**
20-
* Internal API Interface for EntityProcessors. Main purpose is to 'de-serialize' models into a
20+
* Internal API Interface for EntityProcessors. Main purpose is to 'serialize' models into a
2121
* fieldName to value representation to allow for an easy processing into a database or file sink
2222
* e.g. .csv
2323
*
@@ -47,7 +47,7 @@ protected EntityProcessor(Class<? extends T> registeredClass) {
4747
/**
4848
* Standard call to handle an entity
4949
*
50-
* @param entity the entity that should be 'de-serialized' into a map of fieldName to fieldValue
50+
* @param entity the entity that should be 'serialized' into a map of fieldName to fieldValue
5151
* @return an optional Map with fieldName to fieldValue or an empty optional if an error occurred
5252
* during processing
5353
*/

src/main/java/edu/ie3/datamodel/io/processor/Processor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ protected String processMethodResult(Object methodReturnObject, Method method, S
279279
"QV",
280280
"ReactivePowerCharacteristic",
281281
"CharacteristicInput" -> resultStringBuilder.append(
282-
((CharacteristicInput<?, ?>) methodReturnObject).deSerialize());
282+
((CharacteristicInput<?, ?>) methodReturnObject).serialize());
283283
case "UUID[]" -> resultStringBuilder.append(processUUIDArray((UUID[]) methodReturnObject));
284284
case "ControlStrategy" -> resultStringBuilder.append(
285285
((ControlStrategy) methodReturnObject).getKey());

src/main/java/edu/ie3/datamodel/io/processor/result/ResultEntityProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
import javax.measure.quantity.Power;
2424

2525
/**
26-
* 'De-serializer' for {@link ResultEntity}s into a fieldName to value representation to allow for
27-
* an easy processing into a database or file sink e.g. .csv It is important that the units used in
26+
* 'Serializer' for {@link ResultEntity}s into a fieldName to value representation to allow for an
27+
* easy processing into a database or file sink e.g. .csv It is important that the units used in
2828
* this class are equal to the units used {@link SystemParticipantResultFactory} to prevent invalid
2929
* interpretation of unit prefixes!
3030
*

src/main/java/edu/ie3/datamodel/io/sink/CsvFileSink.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public CsvFileSink(
9292
* ProcessorProvider} by calling {@link ProcessorProvider#ProcessorProvider()}
9393
*
9494
* @param baseFolderPath the base folder path where the files should be put into
95-
* @param processorProvider the processor provided that should be used for entity de-serialization
95+
* @param processorProvider the processor provided that should be used for entity serialization
9696
* @param fileNamingStrategy the data sink file naming strategy that should be used
9797
* @param initFiles true if the files should be created during initialization (might create files,
9898
* that only consist of a headline, because no data will be written into them), false

src/main/java/edu/ie3/datamodel/models/input/system/characteristic/CharacteristicInput.java

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
public abstract class CharacteristicInput<A extends Quantity<A>, O extends Quantity<O>>
2222
implements Serializable {
2323
protected final String characteristicPrefix;
24-
protected final int decimalPlaces;
2524

2625
private final SortedSet<CharacteristicPoint<A, O>> points;
2726

@@ -30,24 +29,17 @@ public abstract class CharacteristicInput<A extends Quantity<A>, O extends Quant
3029
*
3130
* @param points Set of points that describe the characteristic
3231
* @param characteristicPrefix Prefix, that prepends the actual characteristic
33-
* @param decimalPlaces Desired amount of decimal places when de-serializing the characteristic
3432
*/
3533
protected CharacteristicInput(
36-
SortedSet<CharacteristicPoint<A, O>> points, String characteristicPrefix, int decimalPlaces) {
34+
SortedSet<CharacteristicPoint<A, O>> points, String characteristicPrefix) {
3735
this.points = Collections.unmodifiableSortedSet(points);
3836
this.characteristicPrefix = characteristicPrefix;
39-
this.decimalPlaces = decimalPlaces;
4037
}
4138

4239
protected CharacteristicInput(
43-
String input,
44-
Unit<A> abscissaUnit,
45-
Unit<O> ordinateUnit,
46-
String characteristicPrefix,
47-
int decimalPlaces)
40+
String input, Unit<A> abscissaUnit, Unit<O> ordinateUnit, String characteristicPrefix)
4841
throws ParsingException {
4942
this.characteristicPrefix = characteristicPrefix;
50-
this.decimalPlaces = decimalPlaces;
5143

5244
if (!input.startsWith(characteristicPrefix + ":{") || !input.endsWith("}"))
5345
throw new ParsingException(
@@ -114,31 +106,28 @@ public SortedSet<CharacteristicPoint<A, O>> getPoints() {
114106
}
115107

116108
/**
117-
* De-serialize the characteristic to a commonly understood string
109+
* Serialize the characteristic to a commonly understood string
118110
*
119-
* @return the characteristic as de-serialized string
111+
* @return the characteristic as serialized string
120112
*/
121-
public String deSerialize() {
113+
public String serialize() {
122114
return characteristicPrefix
123115
+ ":{"
124-
+ points.stream()
125-
.map(point -> point.deSerialize(decimalPlaces))
126-
.collect(Collectors.joining(","))
116+
+ points.stream().map(CharacteristicPoint::serialize).collect(Collectors.joining(","))
127117
+ "}";
128118
}
129119

130120
@Override
131121
public boolean equals(Object o) {
132122
if (this == o) return true;
133123
if (!(o instanceof CharacteristicInput<?, ?> that)) return false;
134-
return decimalPlaces == that.decimalPlaces
135-
&& characteristicPrefix.equals(that.characteristicPrefix)
136-
&& points.equals(that.points);
124+
125+
return characteristicPrefix.equals(that.characteristicPrefix) && points.equals(that.points);
137126
}
138127

139128
@Override
140129
public int hashCode() {
141-
return Objects.hash(characteristicPrefix, decimalPlaces, points);
130+
return Objects.hash(characteristicPrefix, points);
142131
}
143132

144133
@Override

0 commit comments

Comments
 (0)