Java Code Examples for java.util.TreeMap#isEmpty()

The following examples show how to use java.util.TreeMap#isEmpty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MonitorService.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
public void reportConsumerRunningInfo(final String consumerGroup) throws InterruptedException,
    MQBrokerException, RemotingException, MQClientException {
    ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(consumerGroup);
    TreeMap<String, ConsumerRunningInfo> infoMap = new TreeMap<String, ConsumerRunningInfo>();
    for (Connection c : cc.getConnectionSet()) {
        String clientId = c.getClientId();

        if (c.getVersion() < MQVersion.Version.V3_1_8_SNAPSHOT.ordinal()) {
            continue;
        }

        try {
            ConsumerRunningInfo info =
                defaultMQAdminExt.getConsumerRunningInfo(consumerGroup, clientId, false);
            infoMap.put(clientId, info);
        } catch (Exception e) {
        }
    }

    if (!infoMap.isEmpty()) {
        this.monitorListener.reportConsumerRunningInfo(infoMap);
    }
}
 
Example 2
Source File: MonitorService.java    From rocketmq with Apache License 2.0 6 votes vote down vote up
public void reportConsumerRunningInfo(final String consumerGroup) throws InterruptedException,
    MQBrokerException, RemotingException, MQClientException {
    ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(consumerGroup);
    TreeMap<String, ConsumerRunningInfo> infoMap = new TreeMap<String, ConsumerRunningInfo>();
    for (Connection c : cc.getConnectionSet()) {
        String clientId = c.getClientId();

        if (c.getVersion() < MQVersion.Version.V3_1_8_SNAPSHOT.ordinal()) {
            continue;
        }

        try {
            ConsumerRunningInfo info =
                defaultMQAdminExt.getConsumerRunningInfo(consumerGroup, clientId, false);
            infoMap.put(clientId, info);
        } catch (Exception e) {
        }
    }

    if (!infoMap.isEmpty()) {
        this.monitorListener.reportConsumerRunningInfo(infoMap);
    }
}
 
Example 3
Source File: MonitorService.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
public void reportConsumerRunningInfo(final String consumerGroup) throws InterruptedException,
    MQBrokerException, RemotingException, MQClientException {
    ConsumerConnection cc = defaultMQAdminExt.examineConsumerConnectionInfo(consumerGroup);
    TreeMap<String, ConsumerRunningInfo> infoMap = new TreeMap<String, ConsumerRunningInfo>();
    for (Connection c : cc.getConnectionSet()) {
        String clientId = c.getClientId();

        if (c.getVersion() < MQVersion.Version.V3_1_8_SNAPSHOT.ordinal()) {
            continue;
        }

        try {
            ConsumerRunningInfo info =
                defaultMQAdminExt.getConsumerRunningInfo(consumerGroup, clientId, false);
            infoMap.put(clientId, info);
        } catch (Exception e) {
        }
    }

    if (!infoMap.isEmpty()) {
        this.monitorListener.reportConsumerRunningInfo(infoMap);
    }
}
 
Example 4
Source File: ProfileValue.java    From arctic-sea with Apache License 2.0 6 votes vote down vote up
public Geometry getGeometry() {
    if (isSetGeometry()) {
        TreeMap<Time, Coordinate> map = new TreeMap<>();
        int srid = -1;
        for (ProfileLevel level : getValue()) {
            if (level.isSetPhenomenonTime() && level.isSetLocation()) {
                if (srid < 0) {
                    srid = level.getLocation().getSRID();
                }
                map.put(level.getPhenomenonTime(), level.getLocation().getCoordinate());
            }
        }
        if (!map.isEmpty()) {
            if (new HashSet<>(map.values()).size() == 1) {
                return getValue().iterator().next().getLocation();
            } else {
                return new GeometryFactory(new PrecisionModel(), srid)
                        .createLineString(map.values().toArray(new Coordinate[1]));
            }
        }
    }
    return null;
}
 
Example 5
Source File: AMRMClientImpl.java    From big-c with Apache License 2.0 6 votes vote down vote up
/**
 * ContainerRequests with locality relaxation cannot be made at the same
 * priority as ContainerRequests without locality relaxation.
 */
