@Test public void testPublication() throws Exception { SplitList<PublicationItem> items; StringBuilder sb = new StringBuilder(); items = parsePublicationItems(sb.toString()); assertTrue(items.size() == 0); sb.append("pubmed:21063943|doi:10.1007/978-1-60761-987-1_6"); items = parsePublicationItems(sb.toString()); assertTrue(items.toString().contains("pubmed:21063943|doi:10.1007/978-1-60761-987-1_6")); sb.append("| doi:1231-60761-987-1_6"); items = parsePublicationItems(sb.toString()); assertTrue(items.size() == 3); sb.append("|cnki:1231-60761-987-1_6"); items = parsePublicationItems(sb.toString()); assertTrue(items.size() == 0); }
public static SplitList<PublicationItem> parsePublicationItems(String target) { SplitList<String> list = parseStringList(BAR, target); PublicationItem.Type type; String accession; PublicationItem item; SplitList<PublicationItem> itemList = new SplitList<PublicationItem>(BAR); for (String pub : list) { pub = parseString(pub); if (pub == null) { itemList.clear(); break; } String[] items = pub.split("" + COLON); if (items.length != 2 || (type = PublicationItem.findType(items[0].trim())) == null) { itemList.clear(); break; } else { accession = items[1].trim(); item = new PublicationItem(type, accession); itemList.add(item); } } return itemList; }
MZTabUtils { public static SplitList<PublicationItem> parsePublicationItems(String target) { SplitList<String> list = parseStringList(BAR, target); PublicationItem.Type type; String accession; PublicationItem item; SplitList<PublicationItem> itemList = new SplitList<PublicationItem>(BAR); for (String pub : list) { pub = parseString(pub); if (pub == null) { itemList.clear(); break; } String[] items = pub.split("" + COLON); if (items.length != 2 || (type = PublicationItem.findType(items[0].trim())) == null) { itemList.clear(); break; } else { accession = items[1].trim(); item = new PublicationItem(type, accession); itemList.add(item); } } return itemList; } }
MZTabUtils { public static SplitList<PublicationItem> parsePublicationItems(String target) { SplitList<String> list = parseStringList(BAR, target); PublicationItem.Type type; String accession; PublicationItem item; SplitList<PublicationItem> itemList = new SplitList<PublicationItem>(BAR); for (String pub : list) { pub = parseString(pub); if (pub == null) { itemList.clear(); break; } String[] items = pub.split("" + COLON); if (items.length != 2 || (type = PublicationItem.findType(items[0].trim())) == null) { itemList.clear(); break; } else { accession = items[1].trim(); item = new PublicationItem(type, accession); itemList.add(item); } } return itemList; }  }
MZTabUtils { public static SplitList<PublicationItem> parsePublicationItems(String target) { SplitList<String> list = parseStringList(BAR, target); PublicationItem.Type type; String accession; PublicationItem item; SplitList<PublicationItem> itemList = new SplitList<PublicationItem>(BAR); for (String pub : list) { pub = parseString(pub); if (pub == null) { itemList.clear(); break; } String[] items = pub.split("" + COLON); if (items.length != 2 || (type = PublicationItem.findType(items[0].trim())) == null) { itemList.clear(); break; } else { accession = items[1].trim(); item = new PublicationItem(type, accession); itemList.add(item); } } return itemList; }  static boolean isEmpty(String s); static String parseString(String target); static String printDouble(Double value); static Param parseParam(String target); static SplitList<String> parseStringList(char splitChar, String target); static SplitList<Param> parseParamList(String target); static SplitList<String> parseGOTermList(String target); static Integer parseInteger(String target); static Double parseDouble(String target); static SplitList<Double> parseDoubleList(String target); static String parseUnitId(String target); static URL parseURL(String target); static URI parseURI(String target); static SplitList<PublicationItem> parsePublicationItems(String target); static SplitList<SpecRef> parseSpecRefList(Unit unit, String target); static Modification parseModification(Section section, String target); static SplitList<Modification> parseModificationList(Section section, String target); }
MZTabUtils { public static SplitList<PublicationItem> parsePublicationItems(String target) { SplitList<String> list = parseStringList(BAR, target); PublicationItem.Type type; String accession; PublicationItem item; SplitList<PublicationItem> itemList = new SplitList<PublicationItem>(BAR); for (String pub : list) { pub = parseString(pub); if (pub == null) { itemList.clear(); break; } String[] items = pub.split("" + COLON); if (items.length != 2 || (type = PublicationItem.findType(items[0].trim())) == null) { itemList.clear(); break; } else { accession = items[1].trim(); item = new PublicationItem(type, accession); itemList.add(item); } } return itemList; }  static boolean isEmpty(String s); static String parseString(String target); static String printDouble(Double value); static Param parseParam(String target); static SplitList<String> parseStringList(char splitChar, String target); static SplitList<Param> parseParamList(String target); static SplitList<String> parseGOTermList(String target); static Integer parseInteger(String target); static Double parseDouble(String target); static SplitList<Double> parseDoubleList(String target); static String parseUnitId(String target); static URL parseURL(String target); static URI parseURI(String target); static SplitList<PublicationItem> parsePublicationItems(String target); static SplitList<SpecRef> parseSpecRefList(Unit unit, String target); static Modification parseModification(Section section, String target); static SplitList<Modification> parseModificationList(Section section, String target);  }