@Test public void testGetParagraphs() throws Exception { try (InputStream nkjpTextXmlIn = NKJPTextDocumentTest.class.getResourceAsStream("text_structure.xml")) { NKJPTextDocument doc = NKJPTextDocument.parse(nkjpTextXmlIn); Map<String, String> paras = doc.getParagraphs(); assertEquals("To krótkie zdanie w drugim akapicie.", paras.get("ab-1")); } }
Map<String, String> getParagraphs() { Map<String, String> paragraphs = new HashMap<>(); for (String dockey : texts.keySet()) { for (String divkey : texts.get(dockey).keySet()) { for (String pkey : texts.get(dockey).get(divkey).keySet()) { paragraphs.put(pkey, texts.get(dockey).get(divkey).get(pkey)); } } } return paragraphs; }
NKJPTextDocument { Map<String, String> getParagraphs() { Map<String, String> paragraphs = new HashMap<>(); for (String dockey : texts.keySet()) { for (String divkey : texts.get(dockey).keySet()) { for (String pkey : texts.get(dockey).get(divkey).keySet()) { paragraphs.put(pkey, texts.get(dockey).get(divkey).get(pkey)); } } } return paragraphs; } }
NKJPTextDocument { Map<String, String> getParagraphs() { Map<String, String> paragraphs = new HashMap<>(); for (String dockey : texts.keySet()) { for (String divkey : texts.get(dockey).keySet()) { for (String pkey : texts.get(dockey).get(divkey).keySet()) { paragraphs.put(pkey, texts.get(dockey).get(divkey).get(pkey)); } } } return paragraphs; } NKJPTextDocument();   NKJPTextDocument(Map<String, String> divtypes, Map<String, Map<String, Map<String, String>>> texts); }
NKJPTextDocument { Map<String, String> getParagraphs() { Map<String, String> paragraphs = new HashMap<>(); for (String dockey : texts.keySet()) { for (String divkey : texts.get(dockey).keySet()) { for (String pkey : texts.get(dockey).get(divkey).keySet()) { paragraphs.put(pkey, texts.get(dockey).get(divkey).get(pkey)); } } } return paragraphs; } NKJPTextDocument();   NKJPTextDocument(Map<String, String> divtypes, Map<String, Map<String, Map<String, String>>> texts); static NKJPTextDocument parse(InputStream is); }
NKJPTextDocument { Map<String, String> getParagraphs() { Map<String, String> paragraphs = new HashMap<>(); for (String dockey : texts.keySet()) { for (String divkey : texts.get(dockey).keySet()) { for (String pkey : texts.get(dockey).get(divkey).keySet()) { paragraphs.put(pkey, texts.get(dockey).get(divkey).get(pkey)); } } } return paragraphs; } NKJPTextDocument();   NKJPTextDocument(Map<String, String> divtypes, Map<String, Map<String, Map<String, String>>> texts); static NKJPTextDocument parse(InputStream is);  }