private void checkLocalityRelaxationConflict(Priority priority,
    Collection<String> locations, boolean relaxLocality) {
  Map<String, TreeMap<Resource, ResourceRequestInfo>> remoteRequests =
      this.remoteRequestsTable.get(priority);
  if (remoteRequests == null) {
    return;
  }
  // Locality relaxation will be set to relaxLocality for all implicitly
  // requested racks. Make sure that existing rack requests match this.
  for (String location : locations) {
      TreeMap<Resource, ResourceRequestInfo> reqs =
          remoteRequests.get(location);
      if (reqs != null && !reqs.isEmpty()) {
        boolean existingRelaxLocality =
            reqs.values().iterator().next().remoteRequest.getRelaxLocality();
        if (relaxLocality != existingRelaxLocality) {
          throw new InvalidContainerRequestException("Cannot submit a "
              + "ContainerRequest asking for location " + location
              + " with locality relaxation " + relaxLocality + " when it has "
              + "already been requested with locality relaxation " + existingRelaxLocality);
        }
      }
    }
}
 
Example 6
Source File: AbstractVersionedTargetGraphBuilder.java    From buck with Apache License 2.0 6 votes vote down vote up
/**
 * @return the {@link BuildTarget} to use in the resolved target graph, formed by adding a flavor
 *     generated from the given version selections.
 */
protected final Optional<BuildTarget> getTranslateBuildTarget(
    TargetNode<?> node, ImmutableMap<BuildTarget, Version> selectedVersions) {

  BuildTarget originalTarget = node.getBuildTarget();
  node = resolveVersions(node, selectedVersions);
  BuildTarget newTarget = node.getBuildTarget();

  if (TargetGraphVersionTransformations.isVersionPropagator(node)) {
    VersionInfo info = getVersionInfo(node);
    Collection<BuildTarget> versionedDeps = info.getVersionDomain().keySet();
    TreeMap<BuildTarget, Version> versions = new TreeMap<>();
    for (BuildTarget depTarget : versionedDeps) {
      versions.put(depTarget, selectedVersions.get(depTarget));
    }
    if (!versions.isEmpty()) {
      Flavor versionedFlavor = getVersionedFlavor(versions);
      newTarget = node.getBuildTarget().withAppendedFlavors(versionedFlavor);
    }
  }

  return newTarget.equals(originalTarget) ? Optional.empty() : Optional.of(newTarget);
}
 
Example 7
Source File: TimelineMetricsCache.java    From ambari-metrics with Apache License 2.0 6 votes vote down vote up
public synchronized void putMetric(TimelineMetric metric) {
  TreeMap<Long, Double> metricValues = this.timelineMetric.getMetricValues();
  if (metricValues.size() > maxRecsPerName) {
    // remove values for eldest maxEvictionTimeInMillis
    long newEldestTimestamp = oldestTimestamp + maxEvictionTimeInMillis;
    TreeMap<Long, Double> metricsSubSet =
      new TreeMap<>(metricValues.tailMap(newEldestTimestamp));
    if (metricsSubSet.isEmpty()) {
      oldestTimestamp = metric.getStartTime();
      this.timelineMetric.setStartTime(metric.getStartTime());
    } else {
      Long newStartTime = metricsSubSet.firstKey();
      oldestTimestamp = newStartTime;
      this.timelineMetric.setStartTime(newStartTime);
    }
    this.timelineMetric.setMetricValues(metricsSubSet);
    LOG.warn("Metrics cache overflow. Values for metric " +
      metric.getMetricName() + " older than " + newEldestTimestamp +
      " were removed to clean up the cache.");
  }
  this.timelineMetric.addMetricValues(metric.getMetricValues());
  updateTimeDiff(metric.getStartTime());
}
 
