示例#1
0
    private float getKineticEnergy() {
      float total = 0;

      for (Node n : nodes) {
        total += n.getKineticEnergy();
      }

      return total;
    }
示例#2
0
 private void addBackingDatums(ArrayList<Node> nodes) {
   for (Node n : nodes) {
     n.datumsEncapsulated = new ArrayList<Datum>();
     for (Datum d : getData()) {
       if (n.id.equals(d.destIP) || n.id.equals(d.sourceIP)) {
         n.datumsEncapsulated.add(d);
       }
     }
   }
 }
示例#3
0
    public ArrayList<Datum> getHoveredDatums() {
      ArrayList<Datum> toReturn = new ArrayList<Datum>();
      for (Node n : fdg.getNodes()) {
        if (n.containsPoint(mouseX, mouseY)) {
          for (Datum d : n.datumsEncapsulated) {
            toReturn.add(d);
          }
        }
      }

      return toReturn;
    }
示例#4
0
 private int getNodeColor(Node n) {
   return n.containsPoint(mouseX, mouseY) ? MOUSED_NODE_COLOR : EMPTY_NODE_COLOR;
 }
示例#5
0
 public void setAllBounds(Rect r) {
   for (Node n : nodes) {
     n.setBounds(r);
   }
 }
示例#6
0
 private void setAllBounds(ArrayList<Node> nodes, Rect myBounds) {
   for (Node n : nodes) {
     n.setBounds(myBounds);
   }
 }
示例#7
0
 // applies nodes' velocities to t
 private void updatePositions(float dt) {
   for (Node n : nodes) {
     n.updatePosition(dt);
   }
 }
示例#8
0
 public void applyForce() {
   Vector velocity = node.vel.copy().scale(-K, -K);
   node.addForce(velocity);
 }