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 |