Example 8
Source File: ConsumerStatusSubCommand.java    From DDMQ with Apache License 2.0 6 votes vote down vote up
private void printRebalanceResult(TreeMap<String, ConsumerRunningInfo> criTable) {
    if (criTable == null || criTable.isEmpty()) {
        System.out.printf("Empty Result: criTable is empty.\n");
        return;
    }
    Map<MessageQueue, String> rbResult = new TreeMap<MessageQueue, String>();
    for (String cid : criTable.keySet()) {
        for (MessageQueue messageQueue : criTable.get(cid).getMqTable().keySet()) {
            rbResult.put(messageQueue, cid);
        }
    }
    String format = "%30s|%20s|%10s| %s\n";
    System.out.printf("--------------------------------------------------------------------------------------------------\n");
    System.out.printf(format, "Topic","Broker Name", "QueueId", "ConsumerClientId");
    System.out.printf("--------------------------------------------------------------------------------------------------\n");
    for (Entry<MessageQueue, String> entry : rbResult.entrySet()) {
        System.out.printf(format, entry.getKey().getTopic(), entry.getKey().getBrokerName(),
                entry.getKey().getQueueId(), entry.getValue());
    }

}
 
Example 9
Source File: Renderer.java    From gpx-animator with Apache License 2.0 5 votes vote down vote up
private void translateCoordinatesToZeroZero(final double scale, final TreeMap<Long, Point2D> timePointMap) {
    if (!timePointMap.isEmpty()) {
        maxTime = Math.max(maxTime, timePointMap.lastKey());
        minTime = Math.min(minTime, timePointMap.firstKey());

        for (final Point2D point : timePointMap.values()) {
            point.setLocation((point.getX() - minX) * scale, (maxY - point.getY()) * scale);
        }
    }
}
 
Example 10
Source File: LCSFileReader.java    From galaxy-sdk-java with Apache License 2.0 5 votes vote down vote up
@Override
protected void doStartTransaction() {
  TreeMap<String, File> fileTreeMap = FileUtils.listFile(topicFilePath, topicName);
  if (!fileTreeMap.isEmpty()) {
    curFilePath = fileTreeMap.firstEntry().getValue().getAbsolutePath();
  } else {
    curFilePath = null;
  }

}
 
Example 11
Source File: ShardUtil.java    From star-zone with Apache License 2.0 5 votes vote down vote up
/**
 * 沿环的顺时针找到节点
 *
 * @param map
 * @param key
 * @return
 */
public static String doGetTableName(TreeMap<Long, String> map, String key) {
    final Long hash = alg.hash(key);
    Long target = hash;
    if (!map.containsKey(hash)) {
        target = map.ceilingKey(hash);
        if (target == null && !map.isEmpty()) {
            target = map.firstKey();
        }
    }
    return map.get(target);
}
 
Example 12
Source File: JobInitializationPoller.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
/**
 * This method returns the first job in the queue and removes the same.
 * 
 * @param queue
 *          queue name
 * @return First job in the queue and removes it.
 */
private JobInProgress getFirstJobInQueue(String queue) {
  TreeMap<JobSchedulingInfo, JobInProgress> jobsList = jobsPerQueue
      .get(queue);
  synchronized (jobsList) {
    if (jobsList.isEmpty()) {
      return null;
    }
    Iterator<JobInProgress> jobIterator = jobsList.values().iterator();
    JobInProgress job = jobIterator.next();
    jobIterator.remove();
    currentJobCount.getAndDecrement();
    return job;
  }
}
 
Example 13
Source File: CDKMCSHandler.java    From ReactionDecoder with GNU Lesser General Public License v3.0 5 votes vote down vote up
private synchronized void setAllMapping(List<Map<Integer, Integer>> solutions) {

        //System.out.println("Output of the final FinalMappings: ");
        try {
            int counter = 0;
            for (Map<Integer, Integer> final_solution : solutions) {
                TreeMap<Integer, Integer> atomMappings = new TreeMap<>();
                final_solution.entrySet().stream().forEach((Solutions) -> {
                    int iIndex = Solutions.getKey();
                    int jIndex = Solutions.getValue();

                    if (rOnPFlag) {
                        atomMappings.put(iIndex, jIndex);
                    } else {
                        atomMappings.put(jIndex, iIndex);
                    }
                });
                if (!allMCS.contains(atomMappings)) {
                    if (!atomMappings.isEmpty()) {
                        allMCS.add(counter, atomMappings);
                        counter += 1;
                    }
                }
            }

        } catch (Exception ex) {
            ex.getCause();
        }

    }
 
Example 14
Source File: OrderedTombstoneMap.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Remove a version tag from the map.
 */
