private static void RemovePHContentFileNameAttribute() { ConnectiveDeviceCalculation.RemovePHContentFileNameAttribute(ConnectiveDeviceCalculation.GetElement()); EquipmentCalculation.RemovePHContentFileNameAttribute(EquipmentCalculation.GetElement()); NetCalculation.RemovePHContentFileNameAttribute(NetCalculation.GetElement()); WireCalculation.RemovePHContentFileNameAttribute(WireCalculation.GetElement()); }
private static void RemoveDuplication() { ConnectiveDeviceCalculation.RemoveDuplication(ConnectiveDeviceCalculation.GetElement()); EquipmentCalculation.RemoveDuplication(EquipmentCalculation.GetElement()); NetCalculation.RemoveDuplication(NetCalculation.GetElement()); WireCalculation.RemoveDuplication(WireCalculation.GetElement()); }
public void DetermineManhattanDistance__Intro() { var firstWire = "R8,U5,L5,D3"; var secondWire = "U7,R6,D4,L4"; var result = WireCalculation.DetermineManhattanDistance(firstWire, secondWire); Assert.AreEqual(6, result); }
public void DetermineShortestLength_2() { var firstWire = "R98,U47,R26,D63,R33,U87,L62,D20,R33,U53,R51"; var secondWire = "U98,R91,D20,R16,D67,R40,U7,R15,U6,R7"; var result = WireCalculation.DetermineShortestLength(firstWire, secondWire); Assert.AreEqual(410, result); }
public void DetermineShortestLength_1() { var firstWire = "R75,D30,R83,U83,L12,D49,R71,U7,L72"; var secondWire = "U62,R66,U55,R34,D71,R55,D58,R83"; var result = WireCalculation.DetermineShortestLength(firstWire, secondWire); Assert.AreEqual(610, result); }
public void DetermineShortestLength_Intro() { var firstWire = "R8,U5,L5,D3"; var secondWire = "U7,R6,D4,L4"; var result = WireCalculation.DetermineShortestLength(firstWire, secondWire); Assert.AreEqual(30, result); }
public void DetermineManhattanDistance_2() { var firstWire = "R98,U47,R26,D63,R33,U87,L62,D20,R33,U53,R51"; var secondWire = "U98,R91,D20,R16,D67,R40,U7,R15,U6,R7"; var result = WireCalculation.DetermineManhattanDistance(firstWire, secondWire); Assert.AreEqual(135, result); }
public void DetermineManhattanDistance_1() { var firstWire = "R75,D30,R83,U83,L12,D49,R71,U7,L72"; var secondWire = "U62,R66,U55,R34,D71,R55,D58,R83"; var result = WireCalculation.DetermineManhattanDistance(firstWire, secondWire); Assert.AreEqual(159, result); }
private static List <string> GetErrorListForXMLObjects() { var eqErrorList = new EquipmentCalculation(new InvObjDuplication()).GetErrorList(); var cdevErrorList = new ConnectiveDeviceCalculation(new InvObjDuplication()).GetErrorList(); var netErrorList = new NetCalculation(new OtherObjDuplication()).GenerateErrorListAndCorrectDupTagList(); var wireErrorList = new WireCalculation(new OtherObjDuplication()).GenerateErrorListAndCorrectDupTagList(); return(eqErrorList.Union(cdevErrorList).Union(netErrorList).Union(wireErrorList).ToList()); }
private static void UpdateDuplicatedTagForOtherObject() { NetCalculation.GetElement().Elements().GroupBy(g => g.Attribute("TagNEO").Value).Where(x => x.Count() > 1).SelectMany(m => m).Remove(); NetCalculation.GetElement().Elements().GroupBy(g => g.Attribute("RATP").Value).Where(x => x.Count() > 1).SelectMany(m => m).Remove(); WireCalculation.GetElement().Elements().GroupBy(g => g.Attribute("TagNEO").Value).Where(x => x.Count() > 1).SelectMany(m => m).Remove(); WireCalculation.GetElement().Elements().GroupBy(g => g.Attribute("RATP").Value).Where(x => x.Count() > 1).SelectMany(m => m).Remove(); NetCalculation.AddCorrectTagsToElement(); WireCalculation.AddCorrectTagsToElement(); RemoveDuplication(); }
private static void CleanXMLElements() { ConnectiveDeviceCalculation.GetElement()?.RemoveAll(); EquipmentCalculation.GetElement()?.RemoveAll(); NetCalculation.GetElement()?.RemoveAll(); WireCalculation.GetElement()?.RemoveAll(); NetCalculation._correctDupTagNEO.Clear(); NetCalculation._correctDupTagRATP.Clear(); WireCalculation._correctDupTagNEO.Clear(); WireCalculation._correctDupTagRATP.Clear(); }
private static XDocument CreateXMLMappingFileDoc() { var mappingFile = new XDocument(); mappingFile.Add(new XElement("MAPPING")); RemovePHContentFileNameAttribute(); RemoveDuplication(); UpdateDuplicatedTagForOtherObject(); mappingFile.Root.Add(ConnectiveDeviceCalculation.GetElement()); mappingFile.Root.Add(EquipmentCalculation.GetElement()); mappingFile.Root.Add(NetCalculation.GetElement()); mappingFile.Root.Add(WireCalculation.GetElement()); return(mappingFile); }
//private static void ValidationInfo(object sender, ValidationEventArgs args) //{ // if (args.Severity == XmlSeverityType.Warning) // Console.WriteLine("\tWarning: Matching schema not found. No validation occurred." + args.Message); // else // Console.WriteLine("\tValidation error: " + args.Message); // //msg += e.Message + Environment.NewLine; //} private void CreateElementsInMappingFile(string directoryPathXMLFiles, XMLDefContentFileName xMLDefContent, XmlSchemaSet schema) { var contentFile = XDocument.Load(directoryPathXMLFiles + "\\" + xMLDefContent.contentFileName); if (xMLDefContent.contentFileName == null) { throw new ArgumentNullException(nameof(xMLDefContent.contentFileName)); } if (ValidateXMLContentFile(contentFile, xMLDefContent.contentFileName, schema)) { ConnectiveDeviceCalculation.CalculateContentFileForConnectiveDevice(contentFile, xMLDefContent); EquipmentCalculation.CalculateContentFileForEquipment(contentFile, xMLDefContent); NetCalculation.CalculateContentFileForNet(contentFile, xMLDefContent); WireCalculation.CalculateContentFileForWire(contentFile, xMLDefContent); } }