@Test public void allEntries() throws Exception { BibTeXDatabase db = loadUnixDatabase(); BibTeXConverter conv = new BibTeXConverter(); Map<String, CSLItemData> cids = conv.toItemData(db); CSLItemData cid = cids.get("Ritchie:1974:UTS"); assertEquals("Ritchie:1974:UTS", cid.getId()); assertEquals(CSLType.ARTICLE_JOURNAL, cid.getType()); assertEquals(2, cid.getAuthor().length); assertEquals("Ritchie", cid.getAuthor()[0].getFamily()); assertEquals("Dennis W.", cid.getAuthor()[0].getGiven()); assertEquals("Thompson", cid.getAuthor()[1].getFamily()); assertEquals("Ken", cid.getAuthor()[1].getGiven()); assertEquals("Communications of the Association for Computing Machinery", cid.getCollectionTitle()); assertEquals("Communications of the Association for Computing Machinery", cid.getContainerTitle()); assertEquals("17", cid.getVolume()); assertEquals("7", cid.getIssue()); assertEquals("7", cid.getNumber()); assertEquals("11", cid.getNumberOfPages()); assertEquals("365-375", cid.getPage()); assertEquals("365", cid.getPageFirst()); assertEquals("The UNIX Time-Sharing System", cid.getTitle()); assertArrayEquals(new int[][] { new int[] { 1974, 7 } }, cid.getIssued().getDateParts()); }
public Map<String, CSLItemData> toItemData(BibTeXDatabase db) { Map<String, CSLItemData> result = new LinkedHashMap<>(); for (Map.Entry<Key, BibTeXEntry> e : db.getEntries().entrySet()) { result.put(e.getKey().getValue(), toItemData(e.getValue())); } return result; }
BibTeXConverter { public Map<String, CSLItemData> toItemData(BibTeXDatabase db) { Map<String, CSLItemData> result = new LinkedHashMap<>(); for (Map.Entry<Key, BibTeXEntry> e : db.getEntries().entrySet()) { result.put(e.getKey().getValue(), toItemData(e.getValue())); } return result; } }
BibTeXConverter { public Map<String, CSLItemData> toItemData(BibTeXDatabase db) { Map<String, CSLItemData> result = new LinkedHashMap<>(); for (Map.Entry<Key, BibTeXEntry> e : db.getEntries().entrySet()) { result.put(e.getKey().getValue(), toItemData(e.getValue())); } return result; } BibTeXConverter(); }
BibTeXConverter { public Map<String, CSLItemData> toItemData(BibTeXDatabase db) { Map<String, CSLItemData> result = new LinkedHashMap<>(); for (Map.Entry<Key, BibTeXEntry> e : db.getEntries().entrySet()) { result.put(e.getKey().getValue(), toItemData(e.getValue())); } return result; } BibTeXConverter(); BibTeXDatabase loadDatabase(InputStream is); Map<String, CSLItemData> toItemData(BibTeXDatabase db); CSLItemData toItemData(BibTeXEntry e); CSLType toType(Key type); }
BibTeXConverter { public Map<String, CSLItemData> toItemData(BibTeXDatabase db) { Map<String, CSLItemData> result = new LinkedHashMap<>(); for (Map.Entry<Key, BibTeXEntry> e : db.getEntries().entrySet()) { result.put(e.getKey().getValue(), toItemData(e.getValue())); } return result; } BibTeXConverter(); BibTeXDatabase loadDatabase(InputStream is); Map<String, CSLItemData> toItemData(BibTeXDatabase db); CSLItemData toItemData(BibTeXEntry e); CSLType toType(Key type);  }