Example #1
0
 public void destroy() {
   endTime = System.currentTimeMillis();
   if (globalSchedule != null) {
     globalSchedule.pause(System.currentTimeMillis());
   }
   Iterator<CompositeElement> it = getCompositeElements().iterator();
   while (it.hasNext()) {
     ((CompositeElement) it.next()).destroy();
   }
 }
Example #2
0
 public void start() {
   startTime = System.currentTimeMillis();
   if (globalSchedule != null) {
     globalSchedule.start();
   }
   Iterator<CompositeElement> it = getCompositeElements().iterator();
   while (it.hasNext()) {
     ((CompositeElement) it.next()).start();
   }
 }
Example #3
0
  /** @see edu.american.weiss.lafayette.composite.Composite#getActions(int, int) */
  public List<CompositeAction> getActions(int x, int y) {

    ArrayList<CompositeAction> al = new ArrayList<CompositeAction>(10);
    CompositeElement ce = getActiveCompositeElement(x, y);

    if (ce != null && ce.getCompositeActions() != null && ce.isActive(x, y)) {
      al.addAll(ce.getCompositeActions());
    }

    if (globalAction != null) {
      globalAction.setCompositeElement(ce);
      if (globalSchedule == null) {
        al.add(globalAction);
      } else if (!globalSchedule.isInInterval(System.currentTimeMillis())) {
        al.add(globalAction);
        globalSchedule.reset(Application.getIntProperty("reinforcement_duration"));
      }
    }

    return al;
  }