All Downloads are FREE. Search and download functionalities are using the official Maven repository.

elemental2.core.JsArray Maven / Gradle / Ivy

There is a newer version: 2.27
Show newest version
package elemental2.core;

import jsinterop.annotations.JsFunction;
import jsinterop.annotations.JsMethod;
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsType;
import jsinterop.base.Js;
import jsinterop.base.JsArrayLike;

@JsType(isNative = true, name = "Array", namespace = JsPackage.GLOBAL)
public class JsArray implements JsIterable, JsArrayLike {
  @JsType(isNative = true, name = "?", namespace = JsPackage.GLOBAL)
  public interface EntriesJsIteratorIterableTypeParameterArrayUnionType {
    @JsOverlay
    static JsArray.EntriesJsIteratorIterableTypeParameterArrayUnionType of(Object o) {
      return Js.cast(o);
    }

    @JsOverlay
    default double asDouble() {
      return Js.asDouble(this);
    }

    @JsOverlay
    default T asT() {
      return Js.cast(this);
    }

    @JsOverlay
    default boolean isDouble() {
      return (Object) this instanceof Double;
    }
  }

  @JsFunction
  public interface EveryCallbackFn {
    Object onInvoke(T p0, int p1, T[] p2);
  }

  @JsFunction
  public interface FilterCallbackFn {
    Object onInvoke(T p0, int p1, T[] p2);
  }

  @JsFunction
  public interface FindIndexPredicateFn {
    boolean onInvoke(T p0, int p1, T[] p2);
  }

  @JsFunction
  public interface FindPredicateFn {
    boolean onInvoke(T p0, int p1, T[] p2);
  }

  @JsFunction
  public interface ForEachCallbackFn {
    Object onInvoke(T p0, int p1, T[] p2);
  }

  @JsType(isNative = true, name = "?", namespace = JsPackage.GLOBAL)
  public interface FromArrayLikeUnionType {
    @JsOverlay
    static JsArray.FromArrayLikeUnionType of(Object o) {
      return Js.cast(o);
    }

    @JsOverlay
    default JsArrayLike asJsArrayLike() {
      return Js.cast(this);
    }

    @JsOverlay
    default JsIterable asJsIterable() {
      return Js.cast(this);
    }

    @JsOverlay
    default String asString() {
      return Js.asString(this);
    }

    @JsOverlay
    default boolean isString() {
      return (Object) this instanceof String;
    }
  }

  @JsFunction
  public interface FromMapFn {
    @JsType(isNative = true, name = "?", namespace = JsPackage.GLOBAL)
    public interface P0UnionType {
      @JsOverlay
      static JsArray.FromMapFn.P0UnionType of(Object o) {
        return Js.cast(o);
      }

      @JsOverlay
      default String asString() {
        return Js.asString(this);
      }

      @JsOverlay
      default T asT() {
        return Js.cast(this);
      }

      @JsOverlay
      default boolean isString() {
        return (Object) this instanceof String;
      }
    }

    R onInvoke(JsArray.FromMapFn.P0UnionType p0, int p1);

    @JsOverlay
    default R onInvoke(String p0, int p1) {
      return onInvoke(Js.>uncheckedCast(p0), p1);
    }

    @JsOverlay
    default R onInvoke(T p0, int p1) {
      return onInvoke(Js.>uncheckedCast(p0), p1);
    }
  }

  @JsFunction
  public interface MapCallbackFn {
    R onInvoke(T p0, int p1, T[] p2);
  }

  @JsFunction
  public interface ReduceCallbackFn {
    R onInvoke(Object p0, T p1, int p2, T[] p3);
  }

  @JsFunction
  public interface ReduceRightCallbackFn {
    R onInvoke(Object p0, T p1, int p2, T[] p3);
  }

  @JsFunction
  public interface SomeCallbackFn {
    Object onInvoke(T p0, int p1, T[] p2);
  }

  @JsFunction
  public interface SortCompareFn {
    double onInvoke(T p0, T p1);
  }

  public static native  R[] from(
      JsArray.FromArrayLikeUnionType arrayLike,
      JsArray.FromMapFn mapFn,
      Object this_);

  public static native  R[] from(
      JsArray.FromArrayLikeUnionType arrayLike, JsArray.FromMapFn mapFn);

  public static native  R[] from(JsArray.FromArrayLikeUnionType arrayLike);

  @JsOverlay
  public static final  R[] from(
      JsArrayLike arrayLike, JsArray.FromMapFn mapFn, Object this_) {
    return from(Js.>uncheckedCast(arrayLike), mapFn, this_);
  }

  @JsOverlay
  public static final  R[] from(
      JsArrayLike arrayLike, JsArray.FromMapFn mapFn) {
    return from(Js.>uncheckedCast(arrayLike), mapFn);
  }

