size() public method

public size ( ) : long
return long
Example #1
0
 public void test_ListOf_clear()
 {
     ListOf lo = new  ListOf(2,4);
       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;
 }
Example #2
0
 public void test_ListOf_create()
 {
     ListOf lo = new  ListOf(2,4);
       assertTrue( lo.getTypeCode() == libsbml.SBML_LIST_OF );
       assertTrue( lo.getNotes() == null );
       assertTrue( lo.getAnnotation() == null );
       assertTrue( lo.getMetaId() == "" );
       assertTrue( lo.size() == 0 );
       lo = null;
 }
Example #3
0
 public void test_ListOf_remove()
 {
     ListOf lo = new  ListOf(2,4);
       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;
 }
 public void test_ListOf_copyConstructor()
 {
     ListOf o1 = new ListOf(2,1);
       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;
 }