Private
Public Access
Code clean up
This commit is contained in:
1 parent
9ee1c79795
commit
c726739419
6 files changed
+47
-53
No files matched your search
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Advanced_Software_Engineering {
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Advanced_Software_Engineering {
|
||||
|
||||
public static partial class MenuManager {
|
||||
|
||||
/// <summary>
|
||||
/// The variable simply keep track of the windows that are currently shown (excluding <see cref="Menu"/>).
|
||||
/// </summary>
|
||||
@@ -22,4 +20,4 @@ namespace Advanced_Software_Engineering {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-7
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Advanced_Software_Engineering.Verbs.Value {
|
||||
|
||||
@@ -10,9 +9,10 @@ namespace Advanced_Software_Engineering.Verbs.Value {
|
||||
|
||||
//Common characters that people might try
|
||||
private char[] illegalCharacters = "1234567890!?/+- \"'@#~;:><,.`¬|[]{}\\£$%^&*()".ToCharArray();
|
||||
private string[] illegalNames =
|
||||
|
||||
private string[] illegalNames =
|
||||
{ "var",
|
||||
"move", "moveto",
|
||||
"move", "moveto",
|
||||
"drawto", "line", "lineto",
|
||||
"regularpolygon", "rp",
|
||||
"square",
|
||||
@@ -49,7 +49,7 @@ namespace Advanced_Software_Engineering.Verbs.Value {
|
||||
this.drawer = drawer;
|
||||
|
||||
//seperate assignment characters from everything else
|
||||
foreach(string op in new string[]{ "=", "+", "-", "*", "/" }) {
|
||||
foreach (string op in new string[] { "=", "+", "-", "*", "/" }) {
|
||||
assignment = assignment.Replace(op, " " + op + " ");
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Advanced_Software_Engineering.Verbs.Value {
|
||||
|
||||
//seperate on spaces
|
||||
string[] assignmentStrings = HelperFunctions.StripStringArray(assignment.Split(" "[0])).ToArray();
|
||||
|
||||
|
||||
//check if is actually assignment
|
||||
if (!(assignmentStrings[1] == "=")) throw new Exception("No assignment in " + assignment);
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Advanced_Software_Engineering.Verbs.Value {
|
||||
if (!CheckName(name)) throw new Exception("'" + name + "' name not allowed");
|
||||
|
||||
//for single number assignments ["i", "=", "20"]
|
||||
if (assignmentStrings.Length == 3) value = ValueFactory.CreateValue(drawer, assignmentStrings[2]);
|
||||
if (assignmentStrings.Length == 3) value = ValueFactory.CreateValue(drawer, assignmentStrings[2]);
|
||||
|
||||
//for expressions ["i", "=", "20", "+", "30"]
|
||||
//or some comparisons ["i", "=", "20", ">", "30"]
|
||||
@@ -97,7 +97,6 @@ namespace Advanced_Software_Engineering.Verbs.Value {
|
||||
throw new Exception("Not implemented yet");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void ExecuteVerb() {
|
||||
|
||||
+1
-2
@@ -26,7 +26,7 @@ namespace Advanced_Software_Engineering.Verbs.Value {
|
||||
}
|
||||
|
||||
public ExpressionValue(Drawer drawer, IValue variable1, IValue variable2, string operation) {
|
||||
switch(operation) {
|
||||
switch (operation) {
|
||||
case "+":
|
||||
this.operation = ADD;
|
||||
break;
|
||||
@@ -49,7 +49,6 @@ namespace Advanced_Software_Engineering.Verbs.Value {
|
||||
|
||||
this.variable1 = variable1;
|
||||
this.variable2 = variable2;
|
||||
|
||||
|
||||
//Check for bad input
|
||||
if (this.operation > 3 && this.operation < 0) throw new Exception("Bad operation");
|
||||
|
||||
@@ -30,7 +30,6 @@ namespace Advanced_Software_Engineering {
|
||||
|
||||
//check for names in directory
|
||||
if (drawer.CheckVariableExists(command)) {
|
||||
|
||||
if (commandParameters.Length == 1) {
|
||||
return new UpdateVariable(drawer, command, ValueFactory.CreateValue(drawer, commandParameters[0]));
|
||||
} else throw new Exception(command + "needs something to be assigned to it");
|
||||
|
||||
Reference in new issue
Block a user