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

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

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