Esempio n. 1
0
 public void drawOrbits(ArrayList alObjectsArchive) {
   //  println("SIZE:" + alObjectsArchive.size());
   //  ArrayList alObjectsArchive = timeline.getObjectStateArchive();
   ArrayList alPrevPos = new ArrayList();
   ArrayList alColors = new ArrayList();
   alColors.add(color(255, 0, 0));
   alColors.add(color(255, 255, 0));
   alColors.add(color(255, 0, 255));
   //  for (int i = timeline.getTimeIdx(); i >= 0 && i > (timeline.getTimeIdx() - 1 - 100); i--)
   for (int i = 0; i < alObjectsArchive.size(); i++) {
     ArrayList objects = (ArrayList) alObjectsArchive.get(i);
     for (int j = 0; j < objects.size(); j++) {
       CelestialObject obj = (CelestialObject) objects.get(j);
       //      CelestialObject obj = (CelestialObject)objects.get(1);
       PVector pos = obj.getPosition();
       //      stroke(0, 0, 255);
       stroke((Integer) alColors.get(j));
       if (alPrevPos.size() == objects.size()) {
         PVector prevPos = (PVector) alPrevPos.get(j);
         line(prevPos.x, prevPos.y, pos.x, pos.y);
         alPrevPos.set(j, pos);
       } else alPrevPos.add(pos);
     }
   }
 }
Esempio n. 2
0
 public Object set(int index, Object e) {
   Object old = get(index);
   if (index < 0 || index >= size()) add(index, e);
   else {
     if (type != null) e = Converter.convert(e, type);
     super.set(index, e);
   }
   return old;
 }
Esempio n. 3
0
 public void setCurrentState(ArrayList alState) {
   for (int i = 0; i < alStatefulObjects.size(); i++) {
     alStatefulObjects.set(i, alState.get(i));
   }
 }
Esempio n. 4
0
 /**
  * Returns the next item.
  *
  * @return item string
  * @throws IOException I/O Exception
  */
 public String next() throws IOException {
   return more() ? new String(cache.set(pos++, null), UTF8) : null;
 }