Esempio n. 1
0
 @Override
 public void readFromNBT(NBTTagCompound tagCompound) {
   protectorById.clear();
   protectorIdByCoordinate.clear();
   lastId = tagCompound.getInteger("lastId");
   readDestinationsFromNBT(tagCompound);
 }
  public static void shutdown() {
    logger_.info("Shutting down ...");
    synchronized (MessagingService.class) {
      /* Stop listening on any socket */
      for (SelectionKey skey : listenSockets_.values()) {
        SelectorManager.getSelectorManager().cancel(skey);
      }
      listenSockets_.clear();

      /* Shutdown the threads in the EventQueue's */
      messageDeserializationExecutor_.shutdownNow();
      messageSerializerExecutor_.shutdownNow();
      messageDeserializerExecutor_.shutdownNow();
      streamExecutor_.shutdownNow();

      /* shut down the cachetables */
      taskCompletionMap_.shutdown();
      callbackMap_.shutdown();

      /* Interrupt the selector manager thread */
      SelectorManager.getSelectorManager().interrupt();

      poolTable_.clear();
      verbHandlers_.clear();
      bShutdown_ = true;
    }
    logger_.debug("Shutdown invocation complete.");
  }
Esempio n. 3
0
  @Override
  public final void compute() {
    inboundAggregationStorages.clear();

    if (numPhases == 1) {
      internalCompute();
    } else {
      currentPhase = (int) (super.getSuperstep() % numPhases);

      LOG.info("MASTER: Real SS" + super.getSuperstep());
      LOG.info("MASTER: Fake SS" + getSuperstep());
      LOG.info("MASTER: Phase" + currentPhase);

      if (currentPhase == 1) {
        internalCompute();

        for (String registeredAggregatorName : registeredAggregatorNames) {
          Writable value = super.getAggregatedValue(registeredAggregatorName);
          savedAggregatorValues.put(registeredAggregatorName, value);
          setAggregatedValue(registeredAggregatorName, null);
        }
      } else if (currentPhase == 0) {
        for (Map.Entry<String, Writable> savedAggregatorValuesEntry :
            savedAggregatorValues.entrySet()) {
          setAggregatedValue(
              savedAggregatorValuesEntry.getKey(), savedAggregatorValuesEntry.getValue());
        }

        savedAggregatorValues.clear();
      }
    }
  }
Esempio n. 4
0
  public void initProperties(Grain g) {
    int currentGridRow = FIRST_PROPERTY_ROW;

    propertiesGp.getChildren().remove(FIRST_PROPERTY_ROW + 1, propertiesGp.getChildren().size());
    propertiesCb.clear();
    propertiesTf.clear();

    for (Entry<String, Property> entry : g.getProperties().entrySet()) {
      Property property = entry.getValue();
      String propertyName = entry.getKey();

      propertiesCb.put(propertyName, new CheckBox(property.getDescription()));
      propertiesCb.get(propertyName).setOnAction(eh);
      GridPane.setConstraints(propertiesCb.get(propertyName), 0, currentGridRow);
      propertiesGp.getChildren().add(propertiesCb.get(propertyName));

      propertiesTf.put(propertyName, new TextField(Double.toString(property.getValue())));
      GridPane.setConstraints(propertiesTf.get(propertyName), 1, currentGridRow);
      propertiesGp.getChildren().add(propertiesTf.get(propertyName));

      if (property.isEnabled()) {
        propertiesCb.get(propertyName).setSelected(true);
      } else {
        propertiesTf.get(propertyName).setDisable(true);
      }

      currentGridRow++;
    }
  }
