Example #1
0
  @Override
  public void update(int tick) {
    sortEntities();

    @SuppressWarnings("unchecked")
    List<Entity> sorted = (List<Entity>) entities.clone();
    Collections.reverse(sorted);
    for (Entity entity : sorted) {
      entity.update(tick);
      if (entity.isDead()) {
        if (entity.equals(selectedEntity)) selectedEntity = null;
        entities.remove(entity);
      }
    }

    for (Projectile p : projectiles) {
      p.update(tick);
      if (p.isDead()) projectiles.remove(p);
    }

    for (Animation a : animations) {
      a.update(tick);
      if (a.isDead()) animations.remove(a);
    }
  }
Example #2
0
 /**
  * Einen Listener wieder austragen
  *
  * @param listen
  */
 public void removeListener(HeartListener listen) {
   // remove the listener from the three lists
   // actually, it's contained in only one of them, but we don't know which one
   highFrequencyListeners.remove(listen);
   mediumFrequencyListeners.remove(listen);
   lowFrequencyListeners.remove(listen);
 }
Example #3
0
 /**
  * Disconnects consumer from this pipe. Fires pipe connection event.
  *
  * @param consumer Consumer that should be removed
  * @return <code>true</code> on success, <code>false</code> otherwise
  */
 public boolean unsubscribe(IConsumer consumer) {
   if (consumers.remove(consumer)) {
     fireConsumerConnectionEvent(consumer, PipeConnectionEvent.CONSUMER_DISCONNECT, null);
     listeners.remove(consumer);
     return true;
   } else {
     return false;
   }
 }
Example #4
0
 /**
  * Disconnects provider from this pipe. Fires pipe connection event.
  *
  * @param provider Provider that should be removed
  * @return <code>true</code> on success, <code>false</code> otherwise
  */
 public boolean unsubscribe(IProvider provider) {
   if (providers.remove(provider)) {
     fireProviderConnectionEvent(provider, PipeConnectionEvent.PROVIDER_DISCONNECT, null);
     listeners.remove(provider);
     return true;
   } else {
     return false;
   }
 }
  private void addToHistory(
      final List<? extends PsiElement> elements, final FindUsagesOptions findUsagesOptions) {
    SearchData data = createSearchData(elements, findUsagesOptions);
    myFindUsagesHistory.remove(data);
    myFindUsagesHistory.add(data);

    // todo configure history depth limit
    if (myFindUsagesHistory.size() > 15) {
      myFindUsagesHistory.remove(0);
    }
  }
Example #6
0
  /**
   * Removes the specified driver from the {@code DriverManager}'s list of registered drivers.
   *
   * <p>If a {@code null} value is specified for the driver to be removed, then no action is taken.
   *
   * <p>If a security manager exists and its {@code checkPermission} denies permission, then a
   * {@code SecurityException} will be thrown.
   *
   * <p>If the specified driver is not found in the list of registered drivers, then no action is
   * taken. If the driver was found, it will be removed from the list of registered drivers.
   *
   * <p>If a {@code DriverAction} instance was specified when the JDBC driver was registered, its
   * deregister method will be called prior to the driver being removed from the list of registered
   * drivers.
   *
   * @param driver the JDBC Driver to remove
   * @exception SQLException if a database access error occurs
   * @throws SecurityException if a security manager exists and its {@code checkPermission} method
   *     denies permission to deregister a driver.
   * @see SecurityManager#checkPermission
   */
  @CallerSensitive
  public static synchronized void deregisterDriver(Driver driver) throws SQLException {
    if (driver == null) {
      return;
    }

    SecurityManager sec = System.getSecurityManager();
    if (sec != null) {
      sec.checkPermission(DEREGISTER_DRIVER_PERMISSION);
    }

    println("DriverManager.deregisterDriver: " + driver);

    DriverInfo aDriver = new DriverInfo(driver, null);
    if (registeredDrivers.contains(aDriver)) {
      if (isDriverAllowed(driver, Reflection.getCallerClass())) {
        DriverInfo di = registeredDrivers.get(registeredDrivers.indexOf(aDriver));
        // If a DriverAction was specified, Call it to notify the
        // driver that it has been deregistered
        if (di.action() != null) {
          di.action().deregister();
        }
        registeredDrivers.remove(aDriver);
      } else {
        // If the caller does not have permission to load the driver then
        // throw a SecurityException.
        throw new SecurityException();
      }
    } else {
      println("    couldn't find driver to unload");
    }
  }
  /**
   * Removes the given role change listener from be called for changes in roles.
   *
   * @param listener the listener to unregister, cannot be <code>null</code>.
   * @throws IllegalArgumentException in case the given listener was <code>null</code>.
   */
  public void removeRoleChangeListener(RoleChangeListener listener) {
    if (listener == null) {
      throw new IllegalArgumentException("RoleChangeListener cannot be null!");
    }

    m_listeners.remove(listener);
  }