public Map.Entry<VersionTag, T> take() {
  if(tombstoneMap.isEmpty()) {
    //if there are no more entries, return null;
    return null;
  } else {
    //Otherwise, look at all of the members and find the tag with the 
    //lowest timestamp.
    long lowestTimestamp = Long.MAX_VALUE;
    TreeMap<VersionTag, T> lowestMap = null;
    for(TreeMap<VersionTag, T> memberMap: tombstoneMap.values()) {
      VersionTag firstTag = memberMap.firstKey();
      long stamp = firstTag.getVersionTimeStamp();
      if(stamp < lowestTimestamp) {
        lowestTimestamp = stamp;
        lowestMap = memberMap;
      }
    }
    if(lowestMap == null) {
      return null;
    }
    //Remove the lowest entry
    Entry<VersionTag, T> result = lowestMap.firstEntry();
    lowestMap.remove(result.getKey());
    if(lowestMap.isEmpty()) {
      //if this is the last entry from a given member,
      //the map for that member
      tombstoneMap.remove(result.getKey().getMemberID());
    }
    
    return result;
  }
}
 
Example 15
Source File: UnencumberedLoadFacet.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Returns the best Load value to avoid encumberance from Load for the
 * Player Character identified by the given CharID.
 * 
 * @param id
 *            The CharID identifying the Player Character
 * @return The best Load value to avoid encumberance from Load for the
 *         Player Character identified by the given CharID.
 */
public Load getBestLoad(CharID id)
{
	TreeMap<Load, Set<Object>> map = (TreeMap<Load, Set<Object>>) getCachedMap(id);
	if (map == null || map.isEmpty())
	{
		return Load.LIGHT;
	}
	return map.lastKey();
}
 
Example 16
Source File: UnencumberedArmorFacet.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Returns the best Load value to avoid encumberance from Armor for the
 * Player Character identified by the given CharID.
 * 
 * @param id
 *            The CharID identifying the Player Character
 * @return The best Load value to avoid encumberance from Armor for the
 *         Player Character identified by the given CharID.
 */
public Load getBestLoad(CharID id)
{
	TreeMap<Load, Set<Object>> map = (TreeMap<Load, Set<Object>>) getCachedMap(id);
	if (map == null || map.isEmpty())
	{
		return Load.LIGHT;
	}
	return map.lastKey();
}
 
Example 17
Source File: ULocale.java    From j2objc with Apache License 2.0 4 votes vote down vote up
private static ULocale getInstance(BaseLocale base, LocaleExtensions exts) {
    String id = lscvToID(base.getLanguage(), base.getScript(), base.getRegion(),
            base.getVariant());

    Set<Character> extKeys = exts.getKeys();
    if (!extKeys.isEmpty()) {
        // legacy locale ID assume Unicode locale keywords and
        // other extensions are at the same level.
        // e.g. @a=ext-for-aa;calendar=japanese;m=ext-for-mm;x=priv-use

        TreeMap<String, String> kwds = new TreeMap<String, String>();
        for (Character key : extKeys) {
            Extension ext = exts.getExtension(key);
            if (ext instanceof UnicodeLocaleExtension) {
                UnicodeLocaleExtension uext = (UnicodeLocaleExtension)ext;
                Set<String> ukeys = uext.getUnicodeLocaleKeys();
                for (String bcpKey : ukeys) {
                    String bcpType = uext.getUnicodeLocaleType(bcpKey);
                    // convert to legacy key/type
                    String lkey = toLegacyKey(bcpKey);
                    String ltype = toLegacyType(bcpKey, ((bcpType.length() == 0) ? "yes" : bcpType)); // use "yes" as the value of typeless keywords
                    // special handling for u-va-posix, since this is a variant, not a keyword
                    if (lkey.equals("va") && ltype.equals("posix") && base.getVariant().length() == 0) {
                        id = id + "_POSIX";
                    } else {
                        kwds.put(lkey, ltype);
                    }
                }
                // Mapping Unicode locale attribute to the special keyword, attribute=xxx-yyy
                Set<String> uattributes = uext.getUnicodeLocaleAttributes();
                if (uattributes.size() > 0) {
                    StringBuilder attrbuf = new StringBuilder();
                    for (String attr : uattributes) {
                        if (attrbuf.length() > 0) {
                            attrbuf.append('-');
                        }
                        attrbuf.append(attr);
                    }
                    kwds.put(LOCALE_ATTRIBUTE_KEY, attrbuf.toString());
                }
            } else {
                kwds.put(String.valueOf(key), ext.getValue());
            }
        }

        if (!kwds.isEmpty()) {
            StringBuilder buf = new StringBuilder(id);
            buf.append("@");
            Set<Map.Entry<String, String>> kset = kwds.entrySet();
            boolean insertSep = false;
            for (Map.Entry<String, String> kwd : kset) {
                if (insertSep) {
                    buf.append(";");
                } else {
                    insertSep = true;
                }
                buf.append(kwd.getKey());
                buf.append("=");
                buf.append(kwd.getValue());
            }

            id = buf.toString();
        }
    }
    return new ULocale(id);
}
 
