示例#1
0
 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;
 }
示例#2
0
  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()) {
     
    //}
  }
示例#3
0
        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);
        }
示例#4
0
 public void addNode(Node node)
 {
     nodes.Add(node);
 }
示例#5
0
 public double distance(Node other) {
   double dx = positionX - other.positionX;
   double dy = positionY - other.positionY;
   return Math.Sqrt(dx * dx + dy * dy);
 }
示例#6
0
 public Link(Node a, Node b, Model model) {
   this.a = a;
   this.b = b;
   this.model = model;
 }