Changed IValue interface

This commit is contained in:
Lukasz Baldyga committed 2020-11-26 12:30:34 +00:00
1 parent fbbda5df3b
commit 9309b975a6
5 files changed
+22 -28

No files matched your search

@@ -1,9 +1,8 @@
using System;
using System.Drawing;
using System.Drawing;
namespace Advanced_Software_Engineering.Verbs.Value {
internal interface IValue {
public interface IValue {
string GetDescription();
@@ -15,7 +14,7 @@ namespace Advanced_Software_Engineering.Verbs.Value {
Color ToColor();
Type GetOriginalType();
string GetOriginalType();
bool isInitialised();
}
@@ -4,11 +4,10 @@ using System.Drawing;
namespace Advanced_Software_Engineering.Verbs.Value.ValueTypes {
internal class BoolValue : IValue {
private bool initialised = false;
bool initialised = false;
bool value;
Type type = typeof(bool);
private bool value;
private Type type = typeof(bool);
public BoolValue(bool value) {
this.value = value;
@@ -23,8 +22,8 @@ namespace Advanced_Software_Engineering.Verbs.Value.ValueTypes {
else return "an unset boolean value";
}
public Type GetOriginalType() {
return type;
public string GetOriginalType() {
return "bool";
}
public bool ToBool() {
@@ -4,11 +4,10 @@ using System.Drawing;
namespace Advanced_Software_Engineering.Verbs.Value.ValueTypes {
internal class ColorValue : IValue {
private bool initialised = false;
bool initialised = false;
Color value;
Type type = typeof(Color);
private Color value;
private Type type = typeof(Color);
public ColorValue(Color value) {
this.value = value;
@@ -23,8 +22,8 @@ namespace Advanced_Software_Engineering.Verbs.Value.ValueTypes {
else return "An uninitialised color";
}
public Type GetOriginalType() {
return type;
public string GetOriginalType() {
return "color";
}
public bool ToBool() {
@@ -4,14 +4,13 @@ using System.Drawing;
namespace Advanced_Software_Engineering.Verbs.Value.ValueTypes {
internal class DoubleValue : IValue {
private bool initialised = false;
bool initialised = false;
private bool colorValueCacheAvailable = false;
private Color colorValueCache;
bool colorValueCacheAvailable = false;
Color colorValueCache;
double value;
Type type = typeof(double);
private double value;
private Type type = typeof(double);
public DoubleValue(double value) {
this.value = value;
@@ -21,8 +20,8 @@ namespace Advanced_Software_Engineering.Verbs.Value.ValueTypes {
return "an double value of " + value;
}
public Type GetOriginalType() {
return type;
public string GetOriginalType() {
return "double";
}
public bool ToBool() {
@@ -17,8 +17,6 @@ namespace Advanced_Software_Engineering.Verbs.Value.ValueTypes {
private bool colorValueCacheAvailable = false;
private Color colorValueCache;
private Type type = typeof(int);
public IntValue(int value) {
this.value = value;
}
@@ -27,8 +25,8 @@ namespace Advanced_Software_Engineering.Verbs.Value.ValueTypes {
return "an integer value of " + value;
}
public Type GetOriginalType() {
return type;
public string GetOriginalType() {
return "int";
}
public bool ToBool() {