]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.district.network.ui/src/org/simantics/district/network/ui/breakdown/Input.java
Add refresh to context menu in district network breakdown view
[simantics/district.git] / org.simantics.district.network.ui / src / org / simantics / district / network / ui / breakdown / Input.java
1 package org.simantics.district.network.ui.breakdown;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import org.simantics.databoard.util.Bean;
7 import org.simantics.db.Resource;
8
9 /**
10  * @author Tuukka Lehtonen
11  * @since 1.35.0
12  */
13 public class Input {
14
15     public static class NetworkDiagrams extends Bean {
16         public List<NetworkDiagram> diagrams = new ArrayList<>();
17
18         @Override
19         public int hashCode() {
20             final int prime = 31;
21             int result = super.hashCode();
22             result = prime * result + ((diagrams == null) ? 0 : diagrams.hashCode());
23             return result;
24         }
25
26         @Override
27         public boolean equals(Object obj) {
28             if (this == obj)
29                 return true;
30             if (!super.equals(obj))
31                 return false;
32             if (getClass() != obj.getClass())
33                 return false;
34             NetworkDiagrams other = (NetworkDiagrams) obj;
35             if (diagrams == null) {
36                 if (other.diagrams != null)
37                     return false;
38             } else if (!diagrams.equals(other.diagrams))
39                 return false;
40             return true;
41         }
42     }
43
44     public static class NetworkDiagram extends Bean {
45
46         public String name;
47         public Resource diagram;
48
49         public NetworkDiagram(String name, Resource diagram) {
50             this.name = name;
51             this.diagram = diagram;
52         }
53
54         @Override
55         public int hashCode() {
56             final int prime = 31;
57             int result = super.hashCode();
58             result = prime * result + ((diagram == null) ? 0 : diagram.hashCode());
59             result = prime * result + ((name == null) ? 0 : name.hashCode());
60             return result;
61         }
62
63         @Override
64         public boolean equals(Object obj) {
65             if (this == obj)
66                 return true;
67             if (!super.equals(obj))
68                 return false;
69             if (getClass() != obj.getClass())
70                 return false;
71             NetworkDiagram other = (NetworkDiagram) obj;
72             if (diagram == null) {
73                 if (other.diagram != null)
74                     return false;
75             } else if (!diagram.equals(other.diagram))
76                 return false;
77             if (name == null) {
78                 if (other.name != null)
79                     return false;
80             } else if (!name.equals(other.name))
81                 return false;
82             return true;
83         }
84     }
85
86     public static class Subgraph {
87         public NetworkDiagram parent;
88         public int index;
89         public List<Resource> vertices;
90         public List<Resource> edges;
91
92         public Subgraph(NetworkDiagram parent, int index, List<Resource> vertices, List<Resource> edges) {
93             this.parent = parent;
94             this.index = index;
95             this.vertices = vertices;
96             this.edges = edges;
97         }
98
99         @Override
100         public int hashCode() {
101             final int prime = 31;
102             int result = 1;
103             result = prime * result + ((edges == null) ? 0 : edges.hashCode());
104             result = prime * result + index;
105             result = prime * result + ((parent == null) ? 0 : parent.hashCode());
106             result = prime * result + ((vertices == null) ? 0 : vertices.hashCode());
107             return result;
108         }
109
110         @Override
111         public boolean equals(Object obj) {
112             if (this == obj)
113                 return true;
114             if (obj == null)
115                 return false;
116             if (getClass() != obj.getClass())
117                 return false;
118             Subgraph other = (Subgraph) obj;
119             if (edges == null) {
120                 if (other.edges != null)
121                     return false;
122             } else if (!edges.equals(other.edges))
123                 return false;
124             if (index != other.index)
125                 return false;
126             if (parent == null) {
127                 if (other.parent != null)
128                     return false;
129             } else if (!parent.equals(other.parent))
130                 return false;
131             if (vertices == null) {
132                 if (other.vertices != null)
133                     return false;
134             } else if (!vertices.equals(other.vertices))
135                 return false;
136             return true;
137         }
138     }
139
140 }