TimedQuantityState
in package
FinalYes
Quantity distribution over timed slots.
Table of Contents
Properties
- $space : TimedSlotSpace
- $quantities : array<string, int|float>
Methods
- __construct() : mixed
- Create one timed quantity state from timed-slot quantity tuples.
- add() : void
- Add a signed quantity delta to one timed slot.
- all() : array<string, int|float>
- Return all stored timed-slot quantities keyed by canonical `slot@time`.
- copy() : self
- Return a shallow copy of this timed quantity state.
- fromQuantityState() : self
- Expand a base QuantityState into one timed state at the given origin time.
- get() : int|float
- Return the quantity currently stored at one timed slot, defaulting to zero.
- resolveTimedSlot() : TimedSlot
- Resolve constructor tuple input into one concrete timed slot instance.
Properties
$space read-only
public
TimedSlotSpace
$space
$quantities
private
array<string, int|float>
$quantities
= []
Methods
__construct()
Create one timed quantity state from timed-slot quantity tuples.
public
__construct(TimedSlotSpace $space[, array<int, DateTimeImmutable|int|string|null}> $tuples = [] ]) : mixed
Parameters
- $space : TimedSlotSpace
- $tuples : array<int, DateTimeImmutable|int|string|null}> = []
add()
Add a signed quantity delta to one timed slot.
public
add(TimedSlot $slot, int|float $delta) : void
Parameters
- $slot : TimedSlot
- $delta : int|float
all()
Return all stored timed-slot quantities keyed by canonical `slot@time`.
public
all() : array<string, int|float>
Return values
array<string, int|float>copy()
Return a shallow copy of this timed quantity state.
public
copy() : self
Return values
selffromQuantityState()
Expand a base QuantityState into one timed state at the given origin time.
public
static fromQuantityState(TimedSlotSpace $space, QuantityState $state[, DateTimeImmutable|int|string $time = 0 ]) : self
Parameters
- $space : TimedSlotSpace
- $state : QuantityState
- $time : DateTimeImmutable|int|string = 0
Return values
selfget()
Return the quantity currently stored at one timed slot, defaulting to zero.
public
get(TimedSlot|string $slot) : int|float
Parameters
- $slot : TimedSlot|string
Return values
int|floatresolveTimedSlot()
Resolve constructor tuple input into one concrete timed slot instance.
private
resolveTimedSlot(TimedSlot|Slot|string|null $slot, DateTimeImmutable|int|string|null $time) : TimedSlot