Esempio n. 5
0
  public List<TrainAndTestReportCrisp> computeAvgCTSperM(List<TrainAndTestReportCrisp> reportsCTS) {
    weightsCrisp.clear();
    weightsInterval.clear();

    Map<Model, List<TrainAndTestReportCrisp>> mapForAvg = new HashMap<>();
    for (TrainAndTestReportCrisp r : reportsCTS) {
      if (mapForAvg.containsKey(r.getModel())) {
        mapForAvg.get(r.getModel()).add(r);
      } else {
        List<TrainAndTestReportCrisp> l = new ArrayList<>();
        l.add(r);
        mapForAvg.put(r.getModel(), l);
      }
    }

    List<TrainAndTestReportCrisp> avgReports = new ArrayList<>();

    for (Model model : mapForAvg.keySet()) {
      List<TrainAndTestReportCrisp> l = mapForAvg.get(model);
      if (l.size() == 1) { // does not make sense to compute average over one series
        // do not compute anything
      } else {
        TrainAndTestReportCrisp thisAvgReport = computeAvgCTS(l, model);
        if (thisAvgReport != null) {
          avgReports.add(thisAvgReport);
        } else { // should never happen for the same method
          System.err.println("nerovnake percenttrain v ramci 1 modelu pri avg CTS per method :/");
        }
      }
    }

    return avgReports;
  }
  void release() {
    if (childRowToIdMap != null) {
      Collection delegates = childRowToIdMap.values();
      Iterator iter = delegates.iterator();
      while (iter.hasNext()) {
        SWTAccessibleDelegate childDelegate = ((Accessible) iter.next()).delegate;
        if (childDelegate != null) {
          childDelegate.internal_dispose_SWTAccessibleDelegate();
          childDelegate.release();
        }
      }

      childRowToIdMap.clear();
      childRowToIdMap = null;
    }

    if (childColumnToIdMap != null) {
      Collection delegates = childColumnToIdMap.values();
      Iterator iter = delegates.iterator();
      while (iter.hasNext()) {
        SWTAccessibleDelegate childDelegate = ((Accessible) iter.next()).delegate;
        if (childDelegate != null) {
          childDelegate.internal_dispose_SWTAccessibleDelegate();
          childDelegate.release();
        }
      }

      childColumnToIdMap.clear();
      childColumnToIdMap = null;
    }
  }
Esempio n. 7
0
 private void clear() {
   synchronized (myLocalRefsMap) {
     myLocalRefsMap.clear();
   }
   myImportStatements.clear();
   myDclsUsedMap.clear();
 }
  @Override
  public void disconnected(boolean onError) {
    final XMPPConnection connection = myFacade.getConnection();

    LOG.info("Jabber disconnected: " + connection.getUser());
    connection.removePacketListener(mySubscribeListener);
    mySubscribeListener = null;
    connection.removePacketListener(myMessageListener);
    myMessageListener = null;

    final Roster roster = connection.getRoster();
    if (roster != null) {
      roster.removeRosterListener(myRosterListener);
    }
    myRosterListener = null;

    myIDEtalkUsers.clear();
    myUser2Presence.clear();
    myUser2Thread.clear();

    if (onError && reconnectEnabledAndNotStarted()) {
      LOG.warn(getMsg("jabber.server.was.disconnected", myReconnectTimeout / 1000));
      myReconnectProcess = myIdeFacade.runOnPooledThread(new MyReconnectRunnable());
    }
  }
Esempio n. 9
0
  /**
   * Clear the cube (and other internal caches) for a given ApplicationID. This will remove all the
   * n-cubes from memory, compiled Groovy code, caches related to expressions, caches related to
   * method support, advice caches, and local classes loaders (used when no sys.classpath is
   * present).
   *
   * @param appId ApplicationID for which the cache is to be cleared.
   */
  public static void clearCache(ApplicationID appId) {
    synchronized (ncubeCache) {
      validateAppId(appId);

      Map<String, Object> appCache = getCacheForApp(appId);
      clearGroovyClassLoaderCache(appCache);

      appCache.clear();
      GroovyBase.clearCache(appId);
      NCubeGroovyController.clearCache(appId);

      // Clear Advice cache
      Map<String, Advice> adviceCache = advices.get(appId);
      if (adviceCache != null) {
        adviceCache.clear();
      }

      // Clear ClassLoader cache
      GroovyClassLoader classLoader = localClassLoaders.get(appId);
      if (classLoader != null) {
        classLoader.clearCache();
        localClassLoaders.remove(appId);
      }
    }
  }
