-
Notifications
You must be signed in to change notification settings - Fork 5
/
ReactivePowerCharacteristic.java
60 lines (54 loc) · 2.07 KB
/
ReactivePowerCharacteristic.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
/*
* © 2021. 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.system.characteristic;
import edu.ie3.datamodel.exceptions.ParsingException;
import java.util.SortedSet;
import javax.measure.Unit;
import javax.measure.quantity.Dimensionless;
/** Abstract class (only for grouping all reactive power characteristics together */
public abstract class ReactivePowerCharacteristic
extends CharacteristicInput<Dimensionless, Dimensionless> {
protected ReactivePowerCharacteristic(
SortedSet<CharacteristicPoint<Dimensionless, Dimensionless>> characteristicPoints,
String prefix) {
super(characteristicPoints, prefix);
}
protected ReactivePowerCharacteristic(
String input,
Unit<Dimensionless> abscissaUnit,
Unit<Dimensionless> ordinateUnit,
String prefix)
throws ParsingException {
super(input, abscissaUnit, ordinateUnit, prefix);
}
/**
* Parses a given input to a valid reactive power characteristic, if it is recognized correctly.
* Otherwise, an IllegalArgumentException is thrown.
*
* @param input String to parse
* @return Matching reactive power characteristic
* @throws ParsingException If the given input cannot be mapped onto one of the known
* characteristics
*/
public static ReactivePowerCharacteristic parse(String input) throws ParsingException {
if (input.startsWith(CosPhiFixed.PREFIX + ":{")) return new CosPhiFixed(input);
else if (input.startsWith(CosPhiP.PREFIX + ":{")) return new CosPhiP(input);
else if (input.startsWith(QV.PREFIX + ":{")) return new QV(input);
else
throw new ParsingException(
"Cannot parse '"
+ input
+ "' to a reactive power characteristic, as it does not meet the specifications of any of the available classes.");
}
@Override
public boolean equals(Object o) {
return super.equals(o);
}
@Override
public int hashCode() {
return super.hashCode();
}
}