public Spring(Node a, Node b, double restLength, double amplitude, double phase, Model model) : base(a,b, model){ //super(a, b, model); this.restLength = restLength; this.amplitude = amplitude; this.phase = phase; }
public Link(Model model, XmlReader xml) {//throws Exception { this.model = model; //foreach(XmlAttribute attribute in xml.Attributes) //{ // //string key = enum.nextElement().toString(); // string key = attribute.Name; if (xml.MoveToAttribute("A".ToLower())) { a = model.getNode(xml.ReadContentAsString());// xml.GetAttribute(key)); } if (xml.MoveToAttribute("B".ToLower())) { b = model.getNode(xml.ReadContentAsString());//xml.GetAttribute(key)); } //} //Enumeration enum = xml.enumerateAttributeNames(); //while (enum.hasMoreElements()) { //} }
public void removeNode(Node node) { links.RemoveAll(link => link.A == node || link.B == node); nodes.Remove(node); //Enumerator iter = links.iterator(); //while (iter.hasNext()) { // Link link = (Link) iter.next(); // if (link.a == node || link.b == node) { // iter.remove(); // } //} //nodes.remove(node); }
public void addNode(Node node) { nodes.Add(node); }
public double distance(Node other) { double dx = positionX - other.positionX; double dy = positionY - other.positionY; return Math.Sqrt(dx * dx + dy * dy); }
public Link(Node a, Node b, Model model) { this.a = a; this.b = b; this.model = model; }