Table of Contents

Class RPN

Namespace
RandomizerCore.StringLogic
Assembly
RandomizerCore.dll

Utility methods for dealing with logic in RPN form.

public static class RPN
Inheritance
RPN
Inherited Members

Methods

GetBoundOperator(IReadOnlyList<LogicToken>, int)

Returns the index of the operator bound to the term at startIndex,

public static int GetBoundOperator(IReadOnlyList<LogicToken> logic, int startIndex)

Parameters

logic IReadOnlyList<LogicToken>
startIndex int

Returns

int

GetBoundOperatorAlt(IReadOnlyList<LogicToken>, int)

Returns the index of the operator bound to the term or clause ending at startIndex. If startIndex points to the final token of the list, returns -1.

public static int GetBoundOperatorAlt(IReadOnlyList<LogicToken> logic, int startIndex)

Parameters

logic IReadOnlyList<LogicToken>
startIndex int

Returns

int

GetDNF(IReadOnlyList<LogicToken>)

Returns the disjunctive normal form of the expression. That is,
ORing together the results of ANDing the terms in each list results in an expression equivalent to the input.

public static List<HashSet<TermToken>> GetDNF(IReadOnlyList<LogicToken> logic)

Parameters

logic IReadOnlyList<LogicToken>

Returns

List<HashSet<TermToken>>

OperateOver(IEnumerable<TermToken>, OperatorToken)

public static IEnumerable<LogicToken> OperateOver(IEnumerable<TermToken> terms, OperatorToken op)

Parameters

terms IEnumerable<TermToken>
op OperatorToken

Returns

IEnumerable<LogicToken>

OperateOver(IEnumerable<IEnumerable<LogicToken>>, OperatorToken)

public static IEnumerable<LogicToken> OperateOver(IEnumerable<IEnumerable<LogicToken>> clauses, OperatorToken op)

Parameters

clauses IEnumerable<IEnumerable<LogicToken>>
op OperatorToken

Returns

IEnumerable<LogicToken>