|
|
|
@ -5,7 +5,7 @@
|
|
|
|
|
* `AcediaObject`s. |
|
|
|
|
* Appropriate classes and APIs for their construction are provided for |
|
|
|
|
* main primitive types and can be extended to any custom `struct`. |
|
|
|
|
* Copyright 2022 Anton Tarasenko |
|
|
|
|
* Copyright 2022-2023 Anton Tarasenko |
|
|
|
|
*------------------------------------------------------------------------------ |
|
|
|
|
* This file is part of Acedia. |
|
|
|
|
* |
|
|
|
@ -24,6 +24,7 @@
|
|
|
|
|
*/ |
|
|
|
|
class ArrayList extends Collection; |
|
|
|
|
|
|
|
|
|
var bool FLAG; |
|
|
|
|
// Actual storage of all our data. |
|
|
|
|
var private array<AcediaObject> storedObjects; |
|
|
|
|
|
|
|
|
@ -54,6 +55,34 @@ public final function int GetLength()
|
|
|
|
|
return storedObjects.length; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Appends objects from another `ArrayList` to the caller one. |
|
|
|
|
* |
|
|
|
|
* @param other Array to append objects from. `none` means nothing will be |
|
|
|
|
* added. |
|
|
|
|
* @return Reference to the caller `ArrayList` to allow for method chaining. |
|
|
|
|
*/ |
|
|
|
|
public final function ArrayList Append(ArrayList other) |
|
|
|
|
{ |
|
|
|
|
local int i, shift; |
|
|
|
|
local array<AcediaObject> otherObjects; |
|
|
|
|
|
|
|
|
|
if (other == none) return self; |
|
|
|
|
if (other.GetLength() <= 0) return self; |
|
|
|
|
|
|
|
|
|
shift = storedObjects.length; |
|
|
|
|
otherObjects = other.storedObjects; |
|
|
|
|
SetLength(storedObjects.length + otherObjects.length); |
|
|
|
|
for (i = 0; i < otherObjects.length; i += 1) |
|
|
|
|
{ |
|
|
|
|
if (otherObjects[i] != none) { |
|
|
|
|
otherObjects[i].NewRef(); |
|
|
|
|
} |
|
|
|
|
storedObjects[i + shift] = otherObjects[i]; |
|
|
|
|
} |
|
|
|
|
return self; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Changes length of the caller `ArrayList`. |
|
|
|
|
* If `ArrayList` size is increased as a result - added items will be |
|
|
|
|