Private
Public Access
Added some verbs
This commit is contained in:
1 parent
f1bb73f1d6
commit
35bc68cfb6
4 files changed
+60
-3
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) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+21
-2
@@ -1,11 +1,30 @@
|
||||
using System;
|
||||
using Advanced_Software_Engineering.Verbs.Value.ValueTypes;
|
||||
using System;
|
||||
|
||||
namespace Advanced_Software_Engineering.Verbs.Value {
|
||||
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));
|
||||
|
||||
ValueFactory(string value, Type TypeHint = null) {
|
||||
case "double":
|
||||
return new DoubleValue(ValueHelper.ConvertToDouble(value));
|
||||
|
||||
default:
|
||||
throw new Exception("Unknown expected type: " + type.ToString());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+6
-1
@@ -1,9 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
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() {
|
||||
throw new NotImplementedException();
|
||||
@@ -202,6 +202,11 @@ namespace Advanced_Software_Engineering {
|
||||
);
|
||||
} 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:
|
||||
throw new Exception("Unknown command");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user