# PSF-LoginServer - master - net.psforever.objects.inventory.LocallyRegisteredInventory
PSF - LoginServer - master - net.psforever.objects.inventory.LocallyRegisteredInventory
Keywords: PSF LoginServer master net.psforever.objects.inventory.LocallyRegisteredInventory

PSF-LoginServer - master < Back


# Packages

-  package root
  Definition Classes
    root
-  package net
  Definition Classes
    root
-  package psforever
  Definition Classes
    net
-  package objects
  Definition Classes
    psforever
-  package inventory
  Definition Classes
    objects
- Container
- GridInventory
- InventoryDisarrayException
- InventoryEquipmentSlot
- InventoryItem
- InventoryTile
- LocallyRegisteredInventory

c

net.psforever.objects.inventory

# LocallyRegisteredInventory

###

#### class LocallyRegisteredInventory extends GridInventory

An inventory that contains its own internal unique number system bound by a domain of numbers. When equipment is inserted into this inventory, the equipment is registered to it, assigned one of its internal unique numbers. The equipment must not already be registered to another unique number system for that reason. Upon being removed, the removed equipment is unregistered. The registration system adds another unspoken layer to `Capacity` as it imposes a total object count to the inventory.

Source
  LocallyRegisteredInventory.scala
See also

  `NumberSourceHub`

  `RandomSelector`

  `SpecificNumberSource`

Linear Supertypes
GridInventory, Container, AnyRef, Any

Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. LocallyRegisteredInventory
2. GridInventory
3. Container
4. AnyRef
5. Any

1. Hide All
2. Show All

Visibility

1. Public
2. Protected

### Instance Constructors

1.  new LocallyRegisteredInventory(numbers: Iterable[Int])

   numbers

     the numbers used as unique identifiers

### Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##: Int
   Definition Classes
     AnyRef → Any
3.  def +=(kv: (Int, Equipment)): Boolean
   Definition Classes
     GridInventory
4.  def -=(guid: PlanetSideGUID): Boolean
   Definition Classes
     GridInventory
5.  def -=(index: Int): Boolean
   Definition Classes
     GridInventory
6.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
7.  def Capacity: Int

   Capacity is a measure how many squares in the grid inventory are unused (value of -1).

   Capacity is a measure how many squares in the grid inventory are unused (value of -1). It does not guarantee the cells are distributed in any configuration conductive to item stowing.

   returns

     the number of free cells

   Definition Classes
     GridInventory
8.  def CheckCollisions(start: Int, w: Int, h: Int): Try[List[Int]]

   Test whether a given piece of `Equipment` would collide with any stowed content in the inventory.

   Test whether a given piece of `Equipment` would collide with any stowed content in the inventory.

   start

     the cell index to test this `Equipment` for insertion

   w

     the width of the `Equipment` to be tested

   h

     the height of the `Equipment` to be tested

   returns

     a `List` of GUID values for all existing contents that this item would overlap if inserted

   Definition Classes
     GridInventory
9.  def CheckCollisions(start: Int, item: Equipment): Try[List[Int]]

   Test whether a given piece of `Equipment` would collide with any stowed content in the inventory.
   A "collision" is considered a situation where the stowed placards of two items would overlap in some way.

   Test whether a given piece of `Equipment` would collide with any stowed content in the inventory.
   A "collision" is considered a situation where the stowed placards of two items would overlap in some way. The grid keeps track of the location of items by storing the primitive of their GUID in one or more cells. Two primitives can not be stored in the same cell. If placing two items into the same inventory leads to a situation where two primitive values might be in the same cell, that is a collision.

   start

     the cell index to test this `Equipment` for insertion

   item

     the `Equipment` to be tested

   returns

     a `List` of GUID values for all existing contents that this item would overlap if inserted

   Definition Classes
     GridInventory
