Class Inlist<T extends Inlist<T>>

java.lang.Object
org.oscim.utils.pool.Inlist<T>
Direct Known Subclasses:
BoxTree.BoxItem, BufferObject, KeyMap, KeyMap.HashItem, LList, MapTile.TileData, RenderBucket, SymbolItem, TextItem, TextureAtlas, TextureAtlas.Rect, TextureAtlas.Slot, TextureItem, VertexData.Chunk

public class Inlist<T extends Inlist<T>> extends Object
Utility class for making poolable objects. Instead of using an additional list to hold pool items just extend this class.

Also handy for objects that exist in only *one list* at a time, if you are *REALLY* sure about it. Better do not use it! :)

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Inlist.List<T extends Inlist<?>>
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends Inlist<?>>
    T
    appendItem(T list, T item)
    Append 'item' to 'list'.
    static <T extends Inlist>
    T
    appendList(T list, T other)
    Append list 'other' to 'list'.
    static <T extends Inlist<?>>
    T
    get(T list, int i)
    Gets the 'item' with index 'i'.
    static <T extends Inlist<?>>
    T
    last(T list)
    Get last item in from list.
     
    static <T extends Inlist<?>>
    T
    prependRelative(T list, T item, T other)
    Prepend 'item' relative to 'other'.
    static <T extends Inlist<?>>
    T
    push(T list, T item)
    Push 'item' onto 'list'.
    static <T extends Inlist<?>>
    T
    remove(T list, T item)
    Removes the 'item' from 'list'.
    static <T extends Inlist<?>>
    int
    size(T list)
    Get size of 'list'.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • next

      public T extends Inlist<T> next
  • Constructor Details

    • Inlist

      public Inlist()
  • Method Details

    • next

      public T next()
    • push

      @CheckReturnValue public static <T extends Inlist<?>> T push(T list, T item)
      Push 'item' onto 'list'.
      Parameters:
      list - the list
      item - the item
      Returns:
      the new head of 'list' (item)
    • size

      public static <T extends Inlist<?>> int size(T list)
      Get size of 'list'.
      Parameters:
      list - the list
      Returns:
      the number of items in 'list'
    • remove

      @CheckReturnValue public static <T extends Inlist<?>> T remove(T list, T item)
      Removes the 'item' from 'list'.
      Parameters:
      list - the list
      item - the item
      Returns:
      the new head of 'list'
    • get

      @CheckReturnValue public static <T extends Inlist<?>> T get(T list, int i)
      Gets the 'item' with index 'i'.
      Parameters:
      list - the list
      i - the index
      Returns:
      the item or null
    • appendItem

      @CheckReturnValue public static <T extends Inlist<?>> T appendItem(T list, T item)
      Append 'item' to 'list'. 'item' may not be in another list, i.e. item.next must be null
      Parameters:
      list - the list
      item - the item
      Returns:
      the new head of 'list'
    • appendList

      @CheckReturnValue public static <T extends Inlist> T appendList(T list, T other)
      Append list 'other' to 'list'.
      Parameters:
      list - the list
      other - the other
      Returns:
      the head of 'list'
    • last

      @CheckReturnValue public static <T extends Inlist<?>> T last(T list)
      Get last item in from list.
      Parameters:
      list - the list
      Returns:
      the last item
    • prependRelative

      @CheckReturnValue public static <T extends Inlist<?>> T prependRelative(T list, T item, T other)
      Prepend 'item' relative to 'other'.
      Parameters:
      list - the list
      item - the item
      other - the other list
      Returns:
      the new head of list