From 54edb0cec221ab004db2b27322e38a3a02114083 Mon Sep 17 00:00:00 2001 From: Lukasz Baldyga Date: Fri, 4 Dec 2020 17:10:48 +0000 Subject: [PATCH] Documented IfChunk --- .../Verbs/Flow/IfChunk.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Flow/IfChunk.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Flow/IfChunk.cs index 3fae85f..01e7736 100644 --- a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Flow/IfChunk.cs +++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Flow/IfChunk.cs @@ -2,23 +2,39 @@ using System.Collections.Generic; namespace Advanced_Software_Engineering.Verbs.Flow { - + /// + /// A simple If Object + /// public class IfChunk : VerbChunk, IVerbChunk, IVerb { private readonly IValue conditional; private readonly ValueStorage valueStorage; + /// + /// Create a new if object + /// + /// The ValueStorage for increasing and decreasing the stack + /// Preferably , if the chunk should execute. public IfChunk(ValueStorage valueStorage, IValue conditional) : base() { this.conditional = conditional; this.valueStorage = valueStorage; valueStorage.IncreaseStack(); } + /// + /// Create a new if object + /// + /// The ValueStorage for increasing and decreasing the stack + /// Preferably , if the chunk should execute. + /// A verb to execute in a single line public IfChunk(ValueStorage valueStorage, IValue conditional, IVerb oneLineVerb) : base(new List { oneLineVerb }) { this.conditional = conditional; this.valueStorage = valueStorage; valueStorage.IncreaseStack(); } + /// + /// Executes the chunk if the conditional is true + /// public new void ExecuteVerb() { valueStorage.IncreaseStack(); if (conditional.ToBool()) base.ExecuteVerb();