public bool Equals(LinkBean bean) { if (bean == null) return false; return (source.Equals(bean.source) && target.Equals(bean.target)); }
public bool Equals(LinkBean bean) { if (bean == null) { return(false); } return(source.Equals(bean.source) && target.Equals(bean.target)); }
private void getLinks(NetworkBean network, XmlNode networkNode) { XmlNodeList xmlNodeList = getChildern(networkNode); foreach (XmlNode node in xmlNodeList) { LinkBean link = new LinkBean(); string target = getNodeAttrValue(node, AttrType.Target); string source = getNodeAttrValue(node, AttrType.Source); link.target = XmlMapping.findNodeBeanById(target, network.group2); link.source = XmlMapping.findNodeBeanById(source, network.group1); network.llb.Add(link); } }
/// <summary> /// 初始化matrix(取值为 0 或者 1) /// </summary> public void initialize() { int count = MyXml.getNodesCount(); graph = new Matrix(count, count); for (int i = 0; i < graph.Rows; i++) { for (int j = 0; j < graph.Cols; j++) { MNode node = graph.getMNode(i, j); node.SName = i.ToString(); node.EName = j.ToString(); LinkBean bean = new LinkBean(); // 正向 bean.source = MyXml.findNodeById(node.SName); bean.target = MyXml.findNodeById(node.EName); LinkBean bean_2 = new LinkBean(); // 反向 bean_2.source = MyXml.findNodeById(node.EName); bean_2.target = MyXml.findNodeById(node.SName); foreach (LinkBean lb in MyXml.getAllLinks()) { if (lb.Equals(bean) || lb.Equals(bean_2)) { node.Value = 1; break; } } } } for (int i = 0; i < graph.Rows; i++){ for (int j = 0; j < graph.Cols; j++) if (i == j) {graph.getMNode(i, j).Value = 1; continue;} } }
private RouteDrawer DrawConverter(LinkBean linkbean) { // 建立在xml文档中ID按顺序排列的基础上 int source = int.Parse(linkbean.source.id); int target = int.Parse(linkbean.target.id); return new RouteDrawer(pl[source], pl[target]); }