<commit_before>package unreal;

#if (!bake_externs && !macro)
import uhx.StructInfo;
using unreal.CoreAPI;
#end

#if macro
import haxe.macro.Expr;
import haxe.macro.Context;
import haxe.macro.Type;
using haxe.macro.Tools;

private typedef TArrayImpl<T> = Dynamic;
#end

@:keep
@:forward abstract TArray<T>(TArrayImpl<T>) from TArrayImpl<T> to TArrayImpl<T> #if !bake_externs to unreal.Struct to unreal.VariantPtr #end {
#if (!bake_externs && !macro)

  public var length(get,never):Int;

  inline public function new(arr:TArrayImpl<T>) {
    this = arr;
  }

  private inline function get_length() {
    return this.Num();
  }

  @:arrayAccess
  public inline function get(index:Int) {
    return getChecked(index);
  }

  @:arrayAccess
  public inline function set(index:Int, v:T) : T {
    return setChecked(index, v);
  }

  public inline function getChecked(index:Int) {
    #if debug
    if (!isValidIndex(index)) {
      throw 'Index $index out of bounds (num=${this.Num()})';
    }
    #end
    return this.get_Item(index);
  }

  public inline function setChecked(index:Int, v:T) : T {
    #if debug
    if (!isValidIndex(index)) {
      throw 'Index $index out of bounds (num=${this.Num()})';
    }
    #end
    this.set_Item(index, v);
    return v;
  }

  public inline function isValidIndex(index:Int) : Bool
  {
    return index >= 0 && index < this.Num();
  }

  public inline function iterator() return new TArrayIterator<T>(this);

  public inline function pop(allowShrinking:Bool = true) : T {
    return this.Pop(allowShrinking);
  }


  public inline function push(obj:T) : Void {
    this.Push(obj);
  }

  public inline function addZeroed(count:Int) : Int {
    return this.AddZeroed(count);
  }

  public inline function setNumUninitialized(arraySize:Int) : Void {
    this.SetNumUninitialized(arraySize);
  }

  public inline function insert(item:T, index:Int) : Int {
    return this.Insert(item, index);
  }

  public inline function remove(item:T) : Void {
    var index = indexOf(item);
    if (index >= 0) removeAt(index);
  }

  public inline function removeAt(index:Int, count:Int = 1, allowShrinking:Bool = true) : Void {
    this.RemoveAt(index, count, allowShrinking);
  }

  /** Removes any elements that pass the supplied filter, like an in-place filter().
   *  @return The number of elements removed.
   **/
  public inline function removeIf(fn:T->Bool, allowShrinking:Bool = true) : Int
  {
    var numRemoved = 0;<commit_msg>[CL-16502] Update to latest perforce change<commit_after>package unreal;

#if (!bake_externs && !macro)
import uhx.StructInfo;
using unreal.CoreAPI;
#end

#if macro
import haxe.macro.Expr;
import haxe.macro.Context;
import haxe.macro.Type;
using haxe.macro.Tools;

private typedef TArrayImpl<T> = Dynamic;
#end

@:keep
@:forward abstract TArray<T>(TArrayImpl<T>) from TArrayImpl<T> to TArrayImpl<T> #if !bake_externs to unreal.Struct to unreal.VariantPtr #end {
#if (!bake_externs && !macro)

  public var length(get,never):Int;

  inline public function new(arr:TArrayImpl<T>) {
    this = arr;
  }

  private inline function get_length() {
    return this.Num();
  }

  @:arrayAccess
  public inline function get(index:Int) {
    return getChecked(index);
  }

  @:arrayAccess
  public inline function set(index:Int, v:T) : T {
    return setChecked(index, v);
  }

  public inline function getChecked(index:Int) {
    #if debug
    if (!isValidIndex(index)) {
      throw 'Index $index out of bounds (num=${this.Num()})';
    }
    #end
    return this.get_Item(index);
  }

  public inline function setChecked(index:Int, v:T) : T {
    #if debug
    if (!isValidIndex(index)) {
      throw 'Index $index out of bounds (num=${this.Num()})';
    }
    #end
    this.set_Item(index, v);
    return v;
  }

  public inline function isValidIndex(index:Int) : Bool
  {
    return index >= 0 && index < this.Num();
  }

  public inline function iterator() return new TArrayIterator<T>(this);

  public inline function pop(allowShrinking:Bool = true) : T {
    return this.Pop(allowShrinking);
  }


  public inline function push(obj:T) : Void {
    this.Push(obj);
  }

  public inline function Append(other:TArray<T>) : Void
  {
    for (element in other)
    {
      this.Push(element);
    }
  }

  public inline function addZeroed(count:Int) : Int {
    return this.AddZeroed(count);
  }

  public inline function setNumUninitialized(arraySize:Int) : Void {
    this.SetNumUninitialized(arraySize);
  }

  public inline function insert(item:T, index:Int) : Int {
    return this.Insert(item, index);
  }

  public inline function remove(item:T) : Void {
    var index = indexOf(item);
    if (index >= 0) removeAt(index);
  }

  public inline function removeAt(index:Int, count:Int = 1, allowShrinking:Bool = true) : Void {
    this.RemoveAt(index, count, allowShrinking);
  }

  /** Removes any elements that pass the supplied filter, like an in-place filter().
   *  @return The number of elements removed.
   **/
  public inline function removeIf(fn:T->Bool, allowShrinking:Bool = true) : Int
  {
    var numRemoved = 0;
{'fraction_non_alphanumeric': 0.12598270440251572, 'fraction_numerical': 0.0025550314465408804, 'mean_word_length': 3.6432481751824817, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2105968', 'n_tokens_mistral': 1765, 'n_tokens_neox': 1674, 'n_words': 454}