Example #8
0
  protected void advanceInitializers(IOFSwitchExt sw) {
    CopyOnWriteArrayList<IOFInitializerListener> initializers = initializerMap.get(sw);

    // Remove first initializer if it exists
    Iterator<IOFInitializerListener> it = initializers.iterator();
    if (it.hasNext()) {
      IOFInitializerListener initializer = it.next();
      initializers.remove(initializer);
      log.debug("Remaining initializers for switch {}: {}", sw, initializers);
    }

    if (it.hasNext()) {
      IOFInitializerListener initializer = it.next();
      queueInitializer(sw, initializer);
    } else {
      /**
       * Must synchronize here to ensure we don't transition into active while simultaneously being
       * disconnected.
       */
      synchronized (sw) {
        if (!OFSwitchState.DISCONNECTED.equals(sw.getState())) {
          sw.transitionToState(OFSwitchState.ACTIVE);
          // Add switch to active list
          addActiveSwitch(sw);
        }
        initializerMap.remove(sw);
      }
    }
  }
 public void remove(E e) {
   for (int i = 0; i < replicas; ++i) {
     Long hash = Long.valueOf(func.hash(e.toString() + i));
     circle.remove(hash);
   }
   values.remove(e);
 }
Example #10
0
 /** Called by {@link Executor} to kill excessive executors from this computer. */
 /*package*/ synchronized void removeExecutor(Executor e) {
   executors.remove(e);
   addNewExecutorIfNecessary();
   if (!isAlive()) {
     AbstractCIBase ciBase = Jenkins.getInstance();
     ciBase.removeComputer(this);
   }
 }
 private void doOperations() {
   for (RobotOperation operation : operationList) {
     if (operation.isFinished()) {
       operation.onFinish(robot);
       operationList.remove(operation);
     } else operation.tick(robot);
   }
 }
Example #12
0
 /*
  * @see org.gamegineer.table.net.ITableNetwork#removeTableNetworkListener(org.gamegineer.table.net.ITableNetworkListener)
  */
 @Override
 public void removeTableNetworkListener(final ITableNetworkListener listener) {
   assertArgumentLegal(
       listeners_.remove(listener),
       "listener",
       NonNlsMessages
           .TableNetwork_removeTableNetworkListener_listener_notRegistered); //$NON-NLS-1$
 }
  /**
   * Unregisters a display transaction listener to provide the client a chance to update its
   * surfaces within the same transaction as any display layout updates.
   *
   * @param listener The listener to unregister.
   */
  public void unregisterDisplayTransactionListener(DisplayTransactionListener listener) {
    if (listener == null) {
      throw new IllegalArgumentException("listener must not be null");
    }

    // List is self-synchronized copy-on-write.
    mDisplayTransactionListeners.remove(listener);
  }
Example #14
0
 public void remove(String item) {
   for (Item i : inventory) {
     if (i.getName() == item) {
       inventory.remove(i);
       System.out.println("Item " + item + " removed from inventory.");
     }
   }
 }
Example #15
0
 /**
  * Undeploy the aop config
  *
  * @param url the url
  */
 protected void undeploy(URL url) {
   try {
     log.debug("Undeploying " + url);
     urls.remove(url);
     AspectXmlLoader.undeployXML(url);
   } catch (Exception e) {
     log.warn("Ignored error undeploying " + url, e);
   }
 }
 public void removeDialog(Dialog d) {
   for (int i = 0; i < dialogs.size(); i++) {
     DialogWrapper p = dialogs.get(i);
     if (p.getDialog().equals(d)) {
       p.release();
       dialogs.remove(i);
       return;
     }
   }
 }
 public void rerunAndRecallFromHistory(@NotNull SearchData searchData) {
   myFindUsagesHistory.remove(searchData);
   PsiElement[] elements = restorePsiElements(searchData, true);
   if (elements == null || elements.length == 0) return;
   UsageInfoToUsageConverter.TargetElementsDescriptor descriptor =
       new UsageInfoToUsageConverter.TargetElementsDescriptor(elements);
   final FindUsagesHandler handler = getFindUsagesHandler(elements[0], false);
   if (handler == null) return;
   findUsages(descriptor, handler, false, false, searchData.myOptions);
 }
Example #18
0
 /**
  * Disassociates given {@link View}. If view is not associated, nothing happens.
  *
  * @param view View to be disassociated
  */
 public void removeView(final View view) {
   for (int i = 0; i < mViewList.size(); i++) {
     final ViewWeakReference reference = mViewList.get(i);
     final View item = reference.get();
     if (item == null || item == view) {
       // Always remove null references to reduce Set size
       mViewList.remove(reference);
     }
   }
 }
Example #19
0
 /**
  * Associates given {@link View}. If view has been already added, nothing happens.
  *
  * @param view View to be associated
  */
 public void addView(final View view) {
   for (int i = 0; i < mViewList.size(); i++) {
     final ViewWeakReference reference = mViewList.get(i);
     final View item = reference.get();
     if (item == null) {
       // Always remove null references to reduce Set size
       mViewList.remove(reference);
     }
   }
   mViewList.addIfAbsent(new ViewWeakReference(view));
 }
