Changeset 121 for branches/XmlTextReaderBranch/HeuristicLab.Data
- Timestamp:
- 04/14/08 21:51:15 (16 years ago)
- Location:
- branches/XmlTextReaderBranch
- Files:
-
- 14 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/XmlTextReaderBranch/HeuristicLab.Data/BoolArrayData.cs
r2 r121 49 49 return node; 50 50 } 51 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 52 base.Populate(node, restoredObjects); 53 string[] tokens = node.InnerText.Split(';'); 51 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 52 // base.Populate(node, restoredObjects); 53 // string[] tokens = node.InnerText.Split(';'); 54 // bool[] data = new bool[tokens.Length]; 55 // for(int i = 0; i < data.Length; i++) 56 // data[i] = bool.Parse(tokens[i]); 57 // Data = data; 58 //} 59 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 60 base.Populate(reader, restoredObjects); 61 string[] tokens = reader.ReadString().Split(';'); 54 62 bool[] data = new bool[tokens.Length]; 55 for 63 for(int i = 0; i < data.Length; i++) 56 64 data[i] = bool.Parse(tokens[i]); 57 65 Data = data; -
branches/XmlTextReaderBranch/HeuristicLab.Data/BoolData.cs
r2 r121 56 56 return node; 57 57 } 58 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 59 base.Populate(node, restoredObjects); 60 Data = bool.Parse(node.InnerText); 58 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 59 // base.Populate(node, restoredObjects); 60 // Data = bool.Parse(node.InnerText); 61 //} 62 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 63 base.Populate(reader, restoredObjects); 64 Data = bool.Parse(reader.ReadString()); 61 65 } 62 66 -
branches/XmlTextReaderBranch/HeuristicLab.Data/BoolMatrixData.cs
r2 r121 56 56 return node; 57 57 } 58 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 59 base.Populate(node, restoredObjects); 60 int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 61 int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 62 string[] tokens = node.InnerText.Split(';'); 58 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 59 // base.Populate(node, restoredObjects); 60 // int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 61 // int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 62 // string[] tokens = node.InnerText.Split(';'); 63 // bool[,] data = new bool[dim1, dim2]; 64 // for(int i = 0; i < dim1; i++) { 65 // for(int j = 0; j < dim2; j++) { 66 // data[i, j] = bool.Parse(tokens[i * dim2 + j]); 67 // } 68 // } 69 // Data = data; 70 //} 71 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 72 base.Populate(reader, restoredObjects); 73 int dim1 = int.Parse(reader["Dimension1"], CultureInfo.InvariantCulture.NumberFormat); 74 int dim2 = int.Parse(reader["Dimension2"], CultureInfo.InvariantCulture.NumberFormat); 75 string[] tokens = reader.ReadString().Split(';'); 63 76 bool[,] data = new bool[dim1, dim2]; 64 for 65 for 77 for(int i = 0; i < dim1; i++) { 78 for(int j = 0; j < dim2; j++) { 66 79 data[i, j] = bool.Parse(tokens[i * dim2 + j]); 67 80 } -
branches/XmlTextReaderBranch/HeuristicLab.Data/ConstrainedDoubleData.cs
r2 r121 61 61 return node; 62 62 } 63 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 64 base.Populate(node, restoredObjects); 65 base.Data = (DoubleData)PersistenceManager.Restore(node.SelectSingleNode("Value"), restoredObjects); 63 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 64 // base.Populate(node, restoredObjects); 65 // base.Data = (DoubleData)PersistenceManager.Restore(node.SelectSingleNode("Value"), restoredObjects); 66 //} 67 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 68 base.Populate(reader, restoredObjects); 69 base.Data = (DoubleData)PersistenceManager.Restore(reader, "Value", restoredObjects); 66 70 } 67 71 -
branches/XmlTextReaderBranch/HeuristicLab.Data/ConstrainedIntData.cs
r2 r121 61 61 return node; 62 62 } 63 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 64 base.Populate(node, restoredObjects); 65 base.Data = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Value"), restoredObjects); 63 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 64 // base.Populate(node, restoredObjects); 65 // base.Data = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Value"), restoredObjects); 66 //} 67 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 68 base.Populate(reader, restoredObjects); 69 base.Data = (IntData)PersistenceManager.Restore(reader, "Value", restoredObjects); 66 70 } 67 71 -
branches/XmlTextReaderBranch/HeuristicLab.Data/ConstrainedItemList.cs
r2 r121 67 67 } 68 68 69 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 70 base.Populate(node, restoredObjects); 71 XmlNode listNode = node.SelectSingleNode("ListItems"); 69 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 70 // base.Populate(node, restoredObjects); 71 // XmlNode listNode = node.SelectSingleNode("ListItems"); 72 // list = new List<IItem>(); 73 // for(int i = 0; i < listNode.ChildNodes.Count; i++) 74 // list.Add((IItem)PersistenceManager.Restore(listNode.ChildNodes[i], restoredObjects)); 75 // suspendConstraintCheck = bool.Parse(listNode.Attributes["SuspendConstraintCheck"].Value); 76 //} 77 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 78 base.Populate(reader, restoredObjects); 79 reader.ReadStartElement("ListItems"); 80 suspendConstraintCheck = bool.Parse(reader["SuspendConstraintCheck"]); 72 81 list = new List<IItem>(); 73 for (int i = 0; i < listNode.ChildNodes.Count; i++)74 list.Add((IItem)PersistenceManager.Restore( listNode.ChildNodes[i], restoredObjects));75 suspendConstraintCheck = bool.Parse(listNode.Attributes["SuspendConstraintCheck"].Value);82 while(reader.IsStartElement()) 83 list.Add((IItem)PersistenceManager.Restore(reader, restoredObjects)); 84 reader.ReadEndElement(); 76 85 } 77 86 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Data/DoubleArrayData.cs
r2 r121 50 50 return node; 51 51 } 52 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 53 base.Populate(node, restoredObjects); 54 string[] tokens = node.InnerText.Split(';'); 52 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 53 // base.Populate(node, restoredObjects); 54 // string[] tokens = node.InnerText.Split(';'); 55 // double[] data = new double[tokens.Length]; 56 // for(int i = 0; i < data.Length; i++) 57 // if(double.TryParse(tokens[i], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i]) == false) { 58 // throw new FormatException("Can't parse " + tokens[i] + " as double value."); 59 // } 60 // Data = data; 61 //} 62 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 63 base.Populate(reader, restoredObjects); 64 string[] tokens = reader.ReadString().Split(';'); 55 65 double[] data = new double[tokens.Length]; 56 66 for(int i = 0; i < data.Length; i++) -
branches/XmlTextReaderBranch/HeuristicLab.Data/DoubleData.cs
r2 r121 57 57 return node; 58 58 } 59 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 60 base.Populate(node, restoredObjects); 59 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 60 // base.Populate(node, restoredObjects); 61 // double data; 62 // if(double.TryParse(node.InnerText, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data) == true) { 63 // Data = data; 64 // } else { 65 // throw new FormatException("Can't parse " + node.InnerText + " as double value."); 66 // } 67 //} 68 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 69 base.Populate(reader, restoredObjects); 61 70 double data; 62 if(double.TryParse( node.InnerText, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data) == true) {71 if(double.TryParse(reader.ReadString(), NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data) == true) { 63 72 Data = data; 64 73 } else { 65 throw new FormatException("Can't parse " + node.InnerText + " as double value.");74 throw new FormatException("Can't parse " + reader.ReadString() + " as double value."); 66 75 } 67 76 } -
branches/XmlTextReaderBranch/HeuristicLab.Data/DoubleMatrixData.cs
r2 r121 56 56 return node; 57 57 } 58 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 59 base.Populate(node, restoredObjects); 60 int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 61 int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 62 string[] tokens = node.InnerText.Split(';'); 58 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 59 // base.Populate(node, restoredObjects); 60 // int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 61 // int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 62 // string[] tokens = node.InnerText.Split(';'); 63 // double[,] data = new double[dim1, dim2]; 64 // for(int i = 0; i < dim1; i++) { 65 // for(int j = 0; j < dim2; j++) { 66 // if(double.TryParse(tokens[i * dim2 + j], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i, j]) == false) { 67 // throw new FormatException("Can't parse " + tokens[i * dim2 + j] + " as double value."); 68 // } 69 // } 70 // } 71 // Data = data; 72 //} 73 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 74 base.Populate(reader, restoredObjects); 75 int dim1 = int.Parse(reader["Dimension1"], CultureInfo.InvariantCulture.NumberFormat); 76 int dim2 = int.Parse(reader["Dimension2"], CultureInfo.InvariantCulture.NumberFormat); 77 string[] tokens = reader.ReadString().Split(';'); 63 78 double[,] data = new double[dim1, dim2]; 64 for 65 for 66 if(double.TryParse(tokens[i * dim2 + j], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i, j]) ==false) {79 for(int i = 0; i < dim1; i++) { 80 for(int j = 0; j < dim2; j++) { 81 if(double.TryParse(tokens[i * dim2 + j], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i, j]) == false) { 67 82 throw new FormatException("Can't parse " + tokens[i * dim2 + j] + " as double value."); 68 83 } -
branches/XmlTextReaderBranch/HeuristicLab.Data/IntArrayData.cs
r2 r121 50 50 return node; 51 51 } 52 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 53 base.Populate(node, restoredObjects); 54 if (!node.InnerText.Equals("")) { 55 string[] tokens = node.InnerText.Split(';'); 52 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 53 // base.Populate(node, restoredObjects); 54 // if(!node.InnerText.Equals("")) { 55 // string[] tokens = node.InnerText.Split(';'); 56 // int[] data = new int[tokens.Length]; 57 // for(int i = 0; i < data.Length; i++) 58 // data[i] = int.Parse(tokens[i], CultureInfo.InvariantCulture.NumberFormat); 59 // Data = data; 60 // } 61 //} 62 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 63 base.Populate(reader, restoredObjects); 64 string innerText = reader.ReadString(); 65 if(!innerText.Equals("")) { 66 string[] tokens = innerText.Split(';'); 56 67 int[] data = new int[tokens.Length]; 57 for 68 for(int i = 0; i < data.Length; i++) 58 69 data[i] = int.Parse(tokens[i], CultureInfo.InvariantCulture.NumberFormat); 59 70 Data = data; -
branches/XmlTextReaderBranch/HeuristicLab.Data/IntData.cs
r2 r121 57 57 return node; 58 58 } 59 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 60 base.Populate(node, restoredObjects); 61 Data = int.Parse(node.InnerText, CultureInfo.InvariantCulture.NumberFormat); 59 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 60 // base.Populate(node, restoredObjects); 61 // Data = int.Parse(node.InnerText, CultureInfo.InvariantCulture.NumberFormat); 62 //} 63 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 64 base.Populate(reader, restoredObjects); 65 Data = int.Parse(reader.ReadString(), CultureInfo.InvariantCulture.NumberFormat); 62 66 } 63 67 -
branches/XmlTextReaderBranch/HeuristicLab.Data/IntMatrixData.cs
r2 r121 56 56 return node; 57 57 } 58 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 59 base.Populate(node, restoredObjects); 60 int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 61 int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 62 string[] tokens = node.InnerText.Split(';'); 58 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 59 // base.Populate(node, restoredObjects); 60 // int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 61 // int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 62 // string[] tokens = node.InnerText.Split(';'); 63 // int[,] data = new int[dim1, dim2]; 64 // for(int i = 0; i < dim1; i++) { 65 // for(int j = 0; j < dim2; j++) { 66 // data[i, j] = int.Parse(tokens[i * dim2 + j], CultureInfo.InvariantCulture.NumberFormat); 67 // } 68 // } 69 // Data = data; 70 //} 71 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 72 base.Populate(reader, restoredObjects); 73 int dim1 = int.Parse(reader["Dimension1"], CultureInfo.InvariantCulture.NumberFormat); 74 int dim2 = int.Parse(reader["Dimension2"], CultureInfo.InvariantCulture.NumberFormat); 75 string[] tokens = reader.ReadString().Split(';'); 63 76 int[,] data = new int[dim1, dim2]; 64 for 65 for 77 for(int i = 0; i < dim1; i++) { 78 for(int j = 0; j < dim2; j++) { 66 79 data[i, j] = int.Parse(tokens[i * dim2 + j], CultureInfo.InvariantCulture.NumberFormat); 67 80 } -
branches/XmlTextReaderBranch/HeuristicLab.Data/ItemList_T.cs
r69 r121 56 56 return node; 57 57 } 58 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 59 base.Populate(node, restoredObjects); 60 for (int i = 0; i < node.ChildNodes.Count; i++) 61 list.Add((T) PersistenceManager.Restore(node.ChildNodes[i], restoredObjects)); 58 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 59 // base.Populate(node, restoredObjects); 60 // for(int i = 0; i < node.ChildNodes.Count; i++) 61 // list.Add((T)PersistenceManager.Restore(node.ChildNodes[i], restoredObjects)); 62 //} 63 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 64 base.Populate(reader, restoredObjects); 65 while(reader.IsStartElement()) 66 list.Add((T)PersistenceManager.Restore(reader, restoredObjects)); 62 67 } 63 68 -
branches/XmlTextReaderBranch/HeuristicLab.Data/StringData.cs
r2 r121 56 56 return node; 57 57 } 58 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 59 base.Populate(node, restoredObjects); 60 Data = node.InnerText; 58 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 59 // base.Populate(node, restoredObjects); 60 // Data = node.InnerText; 61 //} 62 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 63 base.Populate(reader, restoredObjects); 64 Data = reader.ReadString(); 61 65 } 62 66
Note: See TracChangeset
for help on using the changeset viewer.