Esempio n. 10
0
 /**
  * Removes all classes from the class cache.
  *
  * @see #getClassCacheEntry(String)
  * @see #setClassCacheEntry(Class)
  * @see #removeClassCacheEntry(String)
  */
 public void clearCache() {
   synchronized (classCache) {
     classCache.clear();
   }
   synchronized (sourceCache) {
     sourceCache.clear();
   }
 }
Esempio n. 11
0
 public void trimall() {
   synchronized (grids) {
     synchronized (req) {
       grids.clear();
       req.clear();
     }
   }
 }
Esempio n. 12
0
  @Override
  public boolean invoke(
      MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) {
    if (commands.size() < 1) {
      mob.tell(
          L(
              "You must specify an item to fence, and possibly a ShopKeeper (unless it is implied)."));
      return false;
    }

    commands.add(0, "SELL"); // will be instantly deleted by parseshopkeeper
    final Environmental shopkeeper =
        CMLib.english().parseShopkeeper(mob, commands, L("Fence what to whom?"));
    if (shopkeeper == null) return false;
    if (commands.size() == 0) {
      mob.tell(L("Fence what?"));
      return false;
    }

    if (!super.invoke(mob, commands, givenTarget, auto, asLevel)) return false;

    final boolean success = proficiencyCheck(mob, 0, auto);
    if (success) {
      final CMMsg msg =
          CMClass.getMsg(
              mob,
              shopkeeper,
              this,
              CMMsg.MSG_SPEAK,
              auto ? "" : L("<S-NAME> fence(s) stolen loot to <T-NAMESELF>."));
      if (mob.location().okMessage(mob, msg)) {
        mob.location().send(mob, msg);
        invoker = mob;
        addBackMap.clear();
        mob.addEffect(this);
        mob.recoverCharStats();
        commands.add(0, CMStrings.capitalizeAndLower("SELL"));
        mob.doCommand(commands, MUDCmdProcessor.METAFLAG_FORCED);
        commands.add(shopkeeper.name());
        mob.delEffect(this);
        for (Item I : addBackMap.keySet()) {
          if (mob.isMine(I)) {
            I.addEffect(addBackMap.get(I));
          }
        }
        addBackMap.clear();
        mob.recoverCharStats();
      }
    } else
      beneficialWordsFizzle(
          mob,
          shopkeeper,
          L(
              "<S-NAME> attempt(s) to fence stolen loot to <T-NAMESELF>, but make(s) <T-HIM-HER> too nervous."));

    // return whether it worked
    return success;
  }
Esempio n. 13
0
 @UiHandler("btnCancel")
 void cancelChanges(ClickEvent e) {
   recordStore.getList().clear();
   changedRecs.clear();
   removedRecs.clear();
   editMode(false);
   refreshRecords(e);
   md.clear(MDS);
 }
  /**
   * Import the model according to reversed dependency order among model objects: book, sheet,
   * defined name, cells, chart, pictures, validation.
   */
  @Override
  public SBook imports(InputStream is, String bookName) throws IOException {

    // clear cache for reuse
    importedStyle.clear();
    importedFont.clear();

    workbook = createPoiBook(is);
    book = SBooks.createBook(bookName);
    //		book.setDefaultCellStyle(importCellStyle(workbook.getCellStyleAt((short) 0), false));
    // //ZSS-780
    // ZSS-854
    importDefaultCellStyles();
    importNamedStyles();
    // ZSS-1140
    importExtraStyles();
    setBookType(book);

    // ZSS-715: Enforce internal Locale.US Locale so formula is in consistent internal format
    Locale old = Locales.setThreadLocal(Locale.US);
    SBookSeries bookSeries = book.getBookSeries();
    boolean isCacheClean = bookSeries.isAutoFormulaCacheClean();
    try {
      bookSeries.setAutoFormulaCacheClean(false); // disable it to avoid
      // unnecessary clean up
      // during importing

      importExternalBookLinks();
      int numberOfSheet = workbook.getNumberOfSheets();
      for (int i = 0; i < numberOfSheet; i++) {
        Sheet poiSheet = workbook.getSheetAt(i);
        importSheet(poiSheet, i);
        SSheet sheet = book.getSheet(i);
        importTables(poiSheet, sheet); // ZSS-855, ZSS-1011
      }
      importNamedRange();
      for (int i = 0; i < numberOfSheet; i++) {
        SSheet sheet = book.getSheet(i);
        Sheet poiSheet = workbook.getSheetAt(i);
        for (Row poiRow : poiSheet) {
          importRow(poiRow, sheet);
        }
        importColumn(poiSheet, sheet);
        importMergedRegions(poiSheet, sheet);
        importDrawings(poiSheet, sheet);
        importValidation(poiSheet, sheet);
        importAutoFilter(poiSheet, sheet);
        importSheetProtection(poiSheet, sheet); // ZSS-576
      }
    } finally {
      book.getBookSeries().setAutoFormulaCacheClean(isCacheClean);
      Locales.setThreadLocal(old);
    }

    return book;
  }
