diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Flow/DeclareMethod.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Flow/DeclareMethod.cs
index 7dfd9e4..f73da71 100644
--- a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Flow/DeclareMethod.cs
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Flow/DeclareMethod.cs
@@ -1,23 +1,40 @@
namespace Advanced_Software_Engineering.Verbs.Flow {
-
+ ///
+ /// Declares a method. See because these classes behave similarly
+ ///
public class DeclareMethod : IVerb, IVerbChunk {
private readonly string methodName;
private readonly Drawer drawer;
+ ///
+ /// Creates a new DeclareMethod object
+ ///
+ /// The drawer is used for getting the method specifically
+ /// The name of the method
public DeclareMethod(Drawer drawer, string methodName) {
this.drawer = drawer;
this.methodName = methodName;
}
+ ///
+ /// Adds a verb to the verb list. More specifically, the verb list of the MethodChunk.
+ /// See
+ ///
+ /// The verb to add
public void AddVerb(IVerb verb) {
MethodChunk methodChunk = drawer.Methods[methodName];
methodChunk.AddVerb(verb);
}
- public void ExecuteVerb() {
- //Declaration of method happens at parse time
- }
+ ///
+ /// This method quite literally does nothing upon execution because the declaration of method happens at parse time
+ ///
+ public void ExecuteVerb() { }
+ ///
+ /// Gets the description of what the chunk will do
+ ///
+ /// A description of the chunk's actions
public string GetDescription() {
return "Declares a method";
}
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Flow/VerbChunk.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Flow/VerbChunk.cs
index b4a0a91..ba37d3f 100644
--- a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Flow/VerbChunk.cs
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Flow/VerbChunk.cs
@@ -1,30 +1,54 @@
using System.Collections.Generic;
namespace Advanced_Software_Engineering.Verbs.Flow {
-
+ ///
+ /// A simple VerbChunk. Used for storing and executing a bunch of verbs
+ ///
public class VerbChunk : IVerbChunk, IVerb {
private readonly List verbs;
+ ///
+ /// Create a new VerbChunk with verbs in it.
+ ///
+ /// Verbs to be added to the verb chunk
public VerbChunk(List verbs) {
this.verbs = verbs;
}
+ ///
+ /// Create an empty VerbChunk
+ ///
public VerbChunk() {
verbs = new List { };
}
+ ///
+ /// Adds a verb to the verb list
+ ///
+ ///
public void AddVerb(IVerb verb) {
verbs.Add(verb);
}
+ ///
+ /// Executes all of the verbs in order
+ ///
public void ExecuteVerb() {
foreach (IVerb verb in verbs) verb.ExecuteVerb();
}
+ ///
+ /// Returns all of the verbs stored
+ ///
+ /// the verbs stored
public IVerb[] GetVerbs() {
return verbs.ToArray();
}
+ ///
+ /// Gets a description of every verb
+ ///
+ /// The descriptions of every verb
public string GetDescription() {
string s = "VerbChunk Start";
foreach (IVerb verb in verbs) s += "\n" + verb.GetDescription();
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Flow/WhileChunk.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Flow/WhileChunk.cs
index 978e7e5..e9285a5 100644
--- a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Flow/WhileChunk.cs
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Flow/WhileChunk.cs
@@ -2,23 +2,39 @@
using System.Collections.Generic;
namespace Advanced_Software_Engineering.Verbs.Flow {
-
+ ///
+ /// A Chunk that loops over its code
+ ///
public class WhileChunk : VerbChunk, IVerbChunk, IVerb {
private readonly IValue conditional;
private readonly ValueStorage valueStorage;
+ ///
+ /// A For Loop object
+ ///
+ /// The ValueStorage for increasing and decreasing the stack
+ /// Preferably , weather the loop should continue to execute.
public WhileChunk(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 , weather the loop should continue to execute.
+ /// A verb to execute in a single line. (Probably a bad idea)
public WhileChunk(ValueStorage valueStorage, IValue conditional, IVerb oneLineVerb) : base(new List { oneLineVerb }) {
this.conditional = conditional;
this.valueStorage = valueStorage;
valueStorage.IncreaseStack();
}
+ ///
+ /// Executes every verb in the chunk
+ ///
public new void ExecuteVerb() {
valueStorage.IncreaseStack();
while (conditional.ToBool()) base.ExecuteVerb();
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/DeclareVariable.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/DeclareVariable.cs
index b7569b3..3c18932 100644
--- a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/DeclareVariable.cs
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/DeclareVariable.cs
@@ -2,7 +2,9 @@
using System;
namespace Advanced_Software_Engineering.Verbs.Value {
-
+ ///
+ /// Declares a variable
+ ///
public class DeclareVariable : IVerb {
private readonly ValueStorage storage;
private readonly IValue value;
@@ -46,7 +48,11 @@ namespace Advanced_Software_Engineering.Verbs.Value {
return true;
}
-
+ ///
+ /// Creates a new Declare variable
+ ///
+ /// The storage to use
+ /// The assignment
public DeclareVariable(ValueStorage storage, string assignment) {
this.storage = storage;
@@ -55,7 +61,7 @@ namespace Advanced_Software_Engineering.Verbs.Value {
assignment = assignment.Replace(op, " " + op + " ");
}
- // get variable name
+ // Get variable name
// assignment looks something like this at this point:
// i = 20
// or
@@ -108,15 +114,26 @@ namespace Advanced_Software_Engineering.Verbs.Value {
}
}
+ ///
+ /// Sets the variable to null
+ ///
public void ExecuteVerb() {
if (value != null) storage.SetVariable(name, value.Clone());
else storage.SetVariable(name, value);
}
+ ///
+ /// Gets the description of the verb
+ ///
+ ///
public string GetDescription() {
return "Declares the variable " + name;
}
+ ///
+ /// Gets the name of the variable to assign
+ ///
+ ///
public string GetName() {
return name;
}
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/IValue.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/IValue.cs
index 9ca6a0a..87028aa 100644
--- a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/IValue.cs
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/IValue.cs
@@ -1,23 +1,56 @@
using System.Drawing;
namespace Advanced_Software_Engineering.Verbs.Value {
-
+ ///
+ /// A value
+ ///
public interface IValue {
-
+ ///
+ /// The description of the value
+ ///
+ /// The description of the IValue
string GetDescription();
+ ///
+ /// Converts the value to an integer
+ ///
+ /// the integer representation if the IValue
int ToInt();
+ ///
+ /// Get the double representation if the IValue
+ ///
+ /// the double representation if the IValue
double ToDouble();
+ ///
+ /// Get the boolean representation if the IValue
+ ///
+ /// the boolean representation if the IValue
bool ToBool();
+ ///
+ /// Get the color representation if the IValue
+ ///
+ /// the color representation if the IValue
Color ToColor();
+ ///
+ /// Gets the original type of the IValue
+ ///
+ /// original type of the IValue
string GetOriginalType();
+ ///
+ /// Checks if the IValue is initialised
+ ///
+ /// True if IValue is initialised
bool isInitialised();
+ ///
+ /// Clones the IValue
+ ///
+ ///
IValue Clone();
}
}
\ No newline at end of file
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/UpdateVariable.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/UpdateVariable.cs
index 0e2c156..5519a38 100644
--- a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/UpdateVariable.cs
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/UpdateVariable.cs
@@ -1,33 +1,60 @@
using System;
namespace Advanced_Software_Engineering.Verbs.Value {
-
+ ///
+ /// Used for updating the variables
+ ///
public class UpdateVariable : IVerb {
- protected ValueStorage storage;
- protected string name;
- protected IValue value;
+ private ValueStorage storage;
+ private string name;
+ private IValue value;
+ ///
+ /// Initilise the object
+ ///
+ /// The storage object
+ /// The name of the variable
+ /// The value of the variable
private void Init(ValueStorage storage, string name, IValue value) {
this.name = name;
this.value = value;
this.storage = storage;
}
+ ///
+ /// Create a new UpdateVariable object
+ ///
+ /// The storage object
+ /// The name of the variable
+ /// The value of the variable
public UpdateVariable(ValueStorage storage, string name, IValue value) {
Init(storage, name, value);
}
+ ///
+ /// Create a new UpdateVariable object
+ ///
+ /// The storage object
+ /// The name of the variable
+ /// The expression of the value
public UpdateVariable(ValueStorage storage, string name, string value) {
// incoming values look something like this "= 10"
// or "= 10 + i"
Init(storage, name, ValueHelper.ConvertToIValue(value, storage));
}
+ ///
+ /// Executes the verb and updates the variable
+ ///
public void ExecuteVerb() {
if (!storage.CheckVariableExists(name)) throw new Exception("Cannot update variable because it is not declared");
storage.SetVariable(name, value.Clone());
}
+ ///
+ /// Gets the description of the update
+ ///
+ /// A string representation of the description of the update
public string GetDescription() {
return "Updates " + name + " to " + value;
}
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueFactory.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueFactory.cs
index 695744e..5f9fc0b 100644
--- a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueFactory.cs
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueFactory.cs
@@ -3,7 +3,9 @@ using Advanced_Software_Engineering.Verbs.Value.ValueTypes;
using System;
namespace Advanced_Software_Engineering.Verbs.Value {
-
+ ///
+ /// Value factory creates values
+ ///
public class ValueFactory {
///
@@ -11,7 +13,7 @@ namespace Advanced_Software_Engineering.Verbs.Value {
///
/// Text representation of the value
/// What type the value should be
- ///
+ /// a new IValue
public static IValue CreateValue(string value, string type) {
switch (type) {
case "int":
@@ -31,6 +33,16 @@ namespace Advanced_Software_Engineering.Verbs.Value {
}
}
+ ///
+ /// Creates a constant Value to be used later during execution. Only used for Color
+ ///
+ /// The storage
+ /// First parameter
+ /// Second parameter
+ /// Third parameter
+ /// Fourth parameter
+ /// the type
+ /// a new IValue
public static IValue CreateValue(ValueStorage storage, string paramater1, string paramater2, string parameter3, string parameter4, string type) {
switch (type) {
case "color":
@@ -46,6 +58,15 @@ namespace Advanced_Software_Engineering.Verbs.Value {
}
}
+ ///
+ /// Creates a constant Value to be used later during execution. Only used for Color
+ ///
+ /// The storage
+ /// First parameter
+ /// Second parameter
+ /// Third parameter
+ /// the type
+ /// a new IValue
public static IValue CreateValue(ValueStorage storage, string paramater1, string paramater2, string parameter3, string type) {
switch (type) {
case "color":
@@ -60,20 +81,41 @@ namespace Advanced_Software_Engineering.Verbs.Value {
}
}
+ ///
+ /// Creates a constant Value to be used later during execution
+ ///
+ /// Text representation of the value
+ /// The value storage to check
+ /// a new IValue
public static IValue CreateValue(ValueStorage storage, string value) {
value = HelperFunctions.Strip(value);
if (storage.CheckVariableExists(value)) return new VariableValue(storage, value);
else return ValueHelper.ConvertToIValue(value, storage);
}
+ ///
+ /// Create a new boolean IValue
+ ///
+ /// boolean input
+ ///
public static IValue CreateValue(bool b) {
return new BoolValue(b);
}
+ ///
+ /// Create a new double IValue
+ ///
+ /// double input
+ ///
public static IValue CreateValue(double d) {
return new DoubleValue(d);
}
+ ///
+ /// Create a new int IValue
+ ///
+ /// int input
+ ///
public static IValue CreateValue(int i) {
return new IntValue(i);
}
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueHelper.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueHelper.cs
index afc029c..35fcbbc 100644
--- a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueHelper.cs
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueHelper.cs
@@ -104,6 +104,11 @@ namespace Advanced_Software_Engineering.Verbs.Value {
return Color.FromArgb(a, r, g, b);
}
+ ///
+ /// Convert to boolean
+ ///
+ /// A text boolean
+ /// boolean representation of the text
public static bool ConvertToBool(string text) {
switch (text) {
case "true":
@@ -121,6 +126,12 @@ namespace Advanced_Software_Engineering.Verbs.Value {
}
}
+ ///
+ /// Converts the text to IValue
+ ///
+ /// text to convert
+ /// storage to use (can be null) (optional)
+ /// An IValue representation of the text
public static IValue ConvertToIValue(string text, ValueStorage storage = null) {
text = HelperFunctions.Strip(text);
string value = text;
@@ -198,9 +209,5 @@ namespace Advanced_Software_Engineering.Verbs.Value {
throw new Exception("Could not convert " + text + " to any type");
}
-
- public static Exception ConvertToExpression(string expression) {
- throw new NotImplementedException();
- }
}
}
\ No newline at end of file
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueObjects/PointValue.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueObjects/PointValue.cs
index 0e04a83..c6518d0 100644
--- a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueObjects/PointValue.cs
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueObjects/PointValue.cs
@@ -2,33 +2,43 @@
namespace Advanced_Software_Engineering.Verbs.Value.ValueObjects {
+ ///
+ /// A point IValue. Simply the same as but with IValues intstead of ints.
+ ///
public class PointValue {
private readonly IValue x;
private readonly IValue y;
+ ///
+ /// Create a new PointValue
+ ///
+ /// X IValue
+ /// Y IValue
public PointValue(IValue x, IValue y) {
this.x = x;
this.y = y;
}
- public PointValue(ValueStorage storage, string parameter1, string parameter2) {
- x = ValueFactory.CreateValue(storage, parameter1);
- y = ValueFactory.CreateValue(storage, parameter2);
- }
-
- public PointValue(string parameter1, string parameter2) {
- x = ValueFactory.CreateValue(parameter1, "int");
- y = ValueFactory.CreateValue(parameter2, "int");
- }
-
+ ///
+ /// Get the X component
+ ///
+ /// the X component
public int GetX() {
return x.ToInt();
}
+ ///
+ /// Get the Y component
+ ///
+ /// the Y component
public int GetY() {
return y.ToInt();
}
+ ///
+ /// Get the .
+ ///
+ ///
public Point GetPoint() {
return new Point(GetX(), GetY());
}
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueStorage.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueStorage.cs
index 82c109b..b182a10 100644
--- a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueStorage.cs
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueStorage.cs
@@ -2,21 +2,41 @@
using System.Collections.Generic;
namespace Advanced_Software_Engineering.Verbs.Value {
-
+ ///
+ /// The storage for all the values
+ ///
public class ValueStorage {
- protected int currentStack;
- protected List> Variables = new List>();
+ private int currentStack;
+ ///
+ /// The list is structured something like this:
+ ///
+ /// {stack, stack, stack stack}
+ ///
+ /// Where 'stack' is a dictionary of the names and the values of the variables
+ ///
+ private List> Variables = new List>();
+
+ ///
+ /// Create a new ValueStorage
+ ///
public ValueStorage() {
Reset();
}
+ ///
+ /// Reset the ValueStorage
+ ///
public void Reset() {
Variables = new List>();
Variables.Add(new Dictionary());
currentStack = 0;
}
+ ///
+ /// Set the ValueStorage stack
+ ///
+ /// stack number
private void SetStack(int stack) {
if (stack < 0) throw new Exception("Stack cannot be less than 0");
@@ -32,16 +52,28 @@ namespace Advanced_Software_Engineering.Verbs.Value {
currentStack = stack;
}
+ ///
+ /// Increase the stack
+ ///
public void IncreaseStack() {
SetStack(currentStack + 1);
}
+ ///
+ /// Decrease the stack
+ ///
public void DecreaseStack() {
if (currentStack > 0) {
SetStack(currentStack - 1);
}
}
+ ///
+ /// Set a variable
+ ///
+ /// Variable name
+ /// the start stack
+ /// the IValue
private void SetVariable(string name, int stack, IValue value) {
for (int internalStack = stack; internalStack >= 0; internalStack--) {
if (value == null || CheckVariableExists(name, internalStack)) {
@@ -52,14 +84,30 @@ namespace Advanced_Software_Engineering.Verbs.Value {
Variables[stack][name] = value;
}
+ ///
+ /// Set a variable
+ ///
+ /// Variable name
+ /// the IValue
public void SetVariable(string name, IValue value) {
SetVariable(name, currentStack, value);
}
+ ///
+ /// Gets the variable at the specified stack
+ ///
+ /// variable name
+ /// stack
+ /// IValue
private IValue GetVariable(string name, int stack) {
return Variables[stack][name];
}
+ ///
+ /// Gets the variable at the first available stack
+ ///
+ /// the names of the variable
+ /// IValue
public IValue GetVariable(string name) {
for (int stack = currentStack; stack >= 0; stack--) {
if (CheckVariableExists(name, stack) && GetVariable(name, stack) != null) return GetVariable(name, stack);
@@ -67,11 +115,22 @@ namespace Advanced_Software_Engineering.Verbs.Value {
throw new Exception("Cannot find variable " + name);
}
+ ///
+ /// Check if the variable exists at the stack specified
+ ///
+ /// variable name
+ /// stack
+ /// IValue
private bool CheckVariableExists(string name, int stack) {
if (name == null) return false;
return Variables[stack].ContainsKey(name);
}
+ ///
+ /// Check if the variable exists in the first available stack
+ ///
+ /// variable name
+ /// IValue
public bool CheckVariableExists(string name) {
if (name == null) return false;
for (int stack = currentStack; stack >= 0; stack--) {
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueTypes/ExpressionValue.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueTypes/ExpressionValue.cs
index 24d42e7..96fd0cb 100644
--- a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueTypes/ExpressionValue.cs
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueTypes/ExpressionValue.cs
@@ -2,20 +2,41 @@
using System.Drawing;
namespace Advanced_Software_Engineering.Verbs.Value {
-
+ ///
+ /// Expression values are used when there are two IValues that need to be added or subtracted or anything from each other.
+ ///
public class ExpressionValue : IValue {
+ ///
+ /// An operation denoting addition
+ ///
public const int ADD = 0;
+
+ ///
+ /// An operation denoting subtraction
+ ///
public const int SUBTRACT = 1;
+
+ ///
+ /// An operation denoting multiplication
+ ///
public const int MULTIPLY = 2;
+
+ ///
+ /// An operation denoting division
+ ///
public const int DIVIDE = 3;
+
private readonly IValue variable1;
private readonly IValue variable2;
private readonly int operation;
- private readonly bool evaluated = false;
- private IValue evaluatedValue;
-
+ ///
+ /// Create a new Expression Value based on the two IValues
+ ///
+ /// IValue to perform the operation on
+ /// IValue to perform the operation on
+ /// The operation. Can be , , or .
public ExpressionValue(IValue variable1, IValue variable2, int operation) {
this.variable1 = variable1;
this.variable2 = variable2;
@@ -25,6 +46,12 @@ namespace Advanced_Software_Engineering.Verbs.Value {
if (operation > 3 && operation < 0) throw new Exception("Bad operation");
}
+ ///
+ /// Create a new Expression Value based on the two IValues
+ ///
+ /// IValue to perform the operation on
+ /// IValue to perform the operation on
+ /// The operation. Can be "+"(), "-"(), "*"() or "/"().
public ExpressionValue(IValue variable1, IValue variable2, string operation) {
switch (operation) {
case "+":
@@ -54,10 +81,14 @@ namespace Advanced_Software_Engineering.Verbs.Value {
if (this.operation > 3 && this.operation < 0) throw new Exception("Bad operation");
}
+ ///
+ /// Evaluates the expression.
+ ///
+ /// an IValue with the result
private IValue Evaluate() {
IValue variable1 = this.variable1.Clone();
IValue variable2 = this.variable2.Clone();
-
+ IValue evaluatedValue = null;
string outputType = variable1.GetOriginalType();
switch (outputType) {
@@ -94,6 +125,10 @@ namespace Advanced_Software_Engineering.Verbs.Value {
return evaluatedValue;
}
+ ///
+ /// Describes the expression
+ ///
+ /// A string description of the expression
public string GetDescription() {
string operation;
switch (this.operation) {
@@ -119,30 +154,58 @@ namespace Advanced_Software_Engineering.Verbs.Value {
return "Expression of the variables " + variable1 + " and " + variable2 + " being " + operation;
}
+ ///
+ /// Get the type of the expression
+ ///
+ /// "expression"
public string GetOriginalType() {
return "expression";
}
+ ///
+ /// Expressions are always initialised
+ ///
+ /// true
public bool isInitialised() {
return true;
}
+ ///
+ /// Gets the bool of the result
+ ///
+ /// bool value of the result
public bool ToBool() {
return Evaluate().ToBool();
}
+ ///
+ /// Gets the color of the result
+ ///
+ /// color value of the result
public Color ToColor() {
return Evaluate().ToColor();
}
+ ///
+ /// Gets the double value of the result
+ ///
+ /// double value of the result
public double ToDouble() {
return Evaluate().ToDouble();
}
+ ///
+ /// Gets the int of the result
+ ///
+ /// int value of the result
public int ToInt() {
return Evaluate().ToInt();
}
+ ///
+ /// Clones the value of the result
+ ///
+ /// A new IValue
public IValue Clone() {
return Evaluate();
}
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueTypes/VariableValue.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueTypes/VariableValue.cs
index 512b3f4..2c4712a 100644
--- a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueTypes/VariableValue.cs
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Value/ValueTypes/VariableValue.cs
@@ -2,51 +2,94 @@
using System.Drawing;
namespace Advanced_Software_Engineering.Verbs.Value.ValueTypes {
-
+ ///
+ /// Variable value is responsible for setting up values for to then update
+ ///
public class VariableValue : IValue {
private readonly ValueStorage storage;
private readonly string variableName;
+ ///
+ /// The new VariableValue
+ ///
+ /// the storage to use
+ /// variable name
public VariableValue(ValueStorage storage, string variableName) {
this.variableName = variableName;
if (!storage.CheckVariableExists(variableName)) throw new Exception("Tried to access " + variableName + " before it was assigned. ");
this.storage = storage;
}
- private IValue get() {
+ ///
+ /// Get the variable value
+ ///
+ ///
+ private IValue Get() {
return storage.GetVariable(variableName);
}
+ ///
+ /// Gets the description of the IValue
+ ///
+ /// description of the IValue
public string GetDescription() {
- return get().GetDescription();
+ return Get().GetDescription();
}
+ ///
+ /// Gets the original type of the IValue
+ ///
+ /// original type of the IValue
public string GetOriginalType() {
- return get().GetOriginalType();
+ return Get().GetOriginalType();
}
+ ///
+ /// Get the initialised state of the IValue
+ ///
+ /// initialised state of the IValue
public bool isInitialised() {
- return get().isInitialised();
+ return Get().isInitialised();
}
+ ///
+ /// Converts the IValue to a boolean
+ ///
+ /// Boolean value of the IValue
public bool ToBool() {
- return get().ToBool();
+ return Get().ToBool();
}
+ ///
+ /// Converts the IValue to a color
+ ///
+ /// Color value of the IValue
public Color ToColor() {
- return get().ToColor();
+ return Get().ToColor();
}
+ ///
+ /// Converts the IValue to a double
+ ///
+ /// Double value of the IValue
public double ToDouble() {
- return get().ToDouble();
+ return Get().ToDouble();
}
+ ///
+ /// Converts the IValue to an integer
+ ///
+ /// Int value of the IValue
public int ToInt() {
- return get().ToInt();
+ return Get().ToInt();
}
+ ///
+ /// Clone the value and return it
+ ///
+ /// Cloned IValue
public IValue Clone() {
- return get().Clone();
+ return Get().Clone();
}
}
}
\ No newline at end of file