using System; using System.Collections.Generic; using System.Linq; using SlabHandle; namespace MES.Interface { //禁忌树 public class TabuMapTree { private Dictionary sonTreeMap = new Dictionary(); public BP_ORDER_ITEM nodeSquare; public void add(IList squareList, int index) { if (index >= squareList.Count) { return; } if (nodeSquare == null) { nodeSquare = squareList[index]; index++; } BP_ORDER_ITEM square = squareList[index]; string id = square.ORD_NO + square.ORD_ITEM; if (sonTreeMap.Keys.Contains(id)) { sonTreeMap[id].add(squareList, index + 1); } else { TabuMapTree tabuMapTree = new TabuMapTree(); tabuMapTree.nodeSquare = square; sonTreeMap.Add(id, tabuMapTree); //sonTreeMap[id].add(squareList, index + 1); } } public bool contains(IList squareList, int index) { if (index >= squareList.Count) { return true; } BP_ORDER_ITEM square = squareList[index]; string id = square.ORD_NO; if (sonTreeMap.Keys.Contains(id)) { return sonTreeMap[id].contains(squareList, index + 1); } else { return false; } } public void show() { foreach (String key in sonTreeMap.Keys) { String id = sonTreeMap[key].nodeSquare.ORD_NO; sonTreeMap[key].show(); } } // 判断两个Squre是否相等 public bool isEq(Square square1, Square square2) { return square1.id.Equals(square2.id); } //public void show() //{ // for (String key : sonTreeMap.keySet()) { // String id = sonTreeMap.get(key).getNodeSquare().getId(); // sonTreeMap.get(key).show(); //} } }