appendAndOwn() public méthode

public appendAndOwn ( SBase disownedItem ) : int
disownedItem SBase
Résultat int
Exemple #1
0
 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;
 }
Exemple #2
0
 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;
 }