PDBPolymer extends BioPolymer implements Cloneable, IPDBPolymer { public PDBPolymer() { super(); sequentialListOfMonomers = new ArrayList<String>(); secondaryStructures = new ArrayList<IPDBStructure>(); } PDBPolymer(); @Override void addStructure(IPDBStructure structure); @Override Collection<IPDBStructure> getStructures(); @Override void addAtom(IPDBAtom oAtom); void addAtom(IPDBAtom oAtom, IMonomer oMonomer); @Override void addAtom(IPDBAtom oAtom, IMonomer oMonomer, IStrand oStrand); Collection<String> getMonomerNamesInSequentialOrder(); @Override IPDBPolymer clone(); @Override String toString();  }
@Test public void testPDBPolymer() { IPDBPolymer pdbPolymer = new PDBPolymer(); Assert.assertNotNull(pdbPolymer); Assert.assertEquals(pdbPolymer.getMonomerCount(), 0); IStrand oStrand1 = pdbPolymer.getBuilder().newInstance(IStrand.class); oStrand1.setStrandName("A"); IStrand oStrand2 = pdbPolymer.getBuilder().newInstance(IStrand.class); oStrand2.setStrandName("B"); IMonomer oMono1 = pdbPolymer.getBuilder().newInstance(IMonomer.class); oMono1.setMonomerName(new String("TRP279")); IMonomer oMono2 = pdbPolymer.getBuilder().newInstance(IMonomer.class); oMono2.setMonomerName(new String("HOH")); IMonomer oMono3 = pdbPolymer.getBuilder().newInstance(IMonomer.class); oMono3.setMonomerName(new String("GLYA16")); IPDBAtom oPDBAtom1 = pdbPolymer.getBuilder().newInstance(IPDBAtom.class, "C"); IPDBAtom oPDBAtom2 = pdbPolymer.getBuilder().newInstance(IPDBAtom.class, "C"); IPDBAtom oPDBAtom3 = pdbPolymer.getBuilder().newInstance(IPDBAtom.class, "C"); IPDBAtom oPDBAtom4 = pdbPolymer.getBuilder().newInstance(IPDBAtom.class, "C"); IPDBAtom oPDBAtom5 = pdbPolymer.getBuilder().newInstance(IPDBAtom.class, "C"); pdbPolymer.addAtom(oPDBAtom1); pdbPolymer.addAtom(oPDBAtom2, oStrand1); pdbPolymer.addAtom(oPDBAtom3, oMono1, oStrand1); pdbPolymer.addAtom(oPDBAtom4, oMono2, oStrand2); pdbPolymer.addAtom(oPDBAtom5, oMono3, oStrand2); Assert.assertNotNull(pdbPolymer.getAtom(0)); Assert.assertNotNull(pdbPolymer.getAtom(1)); Assert.assertNotNull(pdbPolymer.getAtom(2)); Assert.assertNotNull(pdbPolymer.getAtom(3)); Assert.assertNotNull(pdbPolymer.getAtom(4)); Assert.assertEquals(oPDBAtom1, pdbPolymer.getAtom(0)); Assert.assertEquals(oPDBAtom2, pdbPolymer.getAtom(1)); Assert.assertEquals(oPDBAtom3, pdbPolymer.getAtom(2)); Assert.assertEquals(oPDBAtom4, pdbPolymer.getAtom(3)); Assert.assertEquals(oPDBAtom5, pdbPolymer.getAtom(4)); Assert.assertNull(pdbPolymer.getMonomer("0815", "A")); Assert.assertNull(pdbPolymer.getMonomer("0815", "B")); Assert.assertNull(pdbPolymer.getMonomer("0815", "")); Assert.assertNull(pdbPolymer.getStrand("")); Assert.assertNotNull(pdbPolymer.getMonomer("TRP279", "A")); Assert.assertEquals(oMono1, pdbPolymer.getMonomer("TRP279", "A")); Assert.assertEquals(pdbPolymer.getMonomer("TRP279", "A").getAtomCount(), 1); Assert.assertNotNull(pdbPolymer.getMonomer("HOH", "B")); Assert.assertEquals(oMono2, pdbPolymer.getMonomer("HOH", "B")); Assert.assertEquals(pdbPolymer.getMonomer("HOH", "B").getAtomCount(), 1); Assert.assertEquals(pdbPolymer.getStrand("B").getAtomCount(), 2); Assert.assertEquals(pdbPolymer.getStrand("B").getMonomerCount(), 2); Assert.assertNull(pdbPolymer.getStrand("C")); Assert.assertNotNull(pdbPolymer.getStrand("B")); }