Hex Terrains Framework
Search Results for

    Show / Hide Table of Contents

    Struct FragmentableNativeList<TItem>

    Holds two lists. Items list holds values. EmptySlots holds vacant indexes, so when you add item through Add() function, it places it into Items list in the vacant slot (if any). When you call RemoveAt() item, it makes the given itemIndex vacant to be filled later with Add() function

    Implements
    IDisposable
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Fwt.Core.Collections
    Assembly: fwt.core.dll
    Syntax
    public struct FragmentableNativeList<TItem> : IDisposable where TItem : unmanaged
    Type Parameters
    Name Description
    TItem

    Fields

    EmptySlots

    Array of empty (vacant) slots. When item is added, it checks if there are any empty slots. If empty slot is found, it is used to store the item. If no empty slots are found, the item is added to the end of the list.

    Declaration
    public NativeList<int> EmptySlots
    Field Value
    Type Description
    NativeList<int>

    ItemSlots

    Here the items are stored, but this list is fragmented, so may contain empty (vacant) slots

    Declaration
    public NativeList<TItem> ItemSlots
    Field Value
    Type Description
    NativeList<TItem>

    SortedEmptySlots

    Key = index of the empty slot Data = index of the record about the empty slot in the EmptySlots list

    Declaration
    public NativeHashMap<int, int> SortedEmptySlots
    Field Value
    Type Description
    NativeHashMap<int, int>

    SortedOccupiedSlots

    Key = index of the occupied slot in ItemSlots list;

    Declaration
    public NativeHashSet<int> SortedOccupiedSlots
    Field Value
    Type Description
    NativeHashSet<int>

    Properties

    Count

    Amount of Items in all NON-empty slots

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int

    this[int]

    Gets an item from the ItemSlots list. DOES NOT DO any checks for null or something, so NullReferenceException is possible

    Declaration
    public TItem this[int index] { get; set; }
    Parameters
    Type Name Description
    int index
    Property Value
    Type Description
    TItem

    Methods

    Add(TItem)

    Returns the index this item is added to

    Declaration
    public int Add(TItem item)
    Parameters
    Type Name Description
    TItem item
    Returns
    Type Description
    int

    Clear()

    Declaration
    public void Clear()

    Dispose()

    Declaration
    public void Dispose()

    GetOccupiedIndexesArray(Allocator)

    Creates a native array filled with indexes of occupied slots in ItemSlots array, so you can take the data by this indexes from ItemSlots or by using indexer to get the items that are not 'deleted'

    Declaration
    public NativeArray<int> GetOccupiedIndexesArray(Allocator allocator)
    Parameters
    Type Name Description
    Allocator allocator
    Returns
    Type Description
    NativeArray<int>

    Init(Allocator)

    Ensures that internal collections are initialized

    Declaration
    public void Init(Allocator allocator)
    Parameters
    Type Name Description
    Allocator allocator

    IsEmptySlot(int, out int)

    Declaration
    public bool IsEmptySlot(int itemIndex, out int emptySlotIndex)
    Parameters
    Type Name Description
    int itemIndex
    int emptySlotIndex
    Returns
    Type Description
    bool

    MarkSlotOccupied(int)

    Adds a record about that given itemIndex slot is occupied. Removes the record from EmptySlots about this itemIndex

    Declaration
    public bool MarkSlotOccupied(int itemIndex)
    Parameters
    Type Name Description
    int itemIndex
    Returns
    Type Description
    bool

    RemoveAt(int)

    Makes the itemIndex slot vacant to be filled later. Does not really removes an item from Items list, so it is not resized and items are preserver their indexes

    Declaration
    public bool RemoveAt(int itemIndex)
    Parameters
    Type Name Description
    int itemIndex
    Returns
    Type Description
    bool

    RemoveEmptySlot(int)

    Removes an empty slot for item with given index. itemIndex is an index in Items list.

    Declaration
    public bool RemoveEmptySlot(int itemIndex)
    Parameters
    Type Name Description
    int itemIndex
    Returns
    Type Description
    bool

    Set(int, TItem)

    Declaration
    public int Set(int index, TItem item)
    Parameters
    Type Name Description
    int index
    TItem item
    Returns
    Type Description
    int

    TryGetItem(int, out TItem)

    Validates the requested itemIndex and also checks if the requested itemIndex slot is empty. Returns false if validation has not passed or slot is empty. Returns true if validation has passed and there is an item at requested index; out item contains the requested value. out item is default if there is no value found

    Declaration
    public bool TryGetItem(int itemIndex, out TItem item)
    Parameters
    Type Name Description
    int itemIndex
    TItem item
    Returns
    Type Description
    bool

    Implements

    IDisposable

    Extension Methods

    HashExtensions.GetHashCode_ValueType<TValue>(TValue, int)
    HashExtensions.GetHashCode_ValueType<TValue>(TValue, int)
    Extensions_UnityObject.SmartDestroy(object)
    Extensions_UnityObject.SmartDestroy(object)
    Extensions_UnityObject.SmartGetComponent<TComponent>(object)
    Extensions_UnityObject.SmartGetComponent<TComponent>(object)
    Extensions_UnityObject.SmartGetGameGameObject(object)
    Extensions_UnityObject.SmartGetGameGameObject(object)
    In this article
    Back to top Generated by DocFX