10.  def CheckCollisionsAsGrid(start: Int, w: Int, h: Int): Try[List[InventoryItem]]

    Test whether a given piece of `Equipment` would collide with any stowed content in the inventory.
    Iterate over all cells that would be occupied by a new value and check each one whether or not that cell has an existing value.

    Test whether a given piece of `Equipment` would collide with any stowed content in the inventory.
    Iterate over all cells that would be occupied by a new value and check each one whether or not that cell has an existing value. This is a "using the inventory as a grid" method.

    start

      the cell index to test this `Equipment` for insertion

    w

      the width of the `Equipment` to be tested

    h

      the height of the `Equipment` to be tested

    returns

      a `List` of existing items that an item of this scale would overlap if inserted

    Definition Classes
      GridInventory
    Exceptions thrown

      `IndexOutOfBoundsException` if the region extends outside of the grid boundaries

11.  def CheckCollisionsAsList(start: Int, w: Int, h: Int): Try[List[InventoryItem]]

    Test whether a given piece of `Equipment` would collide with any stowed content in the inventory.
    Iterate over all stowed items and check each one whether or not it overlaps with the given region.

    Test whether a given piece of `Equipment` would collide with any stowed content in the inventory.
    Iterate over all stowed items and check each one whether or not it overlaps with the given region. This is a "using the inventory as a `List`" method.

    start

      the cell index to test this `Equipment` for insertion

    w

      the width of the `Equipment` to be tested

    h

      the height of the `Equipment` to be tested

    returns

      a `List` of existing items that an item of this scale would overlap if inserted

    Definition Classes
      GridInventory
    Exceptions thrown

      `IndexOutOfBoundsException` if the region extends outside of the grid boundaries

12.  def CheckCollisionsVar(start: Int, w: Int, h: Int): Try[List[InventoryItem]]

    Test whether a given piece of `Equipment` would collide with any stowed content in the inventory.
    If there are fewer items stored in the inventory than there are cells required to represent the testing item, test the collision by iterating through the list of items.

    Test whether a given piece of `Equipment` would collide with any stowed content in the inventory.
    If there are fewer items stored in the inventory than there are cells required to represent the testing item, test the collision by iterating through the list of items. If there are more items, check that each cell that would be used for the testing items tile does not collide. The "testing item" in this case has already been transformed into its tile dimensions.

    start

      the cell index to test this `Equipment` for insertion

    w

      the width of the `Equipment` to be tested

    h

      the height of the `Equipment` to be tested

    returns

      a `List` of existing items that an item of this scale would overlap if inserted

    Definition Classes
      GridInventory
13.  def Clear(): List[InventoryItem]

    Clear the inventory by removing all of its items.

    Clear the inventory by removing all of its items.

    returns

      a `List` of the previous items in the inventory as their `InventoryItemData` tiles

    Definition Classes
      LocallyRegisteredInventory → GridInventory
14.  def Collisions(index: Int, width: Int, height: Int): Try[List[InventoryItem]]

    Given a region of "searchable unit positions" considered as stowable, determine if any previously stowed items are contained within that region.
    Default usage, and recommended the continued inclusion of that use, is defined in terms of `Equipment` being stowed in a `GridInventory`.

    Given a region of "searchable unit positions" considered as stowable, determine if any previously stowed items are contained within that region.
    Default usage, and recommended the continued inclusion of that use, is defined in terms of `Equipment` being stowed in a `GridInventory`. Where the `Equipment` object is defined by the dimensions `width` and `height`, starting a search at `index` will search all positions within a grid-like range of numbers. Under certain searching conditions, this range may be meaningless, such as is the case when searching individual positions that are normal `EquipmentSlot` objects. Regardless, the value collected indicates the potential of multiple objects being discovered and maintains a reference to the object itself and the slot position where the object is located. (As any object can be discovered within the range, that is important.)

    index

      the position to start searching

    width

      the width of the searchable space

    height

      the height of the serachable space

    returns

      a list of objects that have been encountered within the searchable space

    Definition Classes
      Container
    See also

      `GridInventory.CheckCollisionsVar`

15.  def ElementsInListCollideInGrid(): List[List[InventoryItem]]

    Check whether any items in the "inventory as a list" datastructure would overlap in the "inventory as a grid".

    Check whether any items in the "inventory as a list" datastructure would overlap in the "inventory as a grid". Most likely, if an overlap is discovered, the grid-space is already compromised by having lost a section of some item's `Tile`. The inventory system actually lacks mechanics to properly resolve any discovered issues. For that reason, it will return a list of overlap issues that need to be resolved by a higher authority.

    returns

      a list of item overlap collision combinations

    Definition Classes
      GridInventory
    See also

      `InventoryDisarrayException`

      `recursiveRelatedListCollisions`