  @JsOverlay
  public static final  R[] from(JsArrayLike arrayLike) {
    return from(Js.>uncheckedCast(arrayLike));
  }

  @JsOverlay
  public static final  R[] from(
      JsIterable arrayLike, JsArray.FromMapFn mapFn, Object this_) {
    return from(Js.>uncheckedCast(arrayLike), mapFn, this_);
  }

  @JsOverlay
  public static final  R[] from(
      JsIterable arrayLike, JsArray.FromMapFn mapFn) {
    return from(Js.>uncheckedCast(arrayLike), mapFn);
  }

  @JsOverlay
  public static final  R[] from(JsIterable arrayLike) {
    return from(Js.>uncheckedCast(arrayLike));
  }

  @JsOverlay
  public static final  R[] from(
      String arrayLike, JsArray.FromMapFn mapFn, Object this_) {
    return from(Js.>uncheckedCast(arrayLike), mapFn, this_);
  }

  @JsOverlay
  public static final  R[] from(
      String arrayLike, JsArray.FromMapFn mapFn) {
    return from(Js.>uncheckedCast(arrayLike), mapFn);
  }

  @JsOverlay
  public static final  R[] from(String arrayLike) {
    return from(Js.>uncheckedCast(arrayLike));
  }

  @JsOverlay
  public static final  R[] from(
      T[] arrayLike, JsArray.FromMapFn mapFn, Object this_) {
    return from(Js.>uncheckedCast(arrayLike), mapFn, this_);
  }

  @JsOverlay
  public static final  R[] from(
      T[] arrayLike, JsArray.FromMapFn mapFn) {
    return from(Js.>uncheckedCast(arrayLike), mapFn);
  }

  @JsOverlay
  public static final  R[] from(T[] arrayLike) {
    return from(Js.>uncheckedCast(arrayLike));
  }

  public static native boolean isArray(Object arr);

  public static native  T[] of(T... var_args);

  public int index;
  public String input;
  public int length;

  public JsArray(Object... items) {}

  public native T[] concat(T... items);

  public native T[] copyWithin(int target, int start, int end);

  public native T[] copyWithin(int target, int start);

  public native JsIteratorIterable<
          JsArray.EntriesJsIteratorIterableTypeParameterArrayUnionType[]>
      entries();

  public native boolean every(JsArray.EveryCallbackFn callback, Object thisobj);

  public native boolean every(JsArray.EveryCallbackFn callback);

  public native T[] fill(T value, int begin, int end);

  public native T[] fill(T value, int begin);

  public native T[] fill(T value);

  public native T[] filter(JsArray.FilterCallbackFn callback, Object thisobj);

  public native T[] filter(JsArray.FilterCallbackFn callback);

  public native T find(JsArray.FindPredicateFn predicateFn, Object this_);

  public native T find(JsArray.FindPredicateFn predicateFn);

  public native int findIndex(JsArray.FindIndexPredicateFn predicateFn, Object this_);

  public native int findIndex(JsArray.FindIndexPredicateFn predicateFn);

  public native void forEach(JsArray.ForEachCallbackFn callback, Object thisobj);

  public native void forEach(JsArray.ForEachCallbackFn callback);

  public native boolean includes(T searchElement, int fromIndex);

  public native boolean includes(T searchElement);

  public native int indexOf(T obj, int fromIndex);

  public native int indexOf(T obj);

  public native String join();

  public native String join(Object separator);

  public native JsIteratorIterable keys();

  public native int lastIndexOf(T obj, int fromIndex);

  public native int lastIndexOf(T obj);

  public native  R[] map(JsArray.MapCallbackFn callback, Object thisobj);

  public native  R[] map(JsArray.MapCallbackFn callback);

  public native T pop();

  public native int push(T... var_args);

  public native  R reduce(
      JsArray.ReduceCallbackFn callback, Object initialValue);

  public native  R reduce(JsArray.ReduceCallbackFn callback);

  public native  R reduceRight(
      JsArray.ReduceRightCallbackFn callback, Object initialValue);

  public native  R reduceRight(JsArray.ReduceRightCallbackFn callback);

  public native T[] reverse();

  public native T shift();

  public native T[] slice();

  public native T[] slice(int begin, int end);

  public native T[] slice(int begin);

  public native boolean some(JsArray.SomeCallbackFn callback, Object thisobj);

  public native boolean some(JsArray.SomeCallbackFn callback);

  public native T[] sort();

  public native T[] sort(JsArray.SortCompareFn compareFn);

  public native T[] splice();

  public native T[] splice(int index, int howMany, T... var_args);

  public native T[] splice(int index);

  public native String toSource();

  @JsMethod(name = "toString")
  public native String toString_();

  public native int unshift(T... var_args);

  public native JsIteratorIterable values();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy