public void test_ListOf_clear() { ListOf lo = new ListOf(); SBase sp = new Species(2,4); lo.append(sp); lo.append(sp); lo.append(sp); lo.append(sp); lo.append(sp); assertTrue( lo.size() == 5 ); lo.clear(true); assertTrue( lo.size() == 0 ); lo.append(sp); lo.append(sp); lo.append(sp); lo.append(sp); lo.appendAndOwn(sp); assertTrue( lo.size() == 5 ); SBase elem; elem = lo.get(0); elem = null; elem = lo.get(1); elem = null; elem = lo.get(2); elem = null; elem = lo.get(3); elem = null; elem = lo.get(4); elem = null; lo.clear(false); assertTrue( lo.size() == 0 ); lo = null; }
public void test_ListOf_create() { ListOf lo = new ListOf(); assertTrue( lo.getTypeCode() == libsbml.SBML_LIST_OF ); assertTrue( lo.getNotes() == null ); assertTrue( lo.getAnnotation() == null ); assertTrue( lo.getMetaId() == "" ); assertTrue( lo.size() == 0 ); lo = null; }
public void test_ListOf_copyConstructor() { ListOf o1 = new ListOf(); Species s = new Species(2,1); s.setId("species_1"); o1.append(s); s = null; ListOf o2 = new ListOf(o1); assertTrue( o2.size() == 1 ); assertTrue( ((Species) o2.get(0)).getId() == "species_1" ); assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() ); o2 = null; o1 = null; }
public void test_ListOf_get() { ListOf lo = new ListOf(); assertTrue( lo.size() == 0 ); SBase sp = new Species(2,4); lo.append(sp); assertTrue( lo.size() == 1 ); SBase elem = lo.get(1); assertTrue( sp != elem ); sp = null; lo = null; }
public void test_ListOf_remove() { ListOf lo = new ListOf(); SBase sp = new Species(2,4); assertTrue( lo.size() == 0 ); lo.append(sp); lo.append(sp); lo.append(sp); lo.append(sp); lo.append(sp); assertTrue( lo.size() == 5 ); SBase elem; elem = lo.remove(0); elem = null; elem = lo.remove(0); elem = null; elem = lo.remove(0); elem = null; elem = lo.remove(0); elem = null; elem = lo.remove(0); elem = null; assertTrue( lo.size() == 0 ); lo.append(sp); lo.append(sp); lo.append(sp); lo.append(sp); lo.appendAndOwn(sp); assertTrue( lo.size() == 5 ); lo = null; }