@Override
  public void loadState(String prefix, Properties properties) {
    // ensure to cleanup the current states prior loading new ones
    defaultSizeMap.clear();
    sizeMap.clear();
    resizablesMap.clear();
    aggregatedSizeCacheMap.clear();

    String persistedDefaultSize = properties.getProperty(prefix + PERSISTENCE_KEY_DEFAULT_SIZE);
    if (!StringUtils.isEmpty(persistedDefaultSize)) {
      defaultSize = Integer.valueOf(persistedDefaultSize).intValue();
    }

    String persistedResizableDefault =
        properties.getProperty(prefix + PERSISTENCE_KEY_RESIZABLE_BY_DEFAULT);
    if (!StringUtils.isEmpty(persistedResizableDefault)) {
      resizableByDefault = Boolean.valueOf(persistedResizableDefault).booleanValue();
    }

    String persistedPercentageSizing =
        properties.getProperty(prefix + PERSISTENCE_KEY_PERCENTAGE_SIZING);
    if (!StringUtils.isEmpty(persistedPercentageSizing)) {
      setPercentageSizing(Boolean.valueOf(persistedPercentageSizing).booleanValue());
    }

    loadBooleanMap(prefix + PERSISTENCE_KEY_RESIZABLE_INDEXES, properties, resizablesMap);
    loadIntegerMap(prefix + PERSISTENCE_KEY_DEFAULT_SIZES, properties, defaultSizeMap);
    loadIntegerMap(prefix + PERSISTENCE_KEY_SIZES, properties, sizeMap);
    loadBooleanMap(
        prefix + PERSISTENCE_KEY_PERCENTAGE_SIZING_INDEXES, properties, percentageSizingMap);
  }
    @Override
    public synchronized boolean configure(StaplerRequest req, JSONObject formData)
        throws FormException {

      // The following codes are bad...
      // How to bind formData to List<Discriptor> ?

      if (nexusMap == null) {
        nexusMap = new HashMap<String, NexusDescriptor>();
      }

      try {
        JSONObject json = formData.getJSONObject("nexusList");
        nexusMap.clear();
        NexusDescriptor desc = parse(json);
        nexusMap.put(desc.getName(), desc);
      } catch (JSONException e) {
        try {
          JSONArray jsons = formData.getJSONArray("nexusList");
          nexusMap.clear();
          for (Object json : jsons) {
            NexusDescriptor desc = parse((JSONObject) json);
            nexusMap.put(desc.getName(), desc);
          }
        } catch (JSONException ee) {
          // exec in this path only if nexusList is empty.
        }
      }

      save();
      return super.configure(req, formData);
    }
  private void setGlobalOptions() {
    globalOptions.clear();
    globalOptionsSetter.clear();

    for (Plugin p : plugins()) {
      if (p.isGloballyEnabled()) {
        for (Map.Entry<String, String> e : p.getMyGlobalOptions().entrySet()) {
          String key = e.getKey();
          String value = e.getValue();
          String oldValue = globalOptions.get(key);

          if (oldValue != null) {
            if (oldValue.equals(value)) {
              continue;
            }
            Plugin oldP = globalOptionsSetter.get(key);
            throw new RuntimeException(
                "Incompatible global options for "
                    + key
                    + "; conflict between "
                    + oldP.getPluginId()
                    + " and "
                    + p.getPluginId());
          }
          globalOptions.put(key, value);
          globalOptionsSetter.put(key, p);
        }
      }
    }
  }
Exemplo n.º 4
0
  @Override
  public void init(FilterConfig arg0) throws ServletException {

    /** 获取过滤不用进行拦截的URL */
    Properties properties = new Properties();
    try {
      properties.load(
          new InputStreamReader(
              this.getClass().getResourceAsStream("/properties/sessionfilter.properties"),
              Charset.forName("utf-8")));
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    String allowUrls = properties.getProperty("allowUrls");
    String suffixs = properties.getProperty("suffix");
    if (allowUrls != null) {
      String[] st = allowUrls.split(",");
      map.clear();
      for (String s : st) {
        map.put(s, s);
      }
    }
    if (suffixs != null) {
      String[] str = suffixs.split(",");
      suffixmap.clear();
      for (String s : str) {
        suffixmap.put(s, s);
      }
    }
  }
Exemplo n.º 5
0
 /** deleteAll */
 public void deleteAll() {
   for (PollableInterface pi : m_members.values()) {
     pi.delete();
   }
   m_members.clear();
   m_node.clear();
 }
Exemplo n.º 6
0
  @Test
  public void writeJSONWithSelectedFieldsConvertsSolvedStatus() throws ComponentLookupException {
    Map<String, String> map = new LinkedHashMap<String, String>();
    map.put(STATUS_KEY, "1");
    PatientData<String> patientData = new DictionaryPatientData<String>(DATA_NAME, map);
    doReturn(patientData).when(this.patient).getData(DATA_NAME);
    JSONObject json = new JSONObject();
    Collection<String> selectedFields = new LinkedList<>();
    selectedFields.add(STATUS_KEY);

    this.mocker.getComponentUnderTest().writeJSON(this.patient, json, selectedFields);
    Assert.assertEquals(STATUS_SOLVED, json.getJSONObject(DATA_NAME).get("status"));

    map.clear();
    json = new JSONObject();
    map.put(STATUS_KEY, "0");
    patientData = new DictionaryPatientData<>(DATA_NAME, map);
    doReturn(patientData).when(this.patient).getData(DATA_NAME);

    this.mocker.getComponentUnderTest().writeJSON(this.patient, json, selectedFields);
    Assert.assertEquals(STATUS_UNSOLVED, json.getJSONObject(DATA_NAME).get("status"));

    map.clear();
    json = new JSONObject();
    map.put(STATUS_KEY, "solved");
    patientData = new DictionaryPatientData<>(DATA_NAME, map);
    doReturn(patientData).when(this.patient).getData(DATA_NAME);

    this.mocker.getComponentUnderTest().writeJSON(this.patient, json, selectedFields);
    Assert.assertFalse(json.getJSONObject(DATA_NAME).has("status"));
  }
Exemplo n.º 7
0
    // for now, caching as long as the loader remains the same,
    // drop entire cache if it changes.
    synchronized Config getOrElseUpdate(ClassLoader loader, String key, Callable<Config> updater) {
      if (loader != currentLoader) {
        // reset the cache if we start using a different loader
        cache.clear();
        currentLoader = loader;
      }

      Config systemProperties = systemPropertiesAsConfig();
      if (systemProperties != currentSystemProperties) {
        cache.clear();
        currentSystemProperties = systemProperties;
      }

      Config config = cache.get(key);
      if (config == null) {
        try {
          config = updater.call();
        } catch (RuntimeException e) {
          throw e; // this will include ConfigException
        } catch (Exception e) {
          throw new ConfigException.Generic(e.getMessage(), e);
        }
        if (config == null) throw new ConfigException.BugOrBroken("null config from cache updater");
        cache.put(key, config);
      }

      return config;
    }
Exemplo n.º 8
0
  public boolean appendSegment(byte[] segment) {
    int beginIndex = 0;

    if (begin == false) {

      if ((beginIndex = findSub(segment, GET, 0)) != segment.length) {
        begin = true;
        headerMap.clear();
        verb = Verb.GET;

      } else if ((beginIndex = findSub(segment, HEAD, 0)) != segment.length) {
        begin = true;
        headerMap.clear();
        verb = Verb.HEAD;

      } else {
        // not begin yet, and find no begin, just return false;
        return false;
      }
    }

    int endIndex = findSubFromEnd(segment, END, 0);
    ByteBuffer b = ByteBuffer.wrap(segment, beginIndex, endIndex);
    decoder.decode(b, charBuffer, endIndex != segment.length);
    if (endIndex != segment.length) {
      extractValueAndReset();
      return true;
    }
    return false;
  }
  private void prepareAnimation() {
    yMap.clear();
    positionMap.clear();
    beforeVisible.clear();
    afterVisible.clear();

    adapter.setMayNotify(false);

    final int childCount = getChildCount();

    final int firstVisiblePosition = getFirstVisiblePosition();

    for (int i = 0; i < childCount; i++) {
      final View child = getChildAt(i);
      final long id = adapter.getItemId(firstVisiblePosition + i);

      yMap.put(id, ViewHelper.getY(child));
      positionMap.put(id, firstVisiblePosition + i);
    }

    for (int i = 0; i < firstVisiblePosition; i++) {
      final long id = adapter.getItemId(i);
      beforeVisible.add(id);
    }

    final int count = adapter.getCount();

    for (int i = firstVisiblePosition + childCount; i < count; i++) {
      final long id = adapter.getItemId(i);
      afterVisible.add(id);
    }
  }
Exemplo n.º 10
0
 @Override
 public void prepare() {
   contentUriToTitleMap.clear();
   brandUriToSeriesUrisMap.clear();
   seriesUriToEpisodeUrisMap.clear();
   brandUriToTypeMap.clear();
 }
Exemplo n.º 11
0
 /** Purges all updates from the <code>ClientUpdateManager</code>. */
 void purge() {
   clientComponentUpdateMap.clear();
   applicationUpdateMap.clear();
   actionComponent = null;
   actionName = null;
   actionValue = null;
 }
Exemplo n.º 12
0
 private void clear() {
   synchronized (myLocalRefsMap) {
     myLocalRefsMap.clear();
   }
   myImportStatements.clear();
   myDclsUsedMap.clear();
 }
Exemplo n.º 13
0
  /** destroys the current PhysicsSpace so that a new one can be created */
  public void destroy() {
    physicsBodies.clear();
    physicsJoints.clear();

    //        dynamicsWorld.destroy();
    //        dynamicsWorld = null;
  }
  @Override
  public void onResume() {
    super.onResume();

    preSetupMap();

    markers.clear();
    airplanes.clear();
    currentPolyTrack.clear();

    serviceConnection =
        new ServiceConnection() {
          @Override
          public void onServiceConnected(ComponentName name, IBinder service) {
            Log.i("DEBUG", "Service conectado");
            updaterService = ((UpdaterService.Controller) service).getUpdaterService();
            updaterService.setOnAirplanesUpdateListener(MapFragment.this);
          }

          @Override
          public void onServiceDisconnected(ComponentName name) {
            Log.i("DEBUG", "Service desconectado");
          }
        };

    Intent intent = new Intent("SOLVER_HELPER_SERVICE");
    intent.setPackage("radarlivre.com.radarlivreandroid");

    getActivity().startService(intent);

    getActivity().bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE);
  }
 public void clear() {
   _boolMap.clear();
   _intMap.clear();
   _longMap.clear();
   _stringMap.clear();
   _byteMap.clear();
 }
Exemplo n.º 16
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();
      }
    }
  }
  /** Cleanup everything used by deserializers */
  public static void cleanupData() {
    if (connectionFlowMap != null) {
      connectionFlowMap.clear();
    }

    if (reversedNodes != null) {
      reversedNodes.clear();
    }

    if (pairMediatorFlowMap != null) {
      pairMediatorFlowMap.clear();
    }

    if (rootInputConnectors != null) {
      rootInputConnectors.clear();
    }

    if (complexFiguredReversedFlows != null) {
      complexFiguredReversedFlows.clear();
    }

    if (nodeBounds != null) {
      nodeBounds.clear();
    }

    rootCompartment = null;
    hasInlineEndPoint = false;
    addedAddressingEndPoint = false;
  }
Exemplo n.º 18
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;
  }
Exemplo n.º 19
0
  @SuppressWarnings("unchecked")
  @Override
  public void start(
      HttpServletRequest request,
      Map<String, String> variablesMap,
      JBPMWorkflowHistoryInfo jbpmWorkflowHistoryInfo)
      throws Exception {

    String contractid = variablesMap.get("contract_id");

    ContractInfo contractinfo = this.tableService.findEntityByID(ContractInfo.class, contractid);
    CustInfo custInfo = contractinfo.getCustId();
    // 将合同基本信息放入variablesMap
    contractInfoExtends.getContractBaseInfo(variablesMap, contractinfo, custInfo);

    Map<String, String> queryMainObjectMap = new HashMap<String, String>();

    queryMainObjectMap.clear();
    queryMainObjectMap.put("contractid", contractid);
    queryMainObjectMap.put("isnoequip", "true");
    queryMainObjectMap.put("paytype", "pay_type_out");
    queryMainObjectMap.put("noprerent", "true");
    // 设备款计划
    this.fundCommMethod.initFundFundPlan("json_payment_plan_str", variablesMap, queryMainObjectMap);

    // 资金付款明细
    queryMainObjectMap.clear();
    queryMainObjectMap.put("contractid", contractid);
    queryMainObjectMap.put("paytype", "pay_type_out");
    this.fundCommMethod.initFundFundCharge("json_pay_his_str", variablesMap, queryMainObjectMap);
  }
Exemplo n.º 20
0
 public void reset() {
   synchronized (this) {
     payments.clear();
     transactions.clear();
     attempts.clear();
   }
 }
Exemplo n.º 21
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.ui.tests.harness.util.UITestCase#doTearDown()
  */
 protected void doTearDown() throws Exception {
   handlerService.deactivateHandlers(testHandlerActivations.values());
   testHandlerActivations.clear();
   contextService.deactivateContexts(testContextActivations.values());
   testContextActivations.clear();
   super.doTearDown();
 }
Exemplo n.º 22
0
  /**
   * Erstellt eine DisplayMessageBean, die eine fehlerhafte Mail anzeigt.
   *
   * @param content Fehlerhafte Message
   * @param displayMessage Aktuelle DisplayMessageBean
   * @param displayParts List, in die die DisplayParts einsortiert werden.
   * @param inlineParts Map, in die die InlineParts gepackt werden.
   * @param multiparts Map, in die Multiparts gepackt werden.
   * @param e Exception, die beim Einlesen geflogen ist
   */
  private static void assemblePartsForFaultySourceMessage(
      Message message,
      DisplayMessageModel displayMessage,
      List<Part> displayParts,
      Map inlineParts,
      Map multiparts,
      Exception e)
      throws MessagingException {

    // Alle vielleicht schon ansatzweise gefuellten Collections
    // zuruecksetzen
    displayParts.clear();
    inlineParts.clear();
    multiparts.clear();

    // Part erstellen, der auf das Problem hinweist und den Quelltext
    // anfuegt.
    StringBuffer mt = new StringBuffer("Message faulty!\n\n");
    mt.append("The requested messages is faulty because of this reason:\n");
    mt.append(e.getMessage()).append("\n\n");
    mt.append("This is the faulty source of the requested content:\n\n");
    mt.append(displayMessage.getMessageSource());

    // Info-Text-Message erstellen
    Message infoMessage = new MimeMessage((Session) null);
    infoMessage.setText(mt.toString());

    // Info-Text-Message in die Display-Parts packen
    displayParts.add(infoMessage);
  }
Exemplo n.º 23
0
  @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());
    }
  }
Exemplo n.º 24
0
  @Override
  public void setupCreate(ModelMap model, HttpServletRequest request) {
    Map criterias = new HashMap();
    model.addAttribute(
        "fuelvendor", genericDAO.findByCriteria(FuelVendor.class, criterias, "name", false));
    // model.addAttribute("fuelcard",genericDAO.findByCriteria(FuelCard.class,criterias,"fuelcardNum",false));
    model.addAttribute(
        "fuelcard",
        genericDAO.executeSimpleQuery("select fc from FuelCard fc order by ABS(fc.fuelcardNum)"));
    // criterias.put("status", 1);
    criterias.clear();
    // EmployeeCatagory empobj = genericDAO.getById(EmployeeCatagory.class,2l);
    // criterias.put("catagory", empobj);
    if (request.getParameter("id") != null) {
      criterias.clear();
      model.addAttribute(
          "drivers", genericDAO.findByCriteria(Driver.class, criterias, "fullName", false));
    } else {
      criterias.put("status", 1);
      model.addAttribute(
          "drivers", genericDAO.findByCriteria(Driver.class, criterias, "fullName", false));
    }

    criterias.clear();
    model.addAttribute(
        "searchdriver",
        genericDAO.executeSimpleQuery("select obj from Driver obj group by obj.fullName"));

    criterias.clear();
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("dataType", "STATUS");
    map.put("dataValue", "0,1");
    model.addAttribute(
        "fuelcardstatus", genericDAO.findByCriteria(StaticData.class, map, "dataText", false));
  }
 private void clearCaches(boolean isPhysical) {
   myCalculatedTypes.clear();
   if (isPhysical) {
     myVarToConstValueMapPhysical.clear();
   }
   myVarToConstValueMapNonPhysical.clear();
 }
Exemplo n.º 26
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++;
    }
  }
Exemplo n.º 27
0
  public void setFolders(List<File> folderList) {

    this.folderList = folderList;
    sortedDisplays.clear();
    displayFileToGalleryItemMap.clear();
    galleryItemToDisplayFileMap.clear();

    gallery.clearAll();
    gallery.removeAll();

    for (File folder : folderList) {

      String text = getWorkspaceRelativePath(folder);

      final GalleryItem folderGroupItem = new GalleryItem(gallery, SWT.NONE);

      folderGroupItem.setText(text);
      folderGroupItem.setExpanded(true);
      FileFilter fileFilter =
          new FileFilter() {
            @Override
            public boolean accept(File pathname) {
              return pathname.isFile() && pathname.getName().endsWith(".css-sds");
            }
          };

      for (File file : folder.listFiles(fileFilter)) {
        GalleryItem galleryItem = new GalleryItem(folderGroupItem, SWT.NONE);
        galleryItem.setText(file.getName().substring(0, file.getName().lastIndexOf(".")));
        addFileToLibrary(file, galleryItem);
      }
    }

    createThumbnailsAsync();
  }
Exemplo n.º 28
0
 @Override
 public void readFromNBT(NBTTagCompound tagCompound) {
   protectorById.clear();
   protectorIdByCoordinate.clear();
   lastId = tagCompound.getInteger("lastId");
   readDestinationsFromNBT(tagCompound);
 }
Exemplo n.º 29
0
 /** Dispose all of the cached images. */
 public static void disposeImages() {
   SWTResourceManager.disposeImages();
   // dispose ImageDescriptor images
   {
     for (Iterator<Image> I = m_descriptorImageMap.values().iterator(); I.hasNext(); ) {
       I.next().dispose();
     }
     m_descriptorImageMap.clear();
   }
   // dispose decorated images
   for (int i = 0; i < m_decoratedImageMap.length; i++) {
     Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i];
     if (cornerDecoratedImageMap != null) {
       for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) {
         for (Image image : decoratedMap.values()) {
           image.dispose();
         }
         decoratedMap.clear();
       }
       cornerDecoratedImageMap.clear();
     }
   }
   // dispose plugin images
   {
     for (Iterator<Image> I = m_URLImageMap.values().iterator(); I.hasNext(); ) {
       I.next().dispose();
     }
     m_URLImageMap.clear();
   }
 }
Exemplo n.º 30
0
  /**
   * Disposes this key binding service. This clears out all of the submissions held by this service,
   * and its nested services.
   */
  public void dispose() {
    if (!disposed) {
      deactivateNestedService();
      disposed = true;

      PlatformUI.getWorkbench()
          .getContextSupport()
          .removeEnabledSubmissions(new ArrayList(enabledSubmissions));
      enabledSubmissions.clear();

      /*
       * Each removed handler submission, must dispose its corresponding
       * handler -- as these handlers only exist inside of this class.
       */
      final List submissions = new ArrayList(handlerSubmissionsByCommandId.values());
      final Iterator submissionItr = submissions.iterator();
      while (submissionItr.hasNext()) {
        ((HandlerSubmission) submissionItr.next()).getHandler().dispose();
      }
      PlatformUI.getWorkbench().getCommandSupport().removeHandlerSubmissions(submissions);
      handlerSubmissionsByCommandId.clear();

      for (Iterator iterator = nestedServices.values().iterator(); iterator.hasNext(); ) {
        KeyBindingService keyBindingService = (KeyBindingService) iterator.next();
        keyBindingService.dispose();
      }

      nestedEnabledSubmissions = null;
      nestedHandlerSubmissions = null;
      nestedServices.clear();
    }
  }