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();