package com.graphhopper.reader.osgb.dpn;

import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;

import org.opengis.geometry.MismatchedDimensionException;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.operation.TransformException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.graphhopper.reader.RoutingElement;
import com.graphhopper.reader.osgb.AbstractRoutingElementFactory;

public class OsDpnRoutingElementFactory extends AbstractRoutingElementFactory<RoutingElement>{

    private static final Logger logger = LoggerFactory.getLogger(OsDpnRoutingElementFactory.class);

    @Override
    public RoutingElement create(String name, String idStr, XMLStreamReader parser) throws MismatchedDimensionException, XMLStreamException, FactoryException, TransformException {
    	idStr = idStr.substring(3);
        logger.info(":" + name + ":");
        switch (name) {
        case "RouteNode": {
            return OsDpnNode.create(idStr, parser);
        }
        case "RouteLink": {
            return OsDpnWay.create(idStr, parser);
        }
        case "Route": {
            // TODO grouped features
        }
        default: {

        }

        }
        return null;
    }
}

@@ -553,23 +553,21 @@
 Element%3E
+%0A
 %7B%0A%0A
-    
+%09
 private 
@@ -655,20 +655,17 @@
 lass);%0A%0A
-    
+%09
 @Overrid
@@ -666,20 +666,17 @@
 verride%0A
-    
+%09
 public R
@@ -696,16 +696,17 @@
  create(
+ 
 String n
@@ -746,17 +746,27 @@
 r parser
-)
+ )%0A%09       
  throws 
@@ -832,16 +832,25 @@
 ception,
+%0A%09       
  Transfo
@@ -860,23 +860,21 @@
 xception
- %7B%0A    
+%0A%09%7B%0A%09
 %09idStr =
@@ -894,24 +894,18 @@
 ing(3);%0A
-        
+%09%09
 logger.i
@@ -927,24 +927,18 @@
 + %22:%22);%0A
-        
+%09%09
 switch (
@@ -942,27 +942,24 @@
 h (name)
- %7B%0A        
+%0A%09%09%7B%0A%09%09%09
 case %22Ro
@@ -967,31 +967,26 @@
 teNode%22:
- %7B%0A            
+%0A%09%09%09%7B%0A%09%09%09%09
 return O
@@ -1017,34 +1017,24 @@
 arser);%0A
-        %7D%0A        
+%09%09%09%7D%0A%09%09%09
 case %22Ro
@@ -1042,31 +1042,26 @@
 teLink%22:
- %7B%0A            
+%0A%09%09%09%7B%0A%09%09%09%09
 return O
@@ -1095,138 +1095,120 @@
 r);%0A
-        %7D%0A        case %22Route%22: %7B%0A            // TODO grouped features%0A        %7D%0A        default: %7B%0A%0A        %7D%0A%0A        %7D%0A        
+%09%09%09%7D%0A%09%09%09case %22Route%22:%0A%09%09%09%7B%0A%09%09%09%09// TODO grouped features%0A%09%09%09%09break;%0A%09%09%09%7D%0A%09%09%09default:%0A%09%09%09%7B%0A%09%09%09%09break;%0A%09%09%09%7D%0A%0A%09%09%7D%0A%09%09
 retu
@@ -1216,16 +1216,13 @@
 n null;%0A
-    
+%09
 %7D%0A%7D%0A

fix Sonar issues