Example 18
Source File: SimMarketDataService.java    From java-trader with Apache License 2.0 4 votes vote down vote up
public static Exchangeable getPrimaryInstrument(Exchange exchange, String commodity, LocalDate tradingDay) {
    int occurence=0;
    char cc = commodity.charAt(commodity.length()-1);
    if ( cc>='0' && cc<='9') {
        occurence = cc-'0';
        commodity = commodity.substring(0, commodity.length()-1);
    }
    if ( exchange==null ) {
        exchange = Future.detectExchange(commodity);
    }
    ExchangeableData edata = TraderHomeUtil.getExchangeableData();
    Future cf = new Future(exchange, commodity, commodity);
    TreeMap<Long, Exchangeable> instruments = new TreeMap<>();
    //Load daily stats data
    try {
        if ( edata.exists(cf, ExchangeableData.DAYSTATS, null)) {
            String key = cf.uniqueId()+"-"+tradingDay;
            String cachedData = cachedDayStats.get(key);
            if ( cachedData==null ) {
                cachedData = edata.load(cf, ExchangeableData.DAYSTATS, null);
                cachedDayStats.put(key, cachedData);
            }
            CSVDataSet csvDataSet = CSVUtil.parse(cachedData);
            while(csvDataSet.next()) {
                String statTradingDay = csvDataSet.get(ExchangeableData.COLUMN_TRADINGDAY);
                long openInt = csvDataSet.getLong(ExchangeableData.COLUMN_END_OPENINT);
                Exchangeable instrument = Exchangeable.fromString(csvDataSet.get(ExchangeableData.COLUMN_INSTRUMENT_ID));
                if ( DateUtil.str2localdate(statTradingDay).equals(tradingDay) && StringUtil.equalsIgnoreCase(instrument.commodity(), commodity) ) {
                    instruments.put(openInt, instrument);
                }
            }
        }
    }catch(IOException ioe) {
        throw new AppRuntimeException(ioe, ServiceErrorConstants.ERR_DATA_LOAD_FAILED,
                MessageFormat.format("{0} 加载 dayStats 文件失败: {1}", commodity, ioe) );
    }
    if ( instruments.isEmpty() ) {
        throw new AppRuntimeException(ServiceErrorConstants.ERR_DATA_LOAD_FAILED,
                MessageFormat.format("{0} {1} 在 dayStats 中无数据", commodity, tradingDay) );
    }
    List<Exchangeable> instruments0 = new ArrayList<>(instruments.values());
    Collections.reverse(instruments0);
    Exchangeable result = null;
    int instrumentOccurence=0;
    for(Exchangeable e:instruments0) {
        instrumentOccurence++;
        if ( instrumentOccurence>=occurence) {
            result = e;
            break;
        }
    }
    return result;
}
 
Example 19
Source File: RawDataFileOpenHandler_2_0.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String, java.lang.String,
 *      java.lang.String)
 */
