diff options
author | qadeer <qadeer@microsoft.com> | 2011-11-07 14:42:16 -0800 |
---|---|---|
committer | qadeer <qadeer@microsoft.com> | 2011-11-07 14:42:16 -0800 |
commit | eaa54c238d6f841b08b8084cf8743e13ac167eb6 (patch) | |
tree | 4f41ff780b9f17c77a5d819203845c2f099cdf66 /Source/Model/Model.cs | |
parent | 2d8f00244e8dcc470d5400e76ae71a0fde57762d (diff) |
some refactoring suggested by Michal
Diffstat (limited to 'Source/Model/Model.cs')
-rw-r--r-- | Source/Model/Model.cs | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/Source/Model/Model.cs b/Source/Model/Model.cs index ee661e1b..c725c96a 100644 --- a/Source/Model/Model.cs +++ b/Source/Model/Model.cs @@ -123,23 +123,27 @@ namespace Microsoft.Boogie public override string ToString() { return string.Format("as-array[{0}]", Value.Name); }
}
- public class DataValue : Element
+ public class DatatypeValue : Element
{
public readonly string ConstructorName;
- public readonly List<Element> Arguments;
- internal DataValue(Model p, string name, List<Element> args) : base(p) { ConstructorName = name; Arguments = args; }
+ public readonly Element[] Arguments;
+ internal DatatypeValue(Model p, string name, List<Element> args) : base(p) {
+ ConstructorName = name;
+ Arguments = args.ToArray();
+ }
public override ElementKind Kind { get { return ElementKind.DataValue; } }
public override string ToString() {
- string str = ConstructorName + "(";
+ StringBuilder builder = new StringBuilder();
+ builder.Append(ConstructorName + "(");
int count = 0;
- foreach (DataValue arg in Arguments) {
+ foreach (DatatypeValue arg in Arguments) {
count++;
- str = str + arg;
- if (count < Arguments.Count)
- str = str + ", ";
+ builder.Append(arg);
+ if (count < Arguments.Length)
+ builder.Append(", ");
}
- str = str + ")";
- return str;
+ builder.Append(")");
+ return builder.ToString();
}
}
#endregion
@@ -438,7 +442,7 @@ namespace Microsoft.Boogie var fnName = name.Substring(9, name.Length - 10);
return new Array(this, MkFunc(fnName, 1));
} else {
- return new DataValue(this, name, new List<Element>());
+ return new DatatypeValue(this, name, new List<Element>());
}
}
@@ -775,7 +779,7 @@ namespace Microsoft.Boogie for (int i = 1; i < os.Count; i++) {
args.Add(GetElt(os[i]));
}
- return new DataValue(currModel, (string)os[0], args);
+ return new DatatypeValue(currModel, (string)os[0], args);
}
Element GetElt(string name)
|