@Test public void singleEntryWithDateRange() throws Exception { BibTeXDatabase db = loadUnixDatabase(); BibTeXEntry e = db.resolveEntry(new Key("Lycklama:1978:UTSb")); BibTeXConverter conv = new BibTeXConverter(); CSLItemData cid = conv.toItemData(e); assertEquals("Lycklama:1978:UTSb", cid.getId()); assertEquals(CSLType.ARTICLE_JOURNAL, cid.getType()); assertEquals(1, cid.getAuthor().length); assertEquals("Lycklama", cid.getAuthor()[0].getFamily()); assertEquals("H.", cid.getAuthor()[0].getGiven()); assertEquals("The Bell System Technical Journal", cid.getCollectionTitle()); assertEquals("The Bell System Technical Journal", cid.getContainerTitle()); assertEquals("57", cid.getVolume()); assertEquals("6", cid.getIssue()); assertEquals("6", cid.getNumber()); assertEquals("15", cid.getNumberOfPages()); assertEquals("2087-2101", cid.getPage()); assertEquals("2087", cid.getPageFirst()); assertEquals("UNIX Time-Sharing System: UNIX on a Microprocessor", cid.getTitle()); assertArrayEquals(new int[][] { new int[] { 1978, 7 }, new int[] { 1978, 8 } }, 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);  }