16.  def ElementsOnGridMatchList(): Int

    Align the "inventory as a grid" with the "inventory as a list." The grid is a faux-two-dimensional map of object identifiers that should point to items in the list.

    Align the "inventory as a grid" with the "inventory as a list." The grid is a faux-two-dimensional map of object identifiers that should point to items in the list. (Not the same as the global unique identifier number.) The objects in the list are considered actually being in the inventory. Only the references to those objects in grid-space can be considered out of alignment by not pointing to objects in the list. The inventory as a grid can be repaired but only a higher authority can perform inventory synchronization.

    returns

      the number of stale object references found and corrected

    Definition Classes
      GridInventory
    See also

      `InventoryDisarrayException`

17.  def Find(guid: PlanetSideGUID): Option[Int]

    Given globally unique identifier, if the object using it is stowed, attempt to locate its slot.

    Given globally unique identifier, if the object using it is stowed, attempt to locate its slot. All positions, `VisibleSlot` and `Inventory`, and wherever else, should be searchable.

    guid

      the GUID of the `Equipment`

    returns

      the index of the `EquipmentSlot`, or `None`

    Definition Classes
      GridInventory → Container
18.  def Find(obj: Equipment): Option[Int]

    Given an object, attempt to locate its slot.

    Given an object, attempt to locate its slot. All positions, `VisibleSlot` and `Inventory`, and wherever else, should be searchable.

    obj

      the `Equipment` object

    returns

      the index of the `EquipmentSlot`, or `None`

    Definition Classes
      Container
19.  def Fit(tile: InventoryTile): Option[Int]

    Find a blank space in the current inventory where a `tile` of given dimensions can be cleanly inserted.

    Find a blank space in the current inventory where a `tile` of given dimensions can be cleanly inserted. Brute-force method.

    tile

      the dimensions of the blank space

    returns

      the grid index of the upper left corner where equipment to which the `tile` belongs should be placed

    Definition Classes
      GridInventory → Container
20.  def Fit(obj: Equipment): Option[Int]
    Definition Classes
      Container
21.  def Height: Int
    Definition Classes
      GridInventory
22.  def Insert(start: Int, obj: Equipment): Boolean
    Definition Classes
      LocallyRegisteredInventory → GridInventory
23.  def InsertQuickly(start: Int, obj: Equipment): Boolean

    Just insert an item into the inventory without checking for item collisions.

    Just insert an item into the inventory without checking for item collisions.

    start

      the starting slot

    obj

      the `Equipment` item to be inserted

    returns

      whether the insertion succeeded

    Definition Classes
      LocallyRegisteredInventory → GridInventory
24.  def Insertion_CheckCollisions(start: Int, obj: Equipment, key: Int): Boolean

    Perform a collisions check and, if it passes, perform the insertion.

    Perform a collisions check and, if it passes, perform the insertion.

    start

      the starting slot

    obj

      the `Equipment` item to be inserted

    key

      the internal numeric identifier for this item

    returns

      the success or the failure of the insertion process

    Definition Classes
      GridInventory
25.  def Inventory: GridInventory

    A(n imperfect) reference to a generalized pool of the contained objects.

    A(n imperfect) reference to a generalized pool of the contained objects. Having access to all of the available positions is not required. The entries in this reference should definitely include all unseen positions. The `GridInventory` returned by this accessor is also an implementation of `Container`.

    Definition Classes
      GridInventory → Container
    See also

      `VisibleSlots`

26.  def Items: List[InventoryItem]
    Definition Classes
      GridInventory
27.  def LastIndex: Int

    The index of the last cell in this inventory.

    The index of the last cell in this inventory.

    returns

      same as `Offset` plus the total number of cells in this inventory minus 1

    Definition Classes
      GridInventory
28.  def Offset: Int
    Definition Classes
      GridInventory
