Table of Contents

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

bool

GetInt(int)

public readonly int GetInt(int id)

Parameters

id int

Returns

int

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

State

Increment(int, int)

Increments the specified field.

public void Increment(int id, int incr)

Parameters

id int
incr int

IsComparablyLE(LazyStateBuilder, LazyStateBuilder)

public static bool IsComparablyLE(LazyStateBuilder left, LazyStateBuilder right)

Parameters

left LazyStateBuilder
right LazyStateBuilder

Returns

bool

IsComparablyLE(LazyStateBuilder, State)

public static bool IsComparablyLE(LazyStateBuilder left, State right)

Parameters

left LazyStateBuilder
right State

Returns

bool

IsComparablyLE(LazyStateBuilder, StateBuilder)

public static bool IsComparablyLE(LazyStateBuilder left, StateBuilder right)

Parameters

left LazyStateBuilder
right StateBuilder

Returns

bool

IsComparablyLE(State, LazyStateBuilder)

public static bool IsComparablyLE(State left, LazyStateBuilder right)

Parameters

left State
right LazyStateBuilder

Returns

bool

IsComparablyLE(StateBuilder, LazyStateBuilder)

public static bool IsComparablyLE(StateBuilder left, LazyStateBuilder right)

Parameters

left StateBuilder
right LazyStateBuilder

Returns

bool

SetBool(int, bool)

Sets the specified field.

public void SetBool(int id, bool value)

Parameters

id int
value bool

SetInt(int, int)

Sets the specified field.

public void SetInt(int id, int value)

Parameters

id int
value int

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

id int
incr int
maxValue int

Returns

bool

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

bool

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)

Parameters

id int
value int

Returns

bool