@Test public void testAlmostEmpty() { RCSBDescription description = RCSBDescriptionFactory.get(openStream("describeMol/almost_empty.xml")); assertEquals("almost_empty", description.getPdbId()); List<RCSBPolymer> polymers = description.getPolymers(); assertEquals(2, polymers.size()); RCSBPolymer polymer = polymers.get(0); assertEquals("notype", polymer.getType()); assertEquals(1, polymer.getIndex().intValue()); assertEquals("really close to empty", polymer.getDescription()); assertEquals(null, polymer.getEnzClass()); assertEquals(10, polymer.getLength().intValue()); assertEquals(0, polymer.getWeight(), 0); polymer = polymers.get(1); assertEquals(null, polymer.getType()); assertEquals(null, polymer.getIndex()); assertEquals(null, polymer.getDescription()); assertEquals(null, polymer.getEnzClass()); assertEquals(null, polymer.getLength()); assertEquals(null, polymer.getWeight()); }
public static RCSBDescription get(InputStream stream) { NodeList data; try { data = getNodes(stream); } catch (IOException e) { printError(e); return null; } RCSBDescription description = new RCSBDescription(); Element structureIdE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; structureIdE = (Element) data.item(i); if (structureIdE.getNodeName().equals("structureId")) { description.setPdbId(structureIdE.getAttribute("id")); } } data = structureIdE.getChildNodes(); Element polymerE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; polymerE = (Element) data.item(i); if (polymerE.getNodeName().equals("polymer")) { RCSBPolymer polymer = makePolymer(polymerE); description.addPolymer(polymer); } } return description; }
RCSBDescriptionFactory { public static RCSBDescription get(InputStream stream) { NodeList data; try { data = getNodes(stream); } catch (IOException e) { printError(e); return null; } RCSBDescription description = new RCSBDescription(); Element structureIdE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; structureIdE = (Element) data.item(i); if (structureIdE.getNodeName().equals("structureId")) { description.setPdbId(structureIdE.getAttribute("id")); } } data = structureIdE.getChildNodes(); Element polymerE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; polymerE = (Element) data.item(i); if (polymerE.getNodeName().equals("polymer")) { RCSBPolymer polymer = makePolymer(polymerE); description.addPolymer(polymer); } } return description; } }
RCSBDescriptionFactory { public static RCSBDescription get(InputStream stream) { NodeList data; try { data = getNodes(stream); } catch (IOException e) { printError(e); return null; } RCSBDescription description = new RCSBDescription(); Element structureIdE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; structureIdE = (Element) data.item(i); if (structureIdE.getNodeName().equals("structureId")) { description.setPdbId(structureIdE.getAttribute("id")); } } data = structureIdE.getChildNodes(); Element polymerE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; polymerE = (Element) data.item(i); if (polymerE.getNodeName().equals("polymer")) { RCSBPolymer polymer = makePolymer(polymerE); description.addPolymer(polymer); } } return description; }  }
RCSBDescriptionFactory { public static RCSBDescription get(InputStream stream) { NodeList data; try { data = getNodes(stream); } catch (IOException e) { printError(e); return null; } RCSBDescription description = new RCSBDescription(); Element structureIdE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; structureIdE = (Element) data.item(i); if (structureIdE.getNodeName().equals("structureId")) { description.setPdbId(structureIdE.getAttribute("id")); } } data = structureIdE.getChildNodes(); Element polymerE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; polymerE = (Element) data.item(i); if (polymerE.getNodeName().equals("polymer")) { RCSBPolymer polymer = makePolymer(polymerE); description.addPolymer(polymer); } } return description; }  static RCSBDescription get(InputStream stream); static RCSBDescription get(String pdbId); static void printError(Exception e); }
RCSBDescriptionFactory { public static RCSBDescription get(InputStream stream) { NodeList data; try { data = getNodes(stream); } catch (IOException e) { printError(e); return null; } RCSBDescription description = new RCSBDescription(); Element structureIdE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; structureIdE = (Element) data.item(i); if (structureIdE.getNodeName().equals("structureId")) { description.setPdbId(structureIdE.getAttribute("id")); } } data = structureIdE.getChildNodes(); Element polymerE = null; for (int i = 0; i < data.getLength(); i++) { if (data.item(i).getNodeType() != 1) continue; polymerE = (Element) data.item(i); if (polymerE.getNodeName().equals("polymer")) { RCSBPolymer polymer = makePolymer(polymerE); description.addPolymer(polymer); } } return description; }  static RCSBDescription get(InputStream stream); static RCSBDescription get(String pdbId); static void printError(Exception e);  }