Esempio n. 15
0
 /**
  * Removes all effects from controllers and ends them appropriately Passive effect will not be
  * removed
  */
 public void removeAllEffects() {
   for (Effect effect : abnormalEffectMap.values()) {
     effect.endEffect();
   }
   abnormalEffectMap.clear();
   for (Effect effect : noshowEffects.values()) {
     effect.endEffect();
   }
   noshowEffects.clear();
 }
Esempio n. 16
0
 private void initializeTest() {
   symbols.clear();
   scenarios.clear();
   testSummary.clear();
   allExpectations.clear();
   allInstructionResults.clear();
   allInstructions.clear();
   allTables.clear();
   exceptions.resetForNewTest();
 }
  /** Cleans up resources to avoid excessive memory usage. */
  public void cleanUp() {
    topSnapshot.set(null);
    singleMsgs.clear();
    fullMsgs.clear();
    rcvdIds.clear();
    oldestNode.set(null);
    partReleaseFut = null;

    Collection<ClusterNode> rmtNodes = this.rmtNodes;

    if (rmtNodes != null) rmtNodes.clear();
  }
Esempio n. 18
0
  @Override
  public void readExternal(Element element) throws InvalidDataException {
    myMap.clear();
    myRendererColors.clear();
    final List children = element.getChildren(INFO_TAG);
    for (Object child : children) {
      final Element infoElement = (Element) child;

      final SeverityBasedTextAttributes highlightInfo =
          new SeverityBasedTextAttributes(infoElement);

      Color color = null;
      final String colorStr = infoElement.getAttributeValue(COLOR_ATTRIBUTE);
      if (colorStr != null) {
        color = new Color(Integer.parseInt(colorStr, 16));
      }
      registerSeverity(highlightInfo, color);
    }
    myReadOrder = new JDOMExternalizableStringList();
    myReadOrder.readExternal(element);
    List<HighlightSeverity> read = new ArrayList<HighlightSeverity>(myReadOrder.size());
    final List<HighlightSeverity> knownSeverities = getDefaultOrder();
    for (String name : myReadOrder) {
      HighlightSeverity severity = getSeverity(name);
      if (severity == null || !knownSeverities.contains(severity)) continue;
      read.add(severity);
    }
    OrderMap orderMap = fromList(read);
    if (orderMap.isEmpty()) {
      orderMap = fromList(knownSeverities);
    } else {
      // enforce include all known
      List<HighlightSeverity> list = getOrderAsList(orderMap);
      for (int i = 0; i < knownSeverities.size(); i++) {
        HighlightSeverity stdSeverity = knownSeverities.get(i);
        if (!list.contains(stdSeverity)) {
          for (int oIdx = 0; oIdx < list.size(); oIdx++) {
            HighlightSeverity orderSeverity = list.get(oIdx);
            HighlightInfoType type = STANDARD_SEVERITIES.get(orderSeverity.getName());
            if (type != null && knownSeverities.indexOf(type.getSeverity(null)) > i) {
              list.add(oIdx, stdSeverity);
              myReadOrder = null;
              break;
            }
          }
        }
      }
      orderMap = fromList(list);
    }
    myOrderMap = orderMap;
    severitiesChanged();
  }
 static void clearAll() {
   logger.finer("FancyDial.clearAll");
   if (initialized) {
     active = false;
     setupInfo.clear();
   }
   for (FancyDial instance : instances.values()) {
     if (instance != null) {
       instance.finish();
     }
   }
   instances.clear();
   initialized = true;
 }
  @Override
  public void cleanup() {
    myOldProblemElements = null;

    synchronized (lock) {
      myProblemElements.clear();
      myProblemToElements.clear();
      myQuickFixActions.clear();
      myIgnoredElements.clear();
      myContents.clear();
      myModulesProblems.clear();
    }

    isDisposed = true;
  }
