Private
Public Access
Added some verbs
This commit is contained in:
1 parent
f1bb73f1d6
commit
35bc68cfb6
4 files changed
+61
-4
No files matched your search
+28
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Advanced_Software_Engineering.Verbs.Value {
|
||||||
|
class ValueContainer {
|
||||||
|
|
||||||
|
Dictionary<string, IValue> variables = new Dictionary<string, IValue>();
|
||||||
|
|
||||||
|
public ValueContainer() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetVariable(string variableName, IValue iValue) {
|
||||||
|
if (variables.ContainsKey(variableName)) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeclareVariable(string variableName, IValue iValue) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeclareAndSetVariable(string variableName, IValue iValue) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
-3
@@ -1,11 +1,30 @@
|
|||||||
using System;
|
using Advanced_Software_Engineering.Verbs.Value.ValueTypes;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Advanced_Software_Engineering.Verbs.Value {
|
namespace Advanced_Software_Engineering.Verbs.Value {
|
||||||
class ValueFactory {
|
class ValueFactory {
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a constant Value to be used later during execution
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">Text representation of the value</param>
|
||||||
|
/// <param name="type">What type the value should be</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IValue CreateValue(string value, string type) {
|
||||||
|
switch (type) {
|
||||||
|
case "int":
|
||||||
|
return new IntValue(ValueHelper.ConvertToInt(value));
|
||||||
|
|
||||||
|
case "double":
|
||||||
|
return new DoubleValue(ValueHelper.ConvertToDouble(value));
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new Exception("Unknown expected type: " + type.ToString());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ValueFactory(string value, Type TypeHint = null) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-1
@@ -1,9 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Advanced_Software_Engineering.Verbs.Value.ValueTypes {
|
namespace Advanced_Software_Engineering.Verbs.Value.ValueTypes {
|
||||||
|
class VariableValue : IValue {
|
||||||
|
|
||||||
internal class BytesValue : IValue {
|
static Dictionary<string, IValue> variables = new Dictionary<string, IValue>();
|
||||||
|
|
||||||
public string GetDescription() {
|
public string GetDescription() {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
@@ -202,6 +202,11 @@ namespace Advanced_Software_Engineering {
|
|||||||
);
|
);
|
||||||
} else throw new Exception(command + " has an incorrect number of parameters");
|
} else throw new Exception(command + " has an incorrect number of parameters");
|
||||||
|
|
||||||
|
case "int":
|
||||||
|
if (parameterLength == 1) {
|
||||||
|
return new Verb
|
||||||
|
} else throw new Exception("ints need to be initialised");
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new Exception("Unknown command");
|
throw new Exception("Unknown command");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user