< Dice‎ | AST

Difference between revisions of "Dice/AST/DiceAST"

From DiceRoller Documentation
 
(5 intermediate revisions by the same user not shown)
Line 18: Line 18:
 
! Name !! Description
 
! Name !! Description
 
|-
 
|-
| {{internal}} {{method}} || [[/Evaluate|Evaluate(RollerConfig, DiceAST, Int32)]] || Evaluates the node, causing it to store its result in Value.
+
| {{protected}} {{method}} || [[/Evaluate|Evaluate(RollData, DiceAST, Int32)]] || Evaluates the node, causing it to store its result in Value.
 
|-
 
|-
| {{protected}} {{method}} || [[/EvaluateInternal|EvaluateInternal(RollerConfig, DiceAST, Int32)]] || Actual evaluation logic, implemented by each subclass.
+
| {{protected}} {{method}} || [[/EvaluateInternal|EvaluateInternal(RollData, DiceAST, Int32)]] || Actual evaluation logic, implemented by each subclass.
 
|-
 
|-
| {{internal}} {{method}} || [[/GetUnderlyingRollNode|GetUnderlyingRollNode()]] || Gets the roll node underneath this node, unless this node is a roll node of some sort.
+
| {{protected}} {{method}} || [[/Reroll|Reroll(RollData, DiceAST, Int32)]] || Re-do the roll without re-evaluating the entire subtree again.
 
|-
 
|-
| {{internal}} {{method}} || [[/Reroll|Reroll(RollerConfig, DiceAST, Int32)]] || Re-do the roll without re-evaluating the entire subtree again.
+
| {{protected}} {{method}} || [[/RerollInternal|RerollInternal(RollData, 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. Overridden from Object.ToString.
|-
 
| {{public}} {{method}} || [[/ToString|ToString()]] || Retrieves a normalized representation of the dice expression.
 
 
|}
 
|}
  
Line 37: Line 35:
 
|-
 
|-
 
| {{public}} {{property}} || [[/Evaluated|Evaluated]] || Gets whether or not this node has been evaluated.
 
| {{public}} {{property}} || [[/Evaluated|Evaluated]] || Gets whether or not this node has been evaluated.
 +
|-
 +
| {{protected}} {{property}} || [[/UnderlyingRollNode|UnderlyingRollNode]] || Gets the roll node underneath this node, unless this node is a roll node of some sort.
 
|-
 
|-
 
| {{public}} {{property}} || [[/Value|Value]] || Gets the final value of the node.
 
| {{public}} {{property}} || [[/Value|Value]] || Gets the final value of the node.
Line 46: Line 46:
  
 
== Remarks ==
 
== Remarks ==
The DiceAST class and its subclasses implement the AST from the parser. As it is not possible to extend the parser outside of the assembly, it does not make sense to make any additional subclasses of DiceAST. As such, the public API for DiceAST and its descendants are only its public methods and properties. Protected methods are considered to be part of the internal API and can change without warning even across minor or patch versions (unlike for other classes, where protected members are considered part of the public API).
+
The DiceAST class and its subclasses implement the AST from the parser.

Latest revision as of 21:42, 14 August 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(RollData, DiceAST, Int32) Evaluates the node, causing it to store its result in Value.
EvaluateInternal(RollData, DiceAST, Int32) Actual evaluation logic, implemented by each subclass.
Reroll(RollData, DiceAST, Int32) Re-do the roll without re-evaluating the entire subtree again.
RerollInternal(RollData, 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.