Struct LazyStateBuilder
- Namespace
- RandomizerCore.Logic.StateLogic
- Assembly
- RandomizerCore.dll
Struct wrapper for a State or StateBuilder, which delays creating a StateBuilder until a mutating operation is requested. Note that this is a mutable struct. Pass it by ref to or return it from methods which perform mutating operations to ensure the effects of those operations are not lost.
public struct LazyStateBuilder : IState
- Implements
- Inherited Members
Constructors
LazyStateBuilder(LazyStateBuilder)
Clones the other LazyStateBuilder. If the other wraps a StateBuilder, then the inner StateBuilder is also cloned.
public LazyStateBuilder(LazyStateBuilder other)
Parameters
other
LazyStateBuilder
LazyStateBuilder(State)
Wraps the State as a LazyStateBuilder, which delays creating a StateBuilder until a mutating operation is requested.
public LazyStateBuilder(State orig)
Parameters
orig
State
LazyStateBuilder(StateBuilder)
Clones the StateBuilder and wraps it as a LazyStateBuilder.
public LazyStateBuilder(StateBuilder current)
Parameters
current
StateBuilder
Methods
GetBool(int)
public readonly bool GetBool(int id)
Parameters
id
int
Returns
GetInt(int)
public readonly int GetInt(int id)
Parameters
id
int
Returns
GetState()
If the instance wraps a StateBuilder, creates a State from the builder. If the instance wraps a State, returns that state.
public State GetState()
Returns
Increment(int, int)
Increments the specified field.
public void Increment(int id, int incr)
Parameters
IsComparablyLE(LazyStateBuilder, LazyStateBuilder)
public static bool IsComparablyLE(LazyStateBuilder left, LazyStateBuilder right)
Parameters
left
LazyStateBuilderright
LazyStateBuilder
Returns
IsComparablyLE(LazyStateBuilder, State)
public static bool IsComparablyLE(LazyStateBuilder left, State right)
Parameters
left
LazyStateBuilderright
State
Returns
IsComparablyLE(LazyStateBuilder, StateBuilder)
public static bool IsComparablyLE(LazyStateBuilder left, StateBuilder right)
Parameters
left
LazyStateBuilderright
StateBuilder
Returns
IsComparablyLE(State, LazyStateBuilder)
public static bool IsComparablyLE(State left, LazyStateBuilder right)
Parameters
left
Stateright
LazyStateBuilder
Returns
IsComparablyLE(StateBuilder, LazyStateBuilder)
public static bool IsComparablyLE(StateBuilder left, LazyStateBuilder right)
Parameters
left
StateBuilderright
LazyStateBuilder
Returns
SetBool(int, bool)
Sets the specified field.
public void SetBool(int id, bool value)
Parameters
SetInt(int, int)
Sets the specified field.
public void SetInt(int id, int value)
Parameters
TryIncrement(int, int, int)
Returns false if the increment would cause the field to exceed the max value. Otherwise, performs Increment(int, int) and returns true.
public bool TryIncrement(int id, int incr, int maxValue)
Parameters
Returns
TrySetBoolTrue(int)
If the field is false, sets it true and returns true. Otherwise, returns false.
public bool TrySetBoolTrue(int id)
Parameters
id
int
Returns
TrySetIntToValue(int, int)
Returns false if value
is less than the field value. Otherwise, performs SetInt(int, int) and returns true.
public bool TrySetIntToValue(int id, int value)