@@ -28,7 +28,7 @@ public class City2City implements Step {
2828 private Log log = LogFactory .getLog (this .getClass ());
2929 private List <OutputColor > PCKG_colors ;
3030 private List <OutputColor > NOS_colors ;
31- private HashMap <Long , double []> properties = new HashMap <Long , double [] >();
31+ private HashMap <Long , double []> properties = new HashMap <>();
3232 private DatabaseConnector connector = DatabaseConnector .getInstance ();
3333 private OutputFormat outputFormat ;
3434
@@ -95,9 +95,7 @@ public void run() {
9595 Node model = connector .executeRead ("MATCH (n:Model {building_type: \' " + buildingTypeAsString +
9696 "\' }) RETURN n" ).next ().get ("n" ).asNode ();
9797 if (buildingType == BuildingType .CITY_BRICKS || buildingType == BuildingType .CITY_PANELS ) {
98- connector .executeRead ("MATCH (n:Model:City)-[:CONTAINS*]->(m:BuildingSegment) RETURN m" ).forEachRemaining ((result ) -> {
99- setBuildingSegmentAttributes (result .get ("m" ).asNode ().id ());
100- });
98+ connector .executeRead ("MATCH (n:Model:City)-[:CONTAINS*]->(m:BuildingSegment) RETURN m" ).forEachRemaining ((result ) -> setBuildingSegmentAttributes (result .get ("m" ).asNode ().id ()));
10199 }
102100 int packageMaxLevel = connector .executeRead ("MATCH p=(n:District)-[:CONTAINS*]->(m:District) WHERE NOT (m)-[:CONTAINS]->(:District) RETURN length(p) AS length ORDER BY length(p) DESC LIMIT 1" ).
103101 single ().get ("length" ).asInt () + 1 ;
@@ -109,12 +107,8 @@ public void run() {
109107 NOS_colors = OutputColor .createColorGradient (classColorStart , classColorEnd , NOS_max + 1 );
110108 }
111109
112- connector .executeRead ("MATCH p=(n:Model:City)-[:CONTAINS*]->(m:District) RETURN p" ).forEachRemaining ((result ) -> {
113- setDistrictAttributes (result .get ("p" ).asPath ());
114- });
115- connector .executeRead ("MATCH (n:Model:City)-[:CONTAINS*]->(b:Building) RETURN b" ).forEachRemaining ((result ) -> {
116- setBuildingAttributes (result .get ("b" ).asNode ());
117- });
110+ connector .executeRead ("MATCH p=(n:Model:City)-[:CONTAINS*]->(m:District) RETURN p" ).forEachRemaining ((result ) -> setDistrictAttributes (result .get ("p" ).asPath ()));
111+ connector .executeRead ("MATCH (n:Model:City)-[:CONTAINS*]->(b:Building) RETURN b" ).forEachRemaining ((result ) -> setBuildingAttributes (result .get ("b" ).asNode ()));
118112 connector .executeRead ("MATCH (n:Model:City)-[:CONTAINS*]->(d:District)-[:VISUALIZES]->(element) RETURN d, element.hash as hash ORDER BY element.hash" ).forEachRemaining ((result ) -> {
119113 Node node = result .get ("d" ).asNode ();
120114 double width = node .get ("width" ).asDouble (0.0 );
@@ -139,14 +133,10 @@ public void run() {
139133 case CITY_BRICKS :
140134 BrickLayout .brickLayout (model .id ()); break ; // Layout for buildingSegments
141135 case CITY_PANELS :
142- connector .executeRead ("MATCH (n:Model:City)-[:CONTAINS*]->(b:Building) RETURN b" ).forEachRemaining ((result ) -> {
143- setBuildingSegmentPositions (result .get ("b" ).asNode ());
144- });
136+ connector .executeRead ("MATCH (n:Model:City)-[:CONTAINS*]->(b:Building) RETURN b" ).forEachRemaining ((result ) -> setBuildingSegmentPositions (result .get ("b" ).asNode ()));
145137 break ;
146138 case CITY_FLOOR :
147- connector .executeRead ("MATCH (n:Model:City)-[:CONTAINS*]->(b:Building) RETURN b" ).forEachRemaining ((result ) -> {
148- calculateSegments (result .get ("b" ).asNode ());
149- });
139+ connector .executeRead ("MATCH (n:Model:City)-[:CONTAINS*]->(b:Building) RETURN b" ).forEachRemaining ((result ) -> calculateSegments (result .get ("b" ).asNode ()));
150140 break ;
151141 default : {
152142 } // CityDebugUtils.infoEntities(cityRoot.document.entities, 0, true, true)
@@ -177,10 +167,10 @@ private void setBuildingAttributes(Node building) {
177167 }
178168
179169 private void setBuildingAttributesOriginal (Node building , int methodCounter , int dataCounter ) {
180- double width = 0.0 ;
181- double length = 0.0 ;
182- double height = 0.0 ;
183- String color = "" ;
170+ double width ;
171+ double length ;
172+ double height ;
173+ String color ;
184174 if (dataCounter == 0 ) {
185175 width = widthMin ;
186176 length = widthMin ;
@@ -202,16 +192,15 @@ private void setBuildingAttributesOriginal(Node building, int methodCounter, int
202192 }
203193
204194 private void setBuildingAttributesPanels (Node building , int methodCounter , int dataCounter ) {
205- double height = 0.0 ;
206- double width = 0.0 ;
207- double length = 0.0 ;
208- String color = "" ;
195+ double height ;
196+ double width ;
197+ double length ;
209198 if (showBuildingBase ) {
210199 height = heightMin ;
211200 } else {
212201 height = 0 ;
213202 }
214- int areaUnit = 1 ;
203+ int areaUnit ;
215204 if (classElementsMode == ClassElementsModes .ATTRIBUTES_ONLY ) {
216205 areaUnit = methodCounter ;
217206 } else {
@@ -235,17 +224,11 @@ private String asPercentage(Color color) {
235224 return r + " " + g + " " + b ;
236225 }
237226
238- private String asPercentage (String color ) {
239- Color c = Color .decode (color );
240- return asPercentage (c );
241- }
242-
243227 private void setBuildingAttributesBricks (Node building , int methodCounter , int dataCounter ) {
244- double height = 0.0 ;
245- double width = 0.0 ;
246- double length = 0.0 ;
247- int sideCapacity = 0 ;
248- String color = "" ;
228+ double height ;
229+ double width ;
230+ int sideCapacity ;
231+ String color ;
249232 if (showBuildingBase ) {
250233 height = heightMin ;
251234 } else {
@@ -280,18 +263,17 @@ private void setBuildingAttributesBricks(Node building, int methodCounter, int d
280263 }
281264 width = brickSize * sideCapacity + brickHorizontalMargin * 2 +
282265 brickHorizontalGap * (sideCapacity - 1 );
283- length = brickSize * sideCapacity + brickHorizontalMargin * 2 +
284- brickHorizontalGap * (sideCapacity - 1 );
266+ double length = brickSize * sideCapacity + brickHorizontalMargin * 2 +
267+ brickHorizontalGap * (sideCapacity - 1 );
285268 connector .executeWrite (
286269 cypherSetBuildingSegmentAttributes (building .id (), width , length , height , color ) + ", n.sideCapacity = " +
287270 sideCapacity );
288271 }
289272
290273 private void setBuildingAttributesFloors (Node building , int methodCounter , int dataCounter ) {
291- double width = 0.0 ;
292- double length = 0.0 ;
293- double height = 0.0 ;
294- String color = "" ;
274+ double width ;
275+ double length ;
276+ double height ;
295277 if (dataCounter < 2 ) { // pko 2016
296278 width = 2 ; // TODO in settings datei aufnehmen
297279 length = 2 ;
@@ -330,14 +312,14 @@ private void setBuildingSegmentAttributesPanels(Long segment) {
330312 List <Node > childsA = connector .executeRead (
331313 "MATCH (s)-[:CONTAINS]->(child)-[r:VISUALIZES]->(e:Field) WHERE ID(s) = " + parent +
332314 " AND NOT (e)<-[:DECLARES]-(:Enum) RETURN e" ).stream ().map (s -> s .get ("e" ).asNode ()).collect (Collectors .toList ());
333- int areaUnit = 1 ;
315+ int areaUnit ;
334316 if (classElementsMode == ClassElementsModes .ATTRIBUTES_ONLY ) {
335317 areaUnit = childsM .size ();
336318 } else {
337319 areaUnit = childsA .size ();
338320 }
339- double width = 0.0 ;
340- double length = 0.0 ;
321+ double width ;
322+ double length ;
341323 if (areaUnit <= 1 ) {
342324 width = widthMin ;
343325 length = widthMin ;
@@ -567,10 +549,10 @@ private void calculateChimneys(Node building) {
567549 // Calculates side capacity for progressive/balanced bricks layout
568550 private int calculateSideCapacity (double value ) {
569551 int sc = 0 ; // side capacity
570- int lc = 0 ; // layer capacity
571- int nolMin = 0 ; // number of layers
572- int bcMin = 0 ; // building capacity min
573- int bcMax = 0 ; // building capacity max
552+ int lc ; // layer capacity
553+ int nolMin ; // number of layers
554+ int bcMin ; // building capacity min
555+ int bcMax ; // building capacity max
574556 do {
575557 sc ++;
576558 lc = sc * 4 ;
0 commit comments