-
Notifications
You must be signed in to change notification settings - Fork 5
/
LineGraphicInput.java
93 lines (79 loc) · 2.54 KB
/
LineGraphicInput.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
/*
* © 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.graphics;
import edu.ie3.datamodel.io.extractor.HasLine;
import edu.ie3.datamodel.models.input.connector.LineInput;
import java.util.Objects;
import java.util.UUID;
import org.locationtech.jts.geom.LineString;
/**
* Describes the graphic data belonging to a {@link
* edu.ie3.datamodel.models.input.connector.LineInput}
*/
public class LineGraphicInput extends GraphicInput implements HasLine {
/** The LineInput to this graphic data */
private final LineInput line;
/**
* @param uuid of the input entity
* @param graphicLayer Description of the graphic layer, this graphic is located on
* @param path A graphic representation as path
* @param line The LineInput to this graphic data
*/
public LineGraphicInput(UUID uuid, String graphicLayer, LineString path, LineInput line) {
super(uuid, graphicLayer, path);
this.line = line;
}
@Override
public LineInput getLine() {
return line;
}
public LineGraphicInputCopyBuilder copy() {
return new LineGraphicInputCopyBuilder(this);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof LineGraphicInput that)) return false;
if (!super.equals(o)) return false;
return line.equals(that.line);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), line);
}
@Override
public String toString() {
return "LineGraphicInput{" + "uuid=" + getUuid() + ", line=" + line.getUuid() + '}';
}
/**
* A builder pattern based approach to create copies of {@link LineGraphicInput} entities with
* altered field values. For detailed field descriptions refer to java docs of {@link
* LineGraphicInput}
*
* @version 0.1
* @since 05.06.20
*/
public static class LineGraphicInputCopyBuilder
extends GraphicInputCopyBuilder<LineGraphicInputCopyBuilder> {
private LineInput line;
private LineGraphicInputCopyBuilder(LineGraphicInput entity) {
super(entity);
this.line = entity.getLine();
}
@Override
protected LineGraphicInputCopyBuilder thisInstance() {
return this;
}
@Override
public LineGraphicInput build() {
return new LineGraphicInput(getUuid(), getGraphicLayer(), getPath(), line);
}
public LineGraphicInputCopyBuilder line(LineInput line) {
this.line = line;
return this;
}
}
}