@Test public void testReadDICFile() { HashMap<String,String> attIds = null; HashMap<String, HashMap<String,String>> attribut = null; try { attIds = new EdigeoSCD(EdigeoTestUtils.fileName("EDAB01SE.SCD")).readSCDFile("PTCANV_id"); attribut = eDic.readDICFile(attIds); assertTrue("IDU_id attribute values should not be precoded", attribut.get("IDU_id").get("precoded").equals("false")); assertTrue("ORI_id attribute values should not be precoded", attribut.get("ORI_id").get("precoded").equals("false")); assertTrue("CAN_id attribute values should be precoded", attribut.get("CAN_id").get("precoded").equals("true")); assertTrue("MAP_id attribute values should be precoded", attribut.get("MAP_id").get("precoded").equals("true")); assertTrue("PALT_id attribute values should be precoded", attribut.get("PALT_id").get("precoded").equals("true")); assertTrue("SYM_id attribute values should be precoded", attribut.get("SYM_id").get("precoded").equals("true")); assertTrue("PPLN_id attribute values should be precoded", attribut.get("PPLN_id").get("precoded").equals("true")); assertEquals("precoded value 03 should be equal to \"Point de canevas d'ensemble borne\" for SYM_id attribute " + "of PTCANV_id Edigeo object","Point de canevas d'ensemble borne", attribut.get("SYM_id").get("03")); assertEquals("precoded value 05 should be equal to \"Piquet\" for MAP_id attribute " + "of PTCANV_id Edigeo object","Piquet", attribut.get("MAP_id").get("05")); assertEquals("precoded value 05 should be equal to \"Departement\" for CAN_id attribute " + "of PTCANV_id Edigeo object","Departement", attribut.get("CAN_id").get("05")); } catch (IOException e) { assertFalse(e.getMessage(), true); } attIds = null; attribut = null; }
public HashMap<String,HashMap<String,String>> readDICFile(HashMap<String,String> atts) throws IOException { HashMap<String, HashMap<String,String>> attribut = new HashMap<String, HashMap<String,String>>(); Iterator<String> it = atts.keySet().iterator(); while (it.hasNext()) { String key = it.next(); EdigeoParser dicParser = new EdigeoParser(dicFile); HashMap<String, String> attParams = new HashMap<String, String>(); while (dicParser.readLine()){ if (dicParser.line.contains(atts.get(key))) { while (dicParser.readLine()){ if (dicParser.line.contains("TYPSA")) { attParams.put("type", dicParser.getValue("TYPSA")); } if (dicParser.line.contains("AVCSN")) { int nbPrecoded = Integer.parseInt(dicParser.getValue("AVCSN")); if (nbPrecoded > 0 ) { attParams.put("precoded", "true"); String preKey = null; for (int i = 0; i < nbPrecoded; i++) { while (dicParser.readLine()) { if (dicParser.line.contains("AVLSA")){ preKey = dicParser.getValue("AVLSA"); while (dicParser.readLine()) { if (dicParser.line.contains("AVDST")) { attParams.put(preKey, dicParser.getValue("AVDST")); break; } } break; } } } } else { attParams.put("precoded", "false"); } break; } } attribut.put(key, attParams); break; } } dicParser.close(); } return attribut; }
EdigeoDIC { public HashMap<String,HashMap<String,String>> readDICFile(HashMap<String,String> atts) throws IOException { HashMap<String, HashMap<String,String>> attribut = new HashMap<String, HashMap<String,String>>(); Iterator<String> it = atts.keySet().iterator(); while (it.hasNext()) { String key = it.next(); EdigeoParser dicParser = new EdigeoParser(dicFile); HashMap<String, String> attParams = new HashMap<String, String>(); while (dicParser.readLine()){ if (dicParser.line.contains(atts.get(key))) { while (dicParser.readLine()){ if (dicParser.line.contains("TYPSA")) { attParams.put("type", dicParser.getValue("TYPSA")); } if (dicParser.line.contains("AVCSN")) { int nbPrecoded = Integer.parseInt(dicParser.getValue("AVCSN")); if (nbPrecoded > 0 ) { attParams.put("precoded", "true"); String preKey = null; for (int i = 0; i < nbPrecoded; i++) { while (dicParser.readLine()) { if (dicParser.line.contains("AVLSA")){ preKey = dicParser.getValue("AVLSA"); while (dicParser.readLine()) { if (dicParser.line.contains("AVDST")) { attParams.put(preKey, dicParser.getValue("AVDST")); break; } } break; } } } } else { attParams.put("precoded", "false"); } break; } } attribut.put(key, attParams); break; } } dicParser.close(); } return attribut; } }
EdigeoDIC { public HashMap<String,HashMap<String,String>> readDICFile(HashMap<String,String> atts) throws IOException { HashMap<String, HashMap<String,String>> attribut = new HashMap<String, HashMap<String,String>>(); Iterator<String> it = atts.keySet().iterator(); while (it.hasNext()) { String key = it.next(); EdigeoParser dicParser = new EdigeoParser(dicFile); HashMap<String, String> attParams = new HashMap<String, String>(); while (dicParser.readLine()){ if (dicParser.line.contains(atts.get(key))) { while (dicParser.readLine()){ if (dicParser.line.contains("TYPSA")) { attParams.put("type", dicParser.getValue("TYPSA")); } if (dicParser.line.contains("AVCSN")) { int nbPrecoded = Integer.parseInt(dicParser.getValue("AVCSN")); if (nbPrecoded > 0 ) { attParams.put("precoded", "true"); String preKey = null; for (int i = 0; i < nbPrecoded; i++) { while (dicParser.readLine()) { if (dicParser.line.contains("AVLSA")){ preKey = dicParser.getValue("AVLSA"); while (dicParser.readLine()) { if (dicParser.line.contains("AVDST")) { attParams.put(preKey, dicParser.getValue("AVDST")); break; } } break; } } } } else { attParams.put("precoded", "false"); } break; } } attribut.put(key, attParams); break; } } dicParser.close(); } return attribut; } EdigeoDIC(String path); }
EdigeoDIC { public HashMap<String,HashMap<String,String>> readDICFile(HashMap<String,String> atts) throws IOException { HashMap<String, HashMap<String,String>> attribut = new HashMap<String, HashMap<String,String>>(); Iterator<String> it = atts.keySet().iterator(); while (it.hasNext()) { String key = it.next(); EdigeoParser dicParser = new EdigeoParser(dicFile); HashMap<String, String> attParams = new HashMap<String, String>(); while (dicParser.readLine()){ if (dicParser.line.contains(atts.get(key))) { while (dicParser.readLine()){ if (dicParser.line.contains("TYPSA")) { attParams.put("type", dicParser.getValue("TYPSA")); } if (dicParser.line.contains("AVCSN")) { int nbPrecoded = Integer.parseInt(dicParser.getValue("AVCSN")); if (nbPrecoded > 0 ) { attParams.put("precoded", "true"); String preKey = null; for (int i = 0; i < nbPrecoded; i++) { while (dicParser.readLine()) { if (dicParser.line.contains("AVLSA")){ preKey = dicParser.getValue("AVLSA"); while (dicParser.readLine()) { if (dicParser.line.contains("AVDST")) { attParams.put(preKey, dicParser.getValue("AVDST")); break; } } break; } } } } else { attParams.put("precoded", "false"); } break; } } attribut.put(key, attParams); break; } } dicParser.close(); } return attribut; } EdigeoDIC(String path); HashMap<String,HashMap<String,String>> readDICFile(HashMap<String,String> atts); }
EdigeoDIC { public HashMap<String,HashMap<String,String>> readDICFile(HashMap<String,String> atts) throws IOException { HashMap<String, HashMap<String,String>> attribut = new HashMap<String, HashMap<String,String>>(); Iterator<String> it = atts.keySet().iterator(); while (it.hasNext()) { String key = it.next(); EdigeoParser dicParser = new EdigeoParser(dicFile); HashMap<String, String> attParams = new HashMap<String, String>(); while (dicParser.readLine()){ if (dicParser.line.contains(atts.get(key))) { while (dicParser.readLine()){ if (dicParser.line.contains("TYPSA")) { attParams.put("type", dicParser.getValue("TYPSA")); } if (dicParser.line.contains("AVCSN")) { int nbPrecoded = Integer.parseInt(dicParser.getValue("AVCSN")); if (nbPrecoded > 0 ) { attParams.put("precoded", "true"); String preKey = null; for (int i = 0; i < nbPrecoded; i++) { while (dicParser.readLine()) { if (dicParser.line.contains("AVLSA")){ preKey = dicParser.getValue("AVLSA"); while (dicParser.readLine()) { if (dicParser.line.contains("AVDST")) { attParams.put(preKey, dicParser.getValue("AVDST")); break; } } break; } } } } else { attParams.put("precoded", "false"); } break; } } attribut.put(key, attParams); break; } } dicParser.close(); } return attribut; } EdigeoDIC(String path); HashMap<String,HashMap<String,String>> readDICFile(HashMap<String,String> atts);  }