Changeset 1612 for trunk/sources/HeuristicLab.Persistence/3.3/Default
- Timestamp:
- 04/20/09 17:36:22 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Persistence/3.3/Default
- Files:
-
- 10 added
- 8 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Default/DebugString/DebugStringGenerator.cs
r1567 r1612 14 14 private readonly bool showRefs; 15 15 16 public DebugStringGenerator() : this( false) { }16 public DebugStringGenerator() : this(true) { } 17 17 18 18 public DebugStringGenerator(bool showRefs) { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/DoubleArray2XmlFormatters.cs
r1566 r1612 5 5 namespace HeuristicLab.Persistence.Default.Xml.Compact { 6 6 7 public abstract class DoubleArray2XmlFormatterBase<T> : NumberArray2XmlFormatterBase<T> {7 public abstract class DoubleArray2XmlFormatterBase<T> : NumberArray2XmlFormatterBase<T> where T : class{ 8 8 9 9 protected override string FormatValue(object o) { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/IntArray2XmlFormatters.cs
r1566 r1612 4 4 namespace HeuristicLab.Persistence.Default.Xml.Compact { 5 5 6 public abstract class IntArray2XmlFormatterBase<T> : NumberArray2XmlFormatterBase<T> {6 public abstract class IntArray2XmlFormatterBase<T> : NumberArray2XmlFormatterBase<T> where T : class{ 7 7 8 8 protected override string FormatValue(object o) { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/NumberArray2XmlFormatterBase.cs
r1566 r1612 6 6 namespace HeuristicLab.Persistence.Default.Xml.Compact { 7 7 8 public abstract class NumberArray2XmlFormatterBase<T> : FormatterBase<T, XmlString> {8 public abstract class NumberArray2XmlFormatterBase<T> : FormatterBase<T, XmlString> where T : class { 9 9 10 10 protected virtual string Separator { get { return ";"; } } … … 12 12 protected abstract object ParseValue(string o); 13 13 14 public override XmlString Format(T t) { 15 object o = (object)t; 16 Array a = (Array)o; 14 public override XmlString Format(T t) { 15 Array a = (Array)(object)t; 17 16 int[] lengths = new int[a.Rank]; 18 17 int[] lowerBounds = new int[a.Rank]; … … 75 74 } 76 75 } 77 } 78 object o = a; 79 return (T)o; 76 } 77 return (T)(object)a; 80 78 } 81 79 } -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs
r1570 r1612 10 10 using HeuristicLab.Persistence.Core.Tokens; 11 11 12 namespace HeuristicLab.Persistence.Default.Xml { 13 14 struct XmlStrings { 15 public const string PRIMITIVE = "PRIMITVE"; 16 public const string COMPOSITE = "COMPOSITE"; 17 public const string REFERENCE = "REFERENCE"; 18 public const string NULL = "NULL"; 19 public const string TYPECACHE = "TYPECACHE"; 20 public const string TYPE = "TYPE"; 21 public const string METAINFO = "METAINFO"; 22 } 12 namespace HeuristicLab.Persistence.Default.Xml { 23 13 24 14 public class XmlGenerator : GeneratorBase<string> { … … 116 106 protected override string Format(BeginToken beginToken) { 117 107 return CreateNodeStart( 118 XmlString s.COMPOSITE,108 XmlStringConstants.COMPOSITE, 119 109 new Dictionary<string, object> { 120 110 {"name", beginToken.Name}, … … 124 114 125 115 protected override string Format(EndToken endToken) { 126 return CreateNodeEnd(XmlString s.COMPOSITE);116 return CreateNodeEnd(XmlStringConstants.COMPOSITE); 127 117 } 128 118 129 119 protected override string Format(PrimitiveToken dataToken) { 130 return CreateNode(XmlString s.PRIMITIVE,120 return CreateNode(XmlStringConstants.PRIMITIVE, 131 121 new Dictionary<string, object> { 132 122 {"typeId", dataToken.TypeId}, … … 137 127 138 128 protected override string Format(ReferenceToken refToken) { 139 return CreateNode(XmlString s.REFERENCE,129 return CreateNode(XmlStringConstants.REFERENCE, 140 130 new Dictionary<string, object> { 141 131 {"ref", refToken.Id}, … … 144 134 145 135 protected override string Format(NullReferenceToken nullRefToken) { 146 return CreateNode(XmlString s.NULL,136 return CreateNode(XmlStringConstants.NULL, 147 137 new Dictionary<string, object>{ 148 138 {"name", nullRefToken.Name}}); … … 150 140 151 141 protected override string Format(MetaInfoBeginToken metaInfoBeginToken) { 152 return CreateNodeStart(XmlString s.METAINFO);142 return CreateNodeStart(XmlStringConstants.METAINFO); 153 143 } 154 144 155 145 protected override string Format(MetaInfoEndToken metaInfoEndToken) { 156 return CreateNodeEnd(XmlString s.METAINFO);146 return CreateNodeEnd(XmlStringConstants.METAINFO); 157 147 } 158 148 159 149 public IEnumerable<string> Format(List<TypeMapping> typeCache) { 160 yield return CreateNodeStart(XmlString s.TYPECACHE);150 yield return CreateNodeStart(XmlStringConstants.TYPECACHE); 161 151 foreach (var mapping in typeCache) 162 152 yield return CreateNode( 163 XmlString s.TYPE,153 XmlStringConstants.TYPE, 164 154 mapping.GetDict()); 165 yield return CreateNodeEnd(XmlString s.TYPECACHE);155 yield return CreateNodeEnd(XmlStringConstants.TYPECACHE); 166 156 } 167 157 -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlParser.cs
r1566 r1612 25 25 reader = XmlReader.Create(input, settings); 26 26 handlers = new Dictionary<string, Handler> { 27 {XmlString s.PRIMITIVE, ParsePrimitive},28 {XmlString s.COMPOSITE, ParseComposite},29 {XmlString s.REFERENCE, ParseReference},30 {XmlString s.NULL, ParseNull},31 {XmlString s.METAINFO, ParseMetaInfo},27 {XmlStringConstants.PRIMITIVE, ParsePrimitive}, 28 {XmlStringConstants.COMPOSITE, ParseComposite}, 29 {XmlStringConstants.REFERENCE, ParseReference}, 30 {XmlStringConstants.NULL, ParseNull}, 31 {XmlStringConstants.METAINFO, ParseMetaInfo}, 32 32 }; 33 33 } … … 105 105 XmlReader xmlReader = XmlReader.Create(reader); 106 106 while (xmlReader.Read()) { 107 if (xmlReader.Name == XmlString s.TYPE) {107 if (xmlReader.Name == XmlStringConstants.TYPE) { 108 108 typeCache.Add(new TypeMapping( 109 109 int.Parse(xmlReader.GetAttribute("id")),
Note: See TracChangeset
for help on using the changeset viewer.