Class DNFLogicDef
- Namespace
- RandomizerCore.Logic
- Assembly
- RandomizerCore.dll
A LogicDef which stores its contents in disjunctive normal form.
Preferred for operations which need to inspect the successful subexpression after evaluation, such as most state operations.
public class DNFLogicDef : StateLogicDef, ILogicDef
- Inheritance
-
DNFLogicDef
- Implements
- Inherited Members
Constructors
DNFLogicDef(DNFLogicDef)
protected DNFLogicDef(DNFLogicDef other)
Parameters
other
DNFLogicDef
Methods
CanGet(ProgressionManager)
Evaluates the logic, for the given progression data input.
public override bool CanGet(ProgressionManager pm)
Parameters
Returns
CheckForUpdatedState(ProgressionManager, StateUnion?, List<State>, int, out StateUnion)
Runs EvaluateState, and returns true if any new states are added to the state union.
public override bool CheckForUpdatedState(ProgressionManager pm, StateUnion? current, List<State> newStates, int modifiedTerm, out StateUnion result)
Parameters
pm
ProgressionManagercurrent
StateUnionnewStates
List<State>modifiedTerm
intresult
StateUnion
Returns
DetailedEvaluateStateFrom(ProgressionManager, IStateProvider, bool, List<StatePathResult>)
Keeps states from true StatePaths separated, along with their corresponding true conjunctions. API for "explaining" a state evaluation.
public bool DetailedEvaluateStateFrom(ProgressionManager pm, IStateProvider stateProvider, bool firstConjunctionsOnly, List<DNFLogicDef.StatePathResult> results)
Parameters
pm
ProgressionManagerstateProvider
IStateProviderfirstConjunctionsOnly
boolresults
List<DNFLogicDef.StatePathResult>
Returns
EvaluateState(ProgressionManager, List<State>)
Uses the current progression data to determine under what state(s) the logic is satisfiable.
Appends a (possibly empty, non-reduced) sequence of result states to the input list. Returns true if the result is nonempty, or the result is empty but represents a nonnull indeterminate result.
public override bool EvaluateState(ProgressionManager pm, List<State> states)
Parameters
pm
ProgressionManagerstates
List<State>
Returns
EvaluateStateFrom(ProgressionManager, IStateProvider, List<State>)
Uses the current progression data what state(s) the logic is satisfiable, only allowing input states from the given state provider (recognized by reference equality).
public override bool EvaluateStateFrom(ProgressionManager pm, IStateProvider stateProvider, List<State> states)
Parameters
pm
ProgressionManagerstateProvider
IStateProviderstates
List<State>
Returns
GetAllSuccessfulConjunctions(ProgressionManager)
public IEnumerable<IEnumerable<TermToken>> GetAllSuccessfulConjunctions(ProgressionManager pm)
Parameters
Returns
GetFirstSuccessfulConjunction(ProgressionManager)
public IEnumerable<TermToken>? GetFirstSuccessfulConjunction(ProgressionManager pm)
Parameters
Returns
GetStateProviders()
Gets a sequence of unique state providers the LogicDef may depend on, for use with EvaluateStateFrom(ProgressionManager, IStateProvider, List<State>).
public override IEnumerable<IStateProvider> GetStateProviders()
Returns
GetTerms()
The sequence of terms on which the LogicDef depends. Terms not included in the sequence must not affect the value of CanGet.
public override IEnumerable<Term> GetTerms()
Returns
ToTermTokenSequences()
public IEnumerable<IEnumerable<TermToken>> ToTermTokenSequences()
Returns
ToTokenSequence()
Converts the LogicDef to its equivalent sequence of LogicTokens in RPN format.
public override IEnumerable<LogicToken> ToTokenSequence()