29.  def Offset_=(fset: Int): Int

    Change the grid index offset value.

    Change the grid index offset value.

    fset

      the new offset value

    returns

      the current offset value

    Definition Classes
      GridInventory
    Exceptions thrown

      `IndexOutOfBoundsException` if the index is negative

30.  def Remove(index: Int): Boolean
    Definition Classes
      LocallyRegisteredInventory → GridInventory
31.  def Remove(guid: PlanetSideGUID): Boolean
    Definition Classes
      LocallyRegisteredInventory → GridInventory
32.  def Resize(w: Int, h: Int): Unit

    Change the size of the inventory, without regard for its current contents.

    Change the size of the inventory, without regard for its current contents. This method replaces mutators for `Width` and `Height`.

    w

      the new width

    h

      the new height

    Definition Classes
      GridInventory
    Exceptions thrown

      `IllegalArgumentException` if the new size to be set is zero or less

33.  def SetCells(start: Int, w: Int, h: Int, value: Int = -1): Unit

    Define a region of inventory grid cells and set them to a given value.

    Define a region of inventory grid cells and set them to a given value.

    start

      the initial inventory index

    w

      the width of the region

    h

      the height of the region

    value

      the value to set all the cells in the defined region; defaults to -1 (which is "nothing")

    Definition Classes
      GridInventory
    See also

      `SetCellsNoOffset`

34.  def SetCellsNoOffset(start: Int, w: Int, h: Int, value: Int = -1): Array[Int]

    Define a region of inventory grid cells and set them to a given value.

    Define a region of inventory grid cells and set them to a given value. Perform basic boundary checking for the current inventory dimensions.

    start

      the initial inventory index, without the inventory offset (required)

    w

      the width of the region

    h

      the height of the region

    value

      the value to set all the cells in the defined region; defaults to -1 (which is "nothing")

    returns

      a copy of the inventory as a grid, with the anticipated modifications

    Definition Classes
      GridInventory
    Exceptions thrown

      `IndexOutOfBoundsException` if the region extends outside of the grid boundaries

    See also

      `SetCellsOnlyNoOffset`

35.  def Size: Int
    Definition Classes
      GridInventory
36.  def Slot(slot: Int): EquipmentSlot

    Get whatever is stowed in the inventory at the given index.

    Get whatever is stowed in the inventory at the given index.

    slot

      the cell index

    returns

      an `EquipmentSlot` that contains whatever `Equipment` was stored in `slot`

    Definition Classes
      GridInventory → Container
37.  def TotalCapacity: Int

    The total number of cells in this inventory.

    The total number of cells in this inventory.

    returns

      the width multiplied by the height (`grid.length`, which is the same thing)

    Definition Classes
      GridInventory
38.  def VisibleSlots: Set[Int]

    A(n imperfect) reference to a generalized pool of the contained objects.
    Having access to all of the available positions is not required.

    A(n imperfect) reference to a generalized pool of the contained objects.
    Having access to all of the available positions is not required. Only the positions that can be actively viewed by other clients are listed.

    returns

      all of the affected slot indices

    Definition Classes
      GridInventory → Container
    See also

      `Inventory`

39.  def Width: Int
    Definition Classes
      GridInventory
40.  final def asInstanceOf[T0]: T0
    Definition Classes
      Any
41.  def clone(): AnyRef
    Attributes
      protected[lang]
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.CloneNotSupportedException]) @native()
42.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
43.  def equals(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef → Any
44.  def finalize(): Unit
    Attributes
      protected[lang]
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.Throwable])
45.  final def getClass(): Class[_ <: AnyRef]
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
46.  def hasItem(guid: PlanetSideGUID): Option[Equipment]

    Does this inventory contain an object with the given GUID?

    Does this inventory contain an object with the given GUID?

    guid

      the GUID

    returns

      the discovered object, or `None`

    Definition Classes
      GridInventory
47.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
48.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
49.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
50.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
51.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
52.  final def synchronized[T0](arg0: => T0): T0
    Definition Classes
      AnyRef
53.  def toString(): String
    Definition Classes
      AnyRef → Any
54.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException])
55.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException])
56.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException]) @native()

### Inherited from GridInventory

### Inherited from Container

### Inherited from AnyRef

### Inherited from Any

### Ungrouped