Enum Class FaweCache

java.lang.Object
java.lang.Enum<FaweCache>
com.fastasyncworldedit.core.FaweCache
All Implemented Interfaces:
Trimable, Serializable, Comparable<FaweCache>, Constable

public enum FaweCache extends Enum<FaweCache> implements Trimable
  • Enum Constant Details

    • INSTANCE

      public static final FaweCache INSTANCE
      Since:
      2.0.0
  • Field Details

  • Method Details

    • values

      public static FaweCache[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static FaweCache valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • trim

      public boolean trim(boolean aggressive)
      Description copied from interface: Trimable
      Trims the object, reducing its memory footprint.
      Specified by:
      trim in interface Trimable
      Parameters:
      aggressive - if trimming should be aggressive e.g., Not returning early when the first element cannot be trimmed
      Returns:
      if this object is empty at the end of the trim, and can therefore be deleted
    • registerPool

      public <T extends IChunkSet> Pool<T> registerPool(Class<T> clazz, Supplier<T> cache, boolean buffer)
    • createCache

      public <T, V> com.google.common.cache.LoadingCache<T,V> createCache(Supplier<V> withInitial)
    • createCache

      public <T, V> com.google.common.cache.LoadingCache<T,V> createCache(Function<T,V> withInitial)
    • createMainThreadSafeCache

      public <V> LongFunction<V> createMainThreadSafeCache(Supplier<V> withInitial)
      Create a new cache aimed to act as a thread-cache that is safe to the main server thread. If the method is called away from the main thread, it will return a Function referencing the LoadingCache returned by createCache(Supplier). If it is called from the main thread, it will return a Function that will always return the result of the given Supplier. It is designed to prevent issues caused by internally-mutable and resettable classes such as CharFilterBlock from causing issues when used in edits on the main thread. This method is designed for specific internal use.
      Parameters:
      withInitial - The supplier used to determine the initial value if a thread cache is created, else to provide a new instance of the class being cached if on the main thread.
      Returns:
      a Function referencing a cache, or the given Supplier
      Since:
      2.4.0
    • toPalette

      public FaweCache.Palette toPalette(int layerOffset, char[] blocks)
      Convert raw char array to palette
      Returns:
      palette
    • toPalette

      public FaweCache.Palette toPalette(int layerOffset, int[] blocks)
      Convert raw int array to palette
      Returns:
      palette
    • toPaletteUnstretched

      public FaweCache.Palette toPaletteUnstretched(int layerOffset, char[] blocks)
      Convert raw int array to unstretched palette (1.16)
      Returns:
      palette
    • asMap

      public Map<String,Object> asMap(Object... pairs)
    • asTag

      public ShortTag asTag(short value)
    • asTag

      public IntTag asTag(int value)
    • asTag

      public DoubleTag asTag(double value)
    • asTag

      public ByteTag asTag(byte value)
    • asTag

      public FloatTag asTag(float value)
    • asTag

      public LongTag asTag(long value)
    • asTag

      public ByteArrayTag asTag(byte[] value)
    • asTag

      public IntArrayTag asTag(int[] value)
    • asTag

      public LongArrayTag asTag(long[] value)
    • asTag

      public StringTag asTag(String value)
    • asTag

      public CompoundTag asTag(Map<String,Object> value)
    • asTag

      public Tag asTag(Object value)
    • asTag

      public ListTag asTag(Object... values)
    • asTag

      public ListTag asTag(Collection values)
    • newBlockingExecutor

      public ThreadPoolExecutor newBlockingExecutor()
      Create a new blocking executor with default name and FaweCache logger
      Returns:
      new blocking executor
    • newBlockingExecutor

      public ThreadPoolExecutor newBlockingExecutor(String name)
      Create a new blocking executor with specified name and FaweCache logger
      Returns:
      new blocking executor
      Since:
      2.9.0
    • newBlockingExecutor

      public ThreadPoolExecutor newBlockingExecutor(String name, Logger logger)
      Create a new blocking executor with specified name and logger
      Returns:
      new blocking executor
      Since:
      2.9.0