Esempio n. 21
0
  public void setTransferCapabilities(Collection<TransferCapability> transferCapabilities) {
    scpTCs.clear();
    scuTCs.clear();

    for (TransferCapability tc : transferCapabilities) {
      tc.setApplicationEntity(this);
      switch (tc.getRole()) {
        case SCP:
          scpTCs.put(tc.getSopClass(), tc);
          break;
        case SCU:
          scuTCs.put(tc.getSopClass(), tc);
      }
    }
  }
Esempio n. 22
0
  public void save(final int operationType)
      throws AccessDeniedException, ItemExistsException, ConstraintViolationException,
          InvalidItemStateException, VersionException, LockException, NoSuchNodeTypeException,
          RepositoryException {
    if (!isSystem() && getLocale() != null) {
      for (JCRNodeWrapper node : newNodes.values()) {
        for (String s : node.getNodeTypes()) {
          ExtendedPropertyDefinition[] propDefs =
              NodeTypeRegistry.getInstance().getNodeType(s).getPropertyDefinitions();
          for (ExtendedPropertyDefinition propDef : propDefs) {
            if (propDef.isMandatory()
                && propDef.getRequiredType() != PropertyType.WEAKREFERENCE
                && propDef.getRequiredType() != PropertyType.REFERENCE
                && !propDef.isProtected()
                && !node.hasProperty(propDef.getName())) {
              throw new ConstraintViolationException("Mandatory field : " + propDef.getName());
            }
          }
        }
      }
    }
    newNodes.clear();

    JCRObservationManager.doWorkspaceWriteCall(
        this,
        operationType,
        new JCRCallback<Object>() {
          public Object doInJCR(JCRSessionWrapper thisSession) throws RepositoryException {
            for (Session session : sessions.values()) {
              session.save();
            }
            return null;
          }
        });
  }
Esempio n. 23
0
    private double[] setFutureCosts(
        int sourceInputId,
        Derivation<TK, FV> hyp,
        CombinedFeaturizer<TK, FV> featurizer,
        Scorer<FV> scorer) {

      // Do we clear the cache of future cost?
      MutableInteger lastId = tlTranslationId.get();
      @SuppressWarnings("rawtypes")
      Map<SegId, Double> fcCache = tlCache.get();
      if (lastId.intValue() != sourceInputId) {
        fcCache.clear();
        lastId.set(sourceInputId);
      }

      DTURule<TK> opt = (DTURule<TK>) concreteOpt.abstractRule;
      double[] fc = new double[opt.dtus.length];

      assert (segmentIdx == 0);
      for (int i = segmentIdx + 1; i < opt.dtus.length; ++i) {
        SegId<TK> id = new SegId<TK>(opt, i);
        Double score = fcCache.get(id);
        if (score == null) {
          Featurizable<TK, FV> f =
              new DTUFeaturizable<TK, FV>(hyp.sourceSequence, concreteOpt, sourceInputId, i);
          List<FeatureValue<FV>> phraseFeatures = featurizer.ruleFeaturize(f);
          score = scorer.getIncrementalScore(phraseFeatures);
          fcCache.put(id, score);
        }
        fc[i] = score;
        // System.err.printf("Future cost: id=%d phrase={%s} features=%s fc=%.3f\n",
        // translationId, opt.dtus[i], phraseFeatures, fc[i]);
      }
      return fc;
    }
