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

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

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