Example #20
0
  @Override
  public synchronized Layer remove(int index) {
    mDirtyLayers = true;

    Layer remove = mLayerList.remove(index);

    if (remove instanceof UpdateListener) mMap.events.unbind((UpdateListener) remove);
    if (remove instanceof InputListener) mMap.input.unbind((InputListener) remove);

    return remove;
  }
Example #21
0
  private boolean executePhase(CommandPhase phase, CopyOnWriteArrayList<Command> commands) {
    for (Command command : commands) {
      if (phase.equals(command.getPhase())) {
        commands.remove(command);
        if (command instanceof FurnaceDependent) ((FurnaceDependent) command).setFurnace(furnace);

        CommandResult result = command.execute();
        if (CommandResult.EXIT.equals(result)) return false;
      }
    }
    return true;
  }
Example #22
0
 /** {@inheritDoc} */
 public void removeItem(int index) {
   if (index < 0 || index >= items.size()) {
     return;
   }
   items.remove(index);
   if (index < currentItemIndex) {
     // item was removed before the currently playing
     currentItemIndex--;
   } else if (index == currentItemIndex) {
     // TODO: the currently playing item is removed - this should be handled differently
     currentItemIndex--;
   }
 }
Example #23
0
 @Override
 public void unscheduleDrawable(final Drawable who, final Runnable what) {
   for (int i = 0; i < mViewList.size(); i++) {
     final ViewWeakReference reference = mViewList.get(i);
     final View view = reference.get();
     if (view != null) {
       view.unscheduleDrawable(who);
     } else {
       // Always remove null references to reduce Set size
       mViewList.remove(reference);
     }
   }
 }
 /*
  * Remove this class, that is stored in a class variable in CommunicationServlet, called connections
  */
 private void removeConnection() {
   Enumeration<String> keys = CommunicationWebsocketServlet.connections.keys();
   while (keys.hasMoreElements()) {
     String key = keys.nextElement();
     CopyOnWriteArrayList<CommunicationWebsocketBusiness> conn =
         CommunicationWebsocketServlet.connections.get(key);
     for (int i = 0; i < conn.size(); i++) {
       CommunicationWebsocketBusiness c = conn.get(i);
       if (c.connection == this.connection) {
         conn.remove(c);
         System.out.println("Closed conn");
       }
     }
   }
 }
 private void releaseDialogs(boolean finish) {
   // clean up dialogs when activity is pausing or finishing
   for (Iterator<DialogWrapper> iter = dialogs.iterator(); iter.hasNext(); ) {
     DialogWrapper p = iter.next();
     Dialog dialog = p.getDialog();
     boolean persistent = p.getPersistent();
     // if the activity is pausing but not finishing, clean up dialogs only if
     // they are non-persistent
     if (finish || !persistent) {
       if (dialog != null && dialog.isShowing()) {
         dialog.dismiss();
       }
       dialogs.remove(p);
     }
   }
 }
Example #26
0
  /**
   * Remove a value from the bag. This method should only be called with objects obtained by <code>
   * borrow(long, TimeUnit)</code> or <code>reserve(T)</code>
   *
   * @param bagEntry the value to remove
   * @return true if the entry was removed, false otherwise
   * @throws IllegalStateException if an attempt is made to remove an object from the bag that was
   *     not borrowed or reserved first
   */
  public boolean remove(final T bagEntry) {
    if (!bagEntry.compareAndSet(STATE_IN_USE, STATE_REMOVED)
        && !bagEntry.compareAndSet(STATE_RESERVED, STATE_REMOVED)
        && !closed) {
      LOGGER.warn(
          "Attempt to remove an object from the bag that was not borrowed or reserved: {}",
          bagEntry);
      return false;
    }

    final boolean removed = sharedList.remove(bagEntry);
    if (!removed && !closed) {
      LOGGER.warn("Attempt to remove an object from the bag that does not exist: {}", bagEntry);
    }

    // synchronizer.signal();
    return removed;
  }
 public void unregisterEventListener(String event, GeckoEventListener listener) {
   synchronized (mEventListeners) {
     CopyOnWriteArrayList<GeckoEventListener> listeners = mEventListeners.get(event);
     if (listeners == null) {
       Log.w(LOGTAG, "unregisterEventListener: event '" + event + "' has no listeners");
       return;
     }
     if (!listeners.remove(listener)) {
       Log.w(
           LOGTAG,
           "unregisterEventListener: tried to remove an unregistered listener "
               + "for event '"
               + event
               + "'");
     }
     if (listeners.size() == 0) {
       mEventListeners.remove(event);
     }
   }
 }
 @Override
 public Object remove(final int index) {
   return copyOnWriteArrayList.remove(index);
 }
 @Override
 public boolean remove(final Object o) {
   return copyOnWriteArrayList.remove(o);
 }
 @Override
 public void removeThingLogicManagerListener(IThingLogicManagerListener l) {
   listeners.remove(l);
 }