Array.st
changeset 15848 e839ccbebb14
parent 15608 de5bfe8d3a42
child 16262 9bc41f1f7057
child 18113 92b4242b2b0b
equal deleted inserted replaced
15847:29f535427ee5 15848:e839ccbebb14
   458 
   458 
   459     "Created: / 07-06-2012 / 11:06:33 / cg"
   459     "Created: / 07-06-2012 / 11:06:33 / cg"
   460 ! !
   460 ! !
   461 
   461 
   462 !Array methodsFor:'copying'!
   462 !Array methodsFor:'copying'!
       
   463 
       
   464 , aCollection
       
   465 %{
       
   466     if (__isArray(aCollection)) {
       
   467         if (__isArray(self)) {
       
   468             OBJ newArray;
       
   469             int mySize = __arraySize(self);
       
   470             int otherSize = __arraySize(aCollection);
       
   471             REGISTER OBJ src;
       
   472             int srcIdx, dstIdx;
       
   473             newArray = __ARRAY_NEW_INT(mySize+otherSize);
       
   474 
       
   475             src = self;
       
   476             for (dstIdx=0; dstIdx<mySize; dstIdx++) {
       
   477                 OBJ el = __ArrayInstPtr(src)->a_element[dstIdx];
       
   478 
       
   479                 __ArrayInstPtr(newArray)->a_element[dstIdx] = el;
       
   480                 __STORE(newArray, el);
       
   481             }
       
   482 
       
   483             src = aCollection;
       
   484             for (srcIdx=0; srcIdx<otherSize; srcIdx++, dstIdx++) {
       
   485                 OBJ el = __ArrayInstPtr(src)->a_element[srcIdx];
       
   486 
       
   487                 __ArrayInstPtr(newArray)->a_element[dstIdx] = el;
       
   488                 __STORE(newArray, el);
       
   489             }
       
   490             RETURN (newArray);
       
   491         }
       
   492     }
       
   493 %}.
       
   494     ^ super , aCollection
       
   495 !
   463 
   496 
   464 copyWith:something
   497 copyWith:something
   465     "return a new collection containing the receivers elements
   498     "return a new collection containing the receivers elements
   466      and the single new element, newElement.
   499      and the single new element, newElement.
   467      This is different from concatentation, which expects another collection
   500      This is different from concatentation, which expects another collection
  2577 ! !
  2610 ! !
  2578 
  2611 
  2579 !Array class methodsFor:'documentation'!
  2612 !Array class methodsFor:'documentation'!
  2580 
  2613 
  2581 version
  2614 version
  2582     ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.160 2013-08-10 11:11:14 stefan Exp $'
  2615     ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.161 2013-12-05 11:34:23 cg Exp $'
  2583 !
  2616 !
  2584 
  2617 
  2585 version_CVS
  2618 version_CVS
  2586     ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.160 2013-08-10 11:11:14 stefan Exp $'
  2619     ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.161 2013-12-05 11:34:23 cg Exp $'
  2587 ! !
  2620 ! !
  2588 
  2621