Esempio n. 24
0
 private void updlayout() {
   synchronized (ui.sess.glob.paginae) {
     List<Pagina> cur = new ArrayList<Pagina>();
     loading = !cons(this.cur, cur);
     Collections.sort(cur, sorter);
     int i = curoff;
     hotmap.clear();
     for (int y = 0; y < gsz.y; y++) {
       for (int x = 0; x < gsz.x; x++) {
         Pagina btn = null;
         if ((this.cur != null) && (x == gsz.x - 1) && (y == gsz.y - 1)) {
           btn = bk;
         } else if ((cur.size() > ((gsz.x * gsz.y) - 1)) && (x == gsz.x - 2) && (y == gsz.y - 1)) {
           btn = next;
         } else if (i < cur.size()) {
           Resource.AButton ad = cur.get(i).act();
           if (ad.hk != 0) hotmap.put(Character.toUpperCase(ad.hk), cur.get(i));
           btn = cur.get(i++);
         }
         layout[x][y] = btn;
       }
     }
     pagseq = ui.sess.glob.pagseq;
   }
 }
 void clear() {
   pending_entries.clear();
   output_set.clear();
   object_tasks.clear();
   active_threads.clear();
   time_marks.clear();
   thread_entries = null;
   next_time = 0;
   end_time = 0;
   current_thread = null;
   thread_map.clear();
   cpu_time = null;
   thread_counter = 0;
   task_counter = 0;
   max_delta = 1;
 }
Esempio n. 26
0
  public RelationalPlan convert(PlanNode planNode)
      throws QueryPlannerException, TeiidComponentException {
    try {
      boolean debug = analysisRecord.recordDebug();
      if (debug) {
        analysisRecord.println(
            "\n============================================================================"); //$NON-NLS-1$
        analysisRecord.println("CONVERTING PLAN TREE TO PROCESS TREE"); // $NON-NLS-1$
      }

      // Convert plan tree nodes into process tree nodes
      RelationalNode processNode;
      try {
        processNode = convertPlan(planNode);
      } catch (TeiidProcessingException e) {
        if (e instanceof QueryPlannerException) {
          throw (QueryPlannerException) e;
        }
        throw new QueryPlannerException(e);
      }
      if (debug) {
        analysisRecord.println("\nPROCESS PLAN = \n" + processNode); // $NON-NLS-1$
        analysisRecord.println(
            "============================================================================"); //$NON-NLS-1$
      }

      RelationalPlan processPlan = new RelationalPlan(processNode);
      return processPlan;
    } finally {
      sharedCommands.clear();
    }
  }
Esempio n. 27
0
 public void clear() {
   for (Image img : searchTable.values()) {
     GLUtils.unloadImage(img);
   }
   keyList.clear();
   searchTable.clear();
 }
 /** @deprecated use {@link #getEnvironment()} (to remove in IDEA 14) */
 @SuppressWarnings("unused")
 public void setEnvParams(@Nullable Map<String, String> envParams) {
   myEnvParams.clear();
   if (envParams != null) {
     myEnvParams.putAll(envParams);
   }
 }
Esempio n. 29
0
 static void clrTest(int n, Map s) {
   String nm = "Remove Present         ";
   timer.start(nm, n);
   s.clear();
   timer.finish();
   reallyAssert(s.isEmpty());
 }
 @TestOnly
 public void clearCodeStyleSettings() {
   CodeStyleSettings cleanSettings = new CodeStyleSettings();
   copyFrom(cleanSettings);
   myAdditionalIndentOptions.clear(); // hack
   myLoadedAdditionalIndentOptions = false;
 }