-
Notifications
You must be signed in to change notification settings - Fork 19
Holder containers
This page lists all the ways which are used to store holder on the Fit
instance.
The most straight-forward container type: just assign holder of corresponding class or None to fit attribute. .ship
attribute is likely to be the one you will be using the most:
fit.ship = Ship(11184)
fit.ship = None
Charges on modules also use direct container and work exactly the same way.
Ordered collection of holders. Values assigned to some indices may be None, representing, for example, empty slots (which are not occupied by any module). Trailing Nones are always stripped.
Insert value to specified index. Value can be holder or None (to insert empty slots between holders). If index is out of range of the list, fill list with Nones up to specified index and insert value there.
Append holder to the end of the list.
Put holder to specified index, not changing list outside of this position. If placed outside of list range, fill it with Nones up to specified index and place item in there. Attempt to place holder to index which is already occupied by another holder will raise SlotTakenError.
Put holder to first free slot of list - as in, replace first seen None with it, or, if there're no Nones, append it to the end of the list.
Remove one value from list. Value can be holder, None or index.
Free up one slot - find holder and replace it with None. Value can be holder or index.
Clear all contents of the collection.
Provides a view over all holders from the list (no None values).
Besides listed methods, list exposes rather standard list methods:
.index(value)
__getitem__(index)
__iter__()
__contains__(value)
__len__()
Unordered collection of holders.
Add holder to the set.
Remove holder from the set.
Clear all contents of the collection.
Standard set methods:
__iter__()
__contains__(value)
__len__()
Same as set, but all holders in set must have unique typeID. Attempt to add holder with duplicate typeID will fail with ValueError.
This is parent object which holds racks of all modules. It provides only one additional method - view over all racks' holders via .holders()
(high rack, med rack, low rack).