< Dice‎ | AST

Difference between revisions of "Dice/AST/DiceAST"

From DiceRoller Documentation
(→‎Methods: additional framework for eventually implementing custom AST nodes)
Line 26: Line 26:
 
| {{protected}} {{method}} || [[/RerollInternal|RerollInternal(RollerConfig, DiceAST, Int32)]] || Actual reroll logic, implemented by each subclass.
 
| {{protected}} {{method}} || [[/RerollInternal|RerollInternal(RollerConfig, DiceAST, Int32)]] || Actual reroll logic, implemented by each subclass.
 
|-
 
|-
| {{public}} {{method}} || [[/ToString|ToString()]] || Retrieves a normalized representation of the dice expression.
+
| {{public}} {{method}} || [[/ToString|ToString()]] || Retrieves a normalized representation of the dice expression. Overridden from Object.ToString.
 
|}
 
|}
  

Revision as of 22:52, 1 May 2017

Represents a node in the dice expression Abstract Syntax Tree.

  • Namespace: Dice.AST
  • Assembly: DiceRoller (in DiceRoller.dll)

Inheritance Hierarchy

System.Object

Dice.AST.DiceAST

Syntax

public abstract class DiceAST

Methods

Name Description
Evaluate(RollerConfig, DiceAST, Int32) Evaluates the node, causing it to store its result in Value.
EvaluateInternal(RollerConfig, DiceAST, Int32) Actual evaluation logic, implemented by each subclass.
Reroll(RollerConfig, DiceAST, Int32) Re-do the roll without re-evaluating the entire subtree again.
RerollInternal(RollerConfig, DiceAST, Int32) Actual reroll logic, implemented by each subclass.
ToString() Retrieves a normalized representation of the dice expression. Overridden from Object.ToString.

Properties

Name Description
Evaluated Gets whether or not this node has been evaluated.
UnderlyingRollNode Gets the roll node underneath this node, unless this node is a roll node of some sort.
Value Gets the final value of the node.
Values Gets the underlying dice that were rolled, as well as their values.
ValueType Gets what type of value we have (total or successes).

Remarks

The DiceAST class and its subclasses implement the AST from the parser.