public void endElement(String namespaceURI, String sName, String qName) throws SAXException {

  if (canceled)
    throw new SAXException("Parsing canceled");

  // <NAME>
  if (qName.equals(RawDataElementName_2_0.NAME.getElementName())) {

    // Adds the scan file and the name to the new raw data file
    String name = getTextOfElement();
    logger.info("Loading raw data file: " + name);
    newRawDataFile.setName(name);
  }

  if (qName.equals(RawDataElementName_2_0.QUANTITY_SCAN.getElementName())) {
    Integer.parseInt(getTextOfElement());
  }

  if (qName.equals(RawDataElementName_2_0.SCAN_ID.getElementName())) {
    scanNumber = Integer.parseInt(getTextOfElement());
  }

  if (qName.equals(RawDataElementName_2_0.MS_LEVEL.getElementName())) {
    msLevel = Integer.parseInt(getTextOfElement());
  }

  if (qName.equals(RawDataElementName_2_0.PARENT_SCAN.getElementName())) {
    Integer.parseInt(getTextOfElement());
  }

  if (qName.equals(RawDataElementName_2_0.PRECURSOR_MZ.getElementName())) {
    precursorMZ = Double.parseDouble(getTextOfElement());
  }

  if (qName.equals(RawDataElementName_2_0.PRECURSOR_CHARGE.getElementName())) {
    precursorCharge = Integer.parseInt(getTextOfElement());
  }

  if (qName.equals(RawDataElementName_2_0.RETENTION_TIME.getElementName())) {
    // Before MZmine.6 retention time was saved in seconds, but now we
    // use
    // minutes, so we need to divide by 60
    retentionTime = Double.parseDouble(getTextOfElement()) / 60d;
  }

  if (qName.equals(RawDataElementName_2_0.ION_MOBILITY.getElementName()))
  {
    mobility = Double.parseDouble(getTextOfElement());
  }

  if (qName.equals(RawDataElementName_2_0.CENTROIDED.getElementName())) {
    boolean centroided = Boolean.parseBoolean(getTextOfElement());
    if (centroided)
      spectrumType = MassSpectrumType.CENTROIDED;
    else
      spectrumType = MassSpectrumType.PROFILE;
  }

  if (qName.equals(RawDataElementName_2_0.QUANTITY_DATAPOINTS.getElementName())) {
    dataPointsNumber = Integer.parseInt(getTextOfElement());
  }

  if (qName.equals(RawDataElementName_2_0.FRAGMENT_SCAN.getElementName())) {
    fragmentScan[fragmentCount++] = Integer.parseInt(getTextOfElement());
  }

  if (qName.equals(RawDataElementName_2_0.SCAN.getElementName())) {

    try {
      int newStorageID = 1;
      TreeMap<Integer, Long> dataPointsOffsets = newRawDataFile.getDataPointsOffsets();
      TreeMap<Integer, Integer> dataPointsLengths = newRawDataFile.getDataPointsLengths();
      if (!dataPointsOffsets.isEmpty())
        newStorageID = dataPointsOffsets.lastKey().intValue() + 1;

      StorableScan storableScan = new StorableScan(newRawDataFile, newStorageID, dataPointsNumber,
          scanNumber, msLevel, retentionTime, mobility, precursorMZ, precursorCharge, fragmentScan,
          spectrumType, PolarityType.UNKNOWN, "", null);
      newRawDataFile.addScan(storableScan);

      dataPointsOffsets.put(newStorageID, storageFileOffset);
      dataPointsLengths.put(newStorageID, dataPointsNumber);

    } catch (IOException e) {
      throw new SAXException(e);
    }
    storageFileOffset += dataPointsNumber * 4 * 2;

  }
}
 
Example 20
Source File: DefaultCustomDictionary.java    From mynlp with Apache License 2.0 2 votes vote down vote up
public DefaultCustomDictionary(MynlpEnv mynlp) throws Exception {

        List<String> resourceUrls = mynlp.getSettings().getAsList(dictPathSetting);

        if (resourceUrls == null || resourceUrls.isEmpty()) {
            return;
        }

        this.resourceUrls = resourceUrls;


        TreeMap<String, Integer> map = new TreeMap<>();

        for (String url : resourceUrls) {
            NlpResource resource = mynlp.tryLoadResource(url);

            if (resource == null) {
                logger.warn("miss resource "+url);
                continue;
            }

            try (CharSourceLineReader reader = UseLines.lineReader(resource.inputStream())) {
                while (reader.hasNext()) {
                    String line = reader.next();

                    String[] params = line.split("\\s");

                    if (isNormalization) {
                        params[0] = normalizationString(params[0]);
                    }

                    map.put(params[0], 1000);
                }
            }
        }


        if (map.isEmpty()) {
            return;
        }

        dat = new DoubleArrayTrieStringIntMap(map);
    }