Java 类java.util.concurrent.ConcurrentSkipListSet 实例源码

项目:TechnicalAnalysisTool    文件:FinancialMarketTest.java   
/**
 * Test of emptyAll method, of class FinancialMarket.
 */
@Test
public void testEmptyAll() {
    System.out.println("testGetFinancialMarket");
    FinancialMarket instance = new FinancialMarket();
    assertTrue(instance.getFinancialMarketData().get("ETFs").isEmpty());
    Market market = new Market("Global Uranium X", ChartType.DAY, "Australia");
    instance.addMarket("ETFs", market);
    ConcurrentHashMap<String, ConcurrentSkipListSet<Market>> result = instance.getFinancialMarketData();
    assertEquals(0, result.get("Stocks").size());
    assertEquals(1, result.get("ETFs").size());
    Market actual = instance.getMarket("ETFs", "Global Uranium X");
    assertNotNull(actual);
    assertTrue(actual.getMarketCode().compareToIgnoreCase("Global Uranium X") == 0);
    assertEquals(ChartType.DAY, actual.getChartType());
    instance.emptyAll();
    assertNull(instance.getMarket("ETFs", "Global Uranium X"));

}
项目:cas-5.1.0    文件:DefaultServicesManager.java   
/**
 * Load services that are provided by the DAO.
 */
@Scheduled(initialDelayString = "${cas.serviceRegistry.startDelay:PT20S}",
        fixedDelayString = "${cas.serviceRegistry.repeatInterval:PT60S}")
@Override
@PostConstruct
public void load() {
    LOGGER.debug("Loading services from [{}]", this.serviceRegistryDao);
    this.services = this.serviceRegistryDao.load().stream()
            .collect(Collectors.toConcurrentMap(r -> {
                LOGGER.debug("Adding registered service [{}]", r.getServiceId());
                return r.getId();
            }, Function.identity(), (r, s) -> s == null ? r : s));
    this.orderedServices = new ConcurrentSkipListSet<>(this.services.values());
    publishEvent(new CasRegisteredServicesLoadedEvent(this, this.orderedServices));
    LOGGER.info("Loaded [{}] service(s) from [{}].", this.services.size(), this.serviceRegistryDao);
}
项目:shabdiz    文件:ApplicationNetwork.java   
/**
 * Instantiates a new Application network.
 *
 * @param application_name the application name
 * @param scanner_interval the scanner interval for all defaults scanners
 * @param scanner_timeout the scanner timeout for all defaults scanners
 * @param scanner_thread_pool_size the scanner scheduler thread pool size
 * @param concurrent_scanner_thread_pool_size the size of the thread pool used by {@link ConcurrentScanner concurrent scans}
 */
public ApplicationNetwork(final String application_name, final Duration scanner_interval, final Duration scanner_timeout, final int scanner_thread_pool_size, final int concurrent_scanner_thread_pool_size) {

    this.application_name = application_name;
    application_descriptors = new ConcurrentSkipListSet<>();
    scheduled_scanners = new HashMap<>();
    scanner_scheduler = createScannerScheduledExecutorService(scanner_thread_pool_size);
    concurrent_scanner_executor = createScannerExecutorService(concurrent_scanner_thread_pool_size);
    network_executor_service = createNetworkExecutorService();

    auto_kill_scanner = new AutoKillScanner(scanner_interval, scanner_timeout);
    auto_deploy_scanner = new AutoDeployScanner(scanner_interval, scanner_timeout);
    auto_remove_scanner = new AutoRemoveScanner(scanner_interval, scanner_timeout);
    status_scanner = new StatusScanner(scanner_interval);

    addScanner(auto_kill_scanner);
    addScanner(auto_deploy_scanner);
    addScanner(auto_remove_scanner);
    addScanner(status_scanner);
}
项目:nitrite-database    文件:IndexedSearchService.java   
Set<NitriteId> findEqual(String field, Object value) {
    if (!(value instanceof Comparable)) {
        throw new FilterException(CAN_NOT_SEARCH_NON_COMPARABLE_ON_INDEXED_FIELD);
    }

    NitriteMap<Comparable, ConcurrentSkipListSet<NitriteId>> indexMap
            = indexMetaService.getIndexMap(field);

    Set<NitriteId> resultSet = null;
    if (indexMap != null) {
        resultSet = indexMap.get((Comparable) value);
    }

    if (resultSet == null) resultSet = new LinkedHashSet<>();
    return resultSet;
}
项目:nitrite-database    文件:NitriteTextIndexingService.java   
private void createOrUpdate(NitriteId id, String field, String text) {
    try {
        NitriteMap<Comparable, ConcurrentSkipListSet<NitriteId>> indexMap
                = indexMetaService.getIndexMap(field);
        Set<String> words = tokenizerService.tokenize(text);

        Object fieldLock = indexMetaService.getFieldLock(field);
        for (String word : words) {
            ConcurrentSkipListSet<NitriteId> nitriteIds = indexMap.get(word);

            synchronized (fieldLock) {
                if (nitriteIds == null) {
                    nitriteIds = new ConcurrentSkipListSet<>();
                    indexMap.put(word, nitriteIds);
                }
            }

            nitriteIds.add(id);
        }
    } catch (IOException ioe) {
        throw new IndexingException(errorMessage(
                "could not write full-text index data for " + text,
                IE_FAILED_TO_WRITE_FTS_DATA), ioe);
    }
}
项目:nitrite-database    文件:NitriteTextIndexingService.java   
private Set<NitriteId> searchByTrailingWildCard(String field, String searchString) {
    if (searchString.equalsIgnoreCase("*")) {
        throw new FilterException(INVALID_SEARCH_TERM_TRAILING_STAR);
    }

    NitriteMap<Comparable, ConcurrentSkipListSet<NitriteId>> indexMap
            = indexMetaService.getIndexMap(field);
    Set<NitriteId> idSet = new LinkedHashSet<>();
    String term = searchString.substring(0, searchString.length() - 1);

    for (Map.Entry<Comparable, ConcurrentSkipListSet<NitriteId>> entry : indexMap.entrySet()) {
        String key = (String) entry.getKey();
        if (key.startsWith(term.toLowerCase())) {
            idSet.addAll(entry.getValue());
        }
    }
    return idSet;
}
项目:nitrite-database    文件:NitriteTextIndexingService.java   
private Set<NitriteId> searchByLeadingWildCard(String field, String searchString) {
    if (searchString.equalsIgnoreCase("*")) {
        throw new FilterException(INVALID_SEARCH_TERM_LEADING_STAR);
    }

    NitriteMap<Comparable, ConcurrentSkipListSet<NitriteId>> indexMap
            = indexMetaService.getIndexMap(field);
    Set<NitriteId> idSet = new LinkedHashSet<>();
    String term = searchString.substring(1, searchString.length());

    for (Map.Entry<Comparable, ConcurrentSkipListSet<NitriteId>> entry : indexMap.entrySet()) {
        String key = (String) entry.getKey();
        if (key.endsWith(term.toLowerCase())) {
            idSet.addAll(entry.getValue());
        }
    }
    return idSet;
}
项目:openjdk-jdk10    文件:ConcurrentSkipListSetTest.java   
/**
 * Subsets of subsets subdivide correctly
 */
public void testRecursiveSubSets() throws Exception {
    int setSize = expensiveTests ? 1000 : 100;
    Class cl = ConcurrentSkipListSet.class;

    NavigableSet<Integer> set = newSet(cl);
    BitSet bs = new BitSet(setSize);

    populate(set, setSize, bs);
    check(set,                 0, setSize - 1, true, bs);
    check(set.descendingSet(), 0, setSize - 1, false, bs);

    mutateSet(set, 0, setSize - 1, bs);
    check(set,                 0, setSize - 1, true, bs);
    check(set.descendingSet(), 0, setSize - 1, false, bs);

    bashSubSet(set.subSet(0, true, setSize, false),
               0, setSize - 1, true, bs);
}
项目:guava-mock    文件:TestsForSetsInJavaUtil.java   
public Test testsForConcurrentSkipListSetWithComparator() {
  return SetTestSuiteBuilder.using(
          new TestStringSortedSetGenerator() {
            @Override
            public SortedSet<String> create(String[] elements) {
              SortedSet<String> set =
                  new ConcurrentSkipListSet<String>(arbitraryNullFriendlyComparator());
              Collections.addAll(set, elements);
              return set;
            }
          })
      .named("ConcurrentSkipListSet, with comparator")
      .withFeatures(
          SetFeature.GENERAL_PURPOSE,
          CollectionFeature.SERIALIZABLE,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .suppressing(suppressForConcurrentSkipListSetWithComparator())
      .createTestSuite();
}
项目:server    文件:Backlog.java   
@SuppressWarnings("unchecked")
synchronized void loadSavepoint(Savepoint pt) {

    try {

        ConcurrentHashMap<Long, Transaction> transactionSet;
        try (ByteArrayInputStream bais = new ByteArrayInputStream(pt.data)) {
            try (ObjectInputStream ois = new ObjectInputStream(bais)) {
                transactionSet = (ConcurrentHashMap<Long, Transaction>) ois.readObject();
            }
        }

        ConcurrentSkipListSet<Long> listSet = new ConcurrentSkipListSet<>(new LongComparator(transactionSet));
        listSet.addAll(transactionSet.keySet());

        this.transactions = transactionSet;
        this.keys = listSet;
    } catch (Exception e) {
        throw new DataAccessException(e);
    }

}
项目:openjdk-jdk10    文件:AddNonComparable.java   
@Test
public void sets() {
    test(new TreeSet<>(), NonComparable::new,
         (s, e) -> {
             assertEquals(s.size(), 0);
             assertTrue(e instanceof ClassCastException);
         });
    test(new TreeSet<>(), AComparable::new,
         (s, e) -> {
             assertEquals(s.size(), 1);
             assertTrue(e == null);
         });

    test(new ConcurrentSkipListSet<>(), NonComparable::new,
         (s, e) -> {
             assertEquals(s.size(), 0);
             assertTrue(e instanceof ClassCastException);
         });
    test(new ConcurrentSkipListSet<>(), AComparable::new,
         (s, e) -> {
             assertEquals(s.size(), 1);
             assertTrue(e == null);
         });
}
项目:TechnicalAnalysisTool    文件:FinancialMarketTest.java   
/**
 * Test of removeMarket method, of class FinancialMarket.
 */
@Test
public void testRemoveMarket() {
    System.out.println("testGetFinancialMarket");
    FinancialMarket instance = new FinancialMarket();
    assertTrue(instance.getFinancialMarketData().get("ETFs").isEmpty());
    Market market = new Market("Global Uranium X", ChartType.DAY, "Australia");
    instance.addMarket("ETFs", market);
    ConcurrentHashMap<String, ConcurrentSkipListSet<Market>> result = instance.getFinancialMarketData();
    assertEquals(0, result.get("Stocks").size());
    assertEquals(1, result.get("ETFs").size());
    Market actual = instance.getMarket("ETFs", "Global Uranium X");
    assertNotNull(actual);
    assertTrue(actual.getMarketCode().compareToIgnoreCase("Global Uranium X") == 0);
    assertEquals(ChartType.DAY, actual.getChartType());
    //Test remove Market with wrong market code
    instance.removeMarket("Stocks", "Global Uranium X");
    actual = instance.getMarket("ETFs", "Global Uranium X");
    assertNotNull(actual);
    assertTrue(actual.getMarketCode().compareToIgnoreCase("Global Uranium X") == 0);
    assertEquals(ChartType.DAY, actual.getChartType());
    //Test remove Market with correct market code
    instance.removeMarket("ETFs", "Global Uranium X");
    //assertNull(instance.getMarket("ETFs", "Global Uranium X"));
}
项目:TechnicalAnalysisTool    文件:FinancialMarket.java   
private void initData() {
    ConcurrentSkipListSet<Market> commoditySet = new ConcurrentSkipListSet<>();
    ConcurrentSkipListSet<Market> indicesSet = new ConcurrentSkipListSet<>();
    ConcurrentSkipListSet<Market> forexSet = new ConcurrentSkipListSet<>();
    ConcurrentSkipListSet<Market> stocksSet = new ConcurrentSkipListSet<>();
    ConcurrentSkipListSet<Market> etfsSet = new ConcurrentSkipListSet<>();
    ConcurrentSkipListSet<Market> fundsSet = new ConcurrentSkipListSet<>();
    ConcurrentSkipListSet<Market> bondsSet = new ConcurrentSkipListSet<>();
    financialMarketData.put("Commodities", commoditySet);
    financialMarketData.put("Indices", indicesSet);
    financialMarketData.put("Forex", forexSet);
    financialMarketData.put("Stocks", stocksSet);
    financialMarketData.put("ETFs", etfsSet);
    financialMarketData.put("Funds", fundsSet);
    financialMarketData.put("Bonds", bondsSet);  
}
项目:openjdk-jdk10    文件:ConcurrentSkipListSetTest.java   
/**
 * Add of non-Comparable throws CCE
 */
public void testAddNonComparable() {
    ConcurrentSkipListSet q = new ConcurrentSkipListSet();
    try {
        q.add(new Object());
        q.add(new Object());
        shouldThrow();
    } catch (ClassCastException success) {
        assertTrue(q.size() < 2);
        for (int i = 0, size = q.size(); i < size; i++)
            assertSame(Object.class, q.pollFirst().getClass());
        assertNull(q.pollFirst());
        assertTrue(q.isEmpty());
        assertEquals(0, q.size());
    }
}
项目:openjdk-jdk10    文件:ConcurrentSkipListSetTest.java   
/**
 * remove(x) removes x and returns true if present
 */
public void testRemoveElement() {
    ConcurrentSkipListSet q = populatedSet(SIZE);
    for (int i = 1; i < SIZE; i += 2) {
        assertTrue(q.contains(i));
        assertTrue(q.remove(i));
        assertFalse(q.contains(i));
        assertTrue(q.contains(i - 1));
    }
    for (int i = 0; i < SIZE; i += 2) {
        assertTrue(q.contains(i));
        assertTrue(q.remove(i));
        assertFalse(q.contains(i));
        assertFalse(q.remove(i + 1));
        assertFalse(q.contains(i + 1));
    }
    assertTrue(q.isEmpty());
}
项目:ditb    文件:BlockCacheUtil.java   
/**
 * @param cb
 * @return True if full.... if we won't be adding any more.
 */
public boolean update(final CachedBlock cb) {
  if (isFull()) return true;
  NavigableSet<CachedBlock> set = this.cachedBlockByFile.get(cb.getFilename());
  if (set == null) {
    set = new ConcurrentSkipListSet<CachedBlock>();
    this.cachedBlockByFile.put(cb.getFilename(), set);
  }
  set.add(cb);
  this.size += cb.getSize();
  this.count++;
  BlockType bt = cb.getBlockType();
  if (bt != null && bt.isData()) {
    this.dataBlockCount++;
    this.dataSize += cb.getSize();
  }
  long age = this.now - cb.getCachedTime();
  this.age.update(age);
  return false;
}
项目:FuzzDroid    文件:ConstantContainer.java   
public void insertTmpValue(String className, Object value) {
    ConcurrentSkipListSet<Object> constantSet = null;

    if (tmpSetMap.containsKey(className)) {
        constantSet = tmpSetMap.get(className);
    } else {
        constantSet = new ConcurrentSkipListSet<Object>();
        tmpSetMap.put(className, constantSet);
    }
    constantSet.add(value);
    allValuesSet.add(value);

    isEmpty = false;
}
项目:FuzzDroid    文件:ConstantContainer.java   
public void convertSetsToArrays() {
    for (String clazz : tmpSetMap.keySet()) {
        ConcurrentSkipListSet<Object> constantSet = tmpSetMap.get(clazz);
        Object[] constantObjects = constantSet.toArray(new Object[constantSet.size()]);

        arrayMap.put(clazz, constantObjects);
    }

    allValues = allValuesSet.toArray();
}
项目:TechnicalAnalysisTool    文件:IndexBook.java   
/**
 * Add a list of stock code into a particular index
 * @param listOfStocks 
 */
public void setStocks(String countryName, String marketCode, String indexCode, ConcurrentSkipListSet<String> listOfStocks){
    if (indexBook.get(countryName) == null){
        return;
    }

    if (indexBook.get(countryName).get(marketCode) == null){
        return;
    }

    Index index = this.getIndex(countryName, marketCode, indexCode);
    if (index == null){
        index.getStocks().addAll(listOfStocks);
    }      
}
项目:cas-5.1.0    文件:DefaultServicesManager.java   
@Audit(action = "SAVE_SERVICE",
        actionResolverName = "SAVE_SERVICE_ACTION_RESOLVER",
        resourceResolverName = "SAVE_SERVICE_RESOURCE_RESOLVER")
@Override
public synchronized RegisteredService save(final RegisteredService registeredService) {
    publishEvent(new CasRegisteredServicePreSaveEvent(this, registeredService));
    final RegisteredService r = this.serviceRegistryDao.save(registeredService);
    this.services.put(r.getId(), r);
    this.orderedServices = new ConcurrentSkipListSet<>(this.services.values());
    publishEvent(new CasRegisteredServiceSavedEvent(this, r));
    return r;
}
项目:TechnicalAnalysisTool    文件:Market.java   
/**
 * Set a OHLC to the market
 * @param code - code of the OHLC
 * @param ohlc - data
 */
public void addOHLC(String code, OHLC ohlc) {
    if(data.get(code) == null){
        ConcurrentSkipListSet<OHLC> newOHLC = new ConcurrentSkipListSet<>();
        data.put(code, newOHLC);
    } else {     
       data.get(code).add(ohlc);
    }
}
项目:memory-graph    文件:PropertyCollection.java   
public synchronized Iterable<Property> getProperties(String key, String name) {
    Map<String, ConcurrentSkipListSet<Property>> propertiesByKey = propertiesByNameAndKey.get(name);
    if (propertiesByKey == null) {
        return new ArrayList<>();
    }
    ConcurrentSkipListSet<Property> properties = propertiesByKey.get(key);
    if (properties == null) {
        return new ArrayList<>();
    }
    return properties;
}
项目:memory-graph    文件:PropertyCollection.java   
public synchronized Iterable<Property> getProperties(String name) {
    Map<String, ConcurrentSkipListSet<Property>> propertiesByKey = propertiesByNameAndKey.get(name);
    if (propertiesByKey == null) {
        return new ArrayList<>();
    }
    List<Property> results = new ArrayList<>();
    for (ConcurrentSkipListSet<Property> properties : propertiesByKey.values()) {
        results.addAll(properties);
    }
    return results;
}
项目:TechnicalAnalysisTool    文件:IndexBook.java   
/**
 * The method that is used for helping debugging the code
 * Dump whatever we have got inside this IndexBook object
 */
public void dump(){
    Iterator<String> itr = getIndexBook().keySet().iterator();
    while(itr.hasNext()){

        String countryName = itr.next();
        System.out.println("------------------------------------");
        System.out.println(" Country Code: " + countryName);
        System.out.println("------------------------------------");

        if (getIndexBook().get(countryName) != null){
            ConcurrentHashMap<String, ConcurrentSkipListSet<Index>> markets = getIndexBook().get(countryName);
            Iterator<String> marketItr = markets.keySet().iterator();
            while(marketItr.hasNext()){
                String marketCode = marketItr.next();
                System.out.println("  <<<< Market Code: >>>" + marketCode);          
                ConcurrentSkipListSet<Index> stockSet = getIndexListSet(countryName, marketCode);
                Iterator<Index> iter = stockSet.iterator();
                while(iter.hasNext()){
                    Index index = iter.next();
                    if (index != null) {
                        String indexCode = index.getIndexCode();
                        String description = index.getDescription();
                        System.out.println("   <<<< Index Code:>>>> " + indexCode);
                        System.out.println(" Description: " + description); 
                        if (index.getStocks() != null && index.getStocks().isEmpty() == false){
                            Iterator<String> itrStock = index.getStocks().iterator();
                            while (itrStock.hasNext()){
                                String stockCode = itrStock.next();
                                System.out.println(" Market Code: " + stockCode); 
                            }
                        }
                    }
                }
            }
        }
    }
}
项目:dble    文件:UserSqlLargeStat.java   
public void recycle() {
    if (queries.size() > count) {
        SortedSet<SqlLarge> queries2 = new ConcurrentSkipListSet<>();
        List<SqlLarge> keyList = new ArrayList<>(queries);
        int i = 0;
        for (SqlLarge key : keyList) {
            if (i == count) {
                break;
            }
            queries2.add(key);
            i++;
        }
        queries = queries2;
    }
}
项目:TechnicalAnalysisTool    文件:Market.java   
/**
 * @param data to be assigned to the current market object
 */
public void setData(ConcurrentHashMap<String, ConcurrentSkipListSet<OHLC>> data) {
    if (this.data != null) {
        this.data.clear();
        this.data = null;
    }
    this.data = new ConcurrentHashMap<>(data);
}
项目:memory-graph    文件:PropertyCollection.java   
public synchronized void removeProperty(Property property) {
    Map<String, ConcurrentSkipListSet<Property>> propertiesByKey = propertiesByNameAndKey.get(property.getName());
    if (propertiesByKey == null) {
        return;
    }
    ConcurrentSkipListSet<Property> properties = propertiesByKey.get(property.getKey());
    if (properties == null) {
        return;
    }
    properties.remove(property);
    this.propertiesList.remove(property);
}
项目:configx    文件:VersionBasedScopeCache.java   
/**
 * 添加需要刷新的beans
 *
 * @param version
 * @param beanNames
 */
public void addRefreshBeanNames(long version, Collection<String> beanNames) {
    Set<String> set = versionRefreshBeanNames.get(version);
    if (set == null) {
        set = new ConcurrentSkipListSet<>();
        Set<String> oldSet = versionRefreshBeanNames.putIfAbsent(version, set);
        if (oldSet != null) {
            set = oldSet;
        }
    }
    set.addAll(beanNames);
}
项目:incubator-servicecomb-saga    文件:SagaContextImpl.java   
public SagaContextImpl(FromJsonFormat<Set<String>> childrenExtractor) {
  this.childrenExtractor = childrenExtractor;
  this.completedTransactions = new ConcurrentHashMap<>();
  this.completedCompensations = new HashMap<>();
  this.abortedTransactions = new ConcurrentSkipListSet<>();
  this.hangingTransactions = new ConcurrentHashMap<>();
}
项目:nitrite-database    文件:IndexedSearchService.java   
Set<NitriteId> findGreaterThan(String field, Comparable comparable) {
    Set<NitriteId> resultSet = new LinkedHashSet<>();
    NitriteMap<Comparable, ConcurrentSkipListSet<NitriteId>> indexMap
            = indexMetaService.getIndexMap(field);

    if (indexMap != null) {
        Comparable higherKey = indexMap.higherKey(comparable);
        while (higherKey != null) {
            resultSet.addAll(indexMap.get(higherKey));
            higherKey = indexMap.higherKey(higherKey);
        }
    }

    return resultSet;
}
项目:nitrite-database    文件:IndexedSearchService.java   
Set<NitriteId> findGreaterEqual(String field, Comparable comparable) {
    Set<NitriteId> resultSet = new LinkedHashSet<>();
    NitriteMap<Comparable, ConcurrentSkipListSet<NitriteId>> indexMap
            = indexMetaService.getIndexMap(field);

    if (indexMap != null) {
        Comparable ceilingKey = indexMap.ceilingKey(comparable);
        while (ceilingKey != null) {
            resultSet.addAll(indexMap.get(ceilingKey));
            ceilingKey = indexMap.higherKey(ceilingKey);
        }
    }

    return resultSet;
}
项目:nitrite-database    文件:IndexedSearchService.java   
Set<NitriteId> findLesserThan(String field, Comparable comparable) {
    Set<NitriteId> resultSet = new LinkedHashSet<>();
    NitriteMap<Comparable, ConcurrentSkipListSet<NitriteId>> indexMap
            = indexMetaService.getIndexMap(field);

    if (indexMap != null) {
        Comparable lowerKey = indexMap.lowerKey(comparable);
        while (lowerKey != null) {
            resultSet.addAll(indexMap.get(lowerKey));
            lowerKey = indexMap.lowerKey(lowerKey);
        }
    }

    return resultSet;
}
项目:nitrite-database    文件:IndexedSearchService.java   
Set<NitriteId> findIn(String field, List<Object> values) {
    Set<NitriteId> resultSet = new LinkedHashSet<>();
    NitriteMap<Comparable, ConcurrentSkipListSet<NitriteId>> indexMap
            = indexMetaService.getIndexMap(field);

    if (indexMap != null) {
        for (Comparable comparable : indexMap.keySet()) {
            if (values.contains(comparable)) {
                resultSet.addAll(indexMap.get(comparable));
            }
        }
    }

    return resultSet;
}
项目:nitrite-database    文件:NitriteTextIndexingService.java   
private Set<NitriteId> searchContains(String field, String term) {
    NitriteMap<Comparable, ConcurrentSkipListSet<NitriteId>> indexMap
            = indexMetaService.getIndexMap(field);
    Set<NitriteId> idSet = new LinkedHashSet<>();

    for (Map.Entry<Comparable, ConcurrentSkipListSet<NitriteId>> entry : indexMap.entrySet()) {
        String key = (String) entry.getKey();
        if (key.contains(term.toLowerCase())) {
            idSet.addAll(entry.getValue());
        }
    }
    return idSet;
}
项目:dble    文件:SQLRecorder.java   
public void recycle() {
    if (records.size() > count) {
        SortedSet<SQLRecord> records2 = new ConcurrentSkipListSet<>();
        List<SQLRecord> keyList = new ArrayList<>(records);
        int i = 0;
        for (SQLRecord key : keyList) {
            if (i == count) {
                break;
            }
            records2.add(key);
            i++;
        }
        records = records2;
    }
}
项目:nitrite-database    文件:IndexMetaService.java   
NitriteMap<Comparable, ConcurrentSkipListSet<NitriteId>> getIndexMap(String field) {
    IndexMeta meta = getIndexMetadata().get(field);
    if (meta != null && meta.index != null) {
        return mvStore.openMap(meta.indexMap);
    }
    return null;
}
项目:TechnicalAnalysisTool    文件:TatMain.java   
/**
 * Open up DataUpdateDialog and get final selected ConcurrentSkipListSet<OHLC>
 * @return ConcurrentSkipListSet<OHLC> that is selected by user
 */
public ConcurrentSkipListSet<OHLC> selectOHLC() {
    DataUpdateDialog dlg = new DataUpdateDialog(this, primaryStage, fm, config, false);
    dlg.sizeToScene();
    dlg.showAndWait();
    ConcurrentSkipListSet<OHLC> result = dlg.selectedOHLC;
    return result;
}
项目:mycat-src-1.6.1-RELEASE    文件:ByteBufferChunkList.java   
public ByteBufferChunkList(int minUsage, int maxUsage, int chunkSize, int pageSize, int numOfChunks) {
    this.minUsage = minUsage;
    this.maxUsage = maxUsage;
    byteBufferChunks = new ConcurrentSkipListSet<>();
    for (int i = 0; i < numOfChunks; i++) {
        ByteBufferChunk chunk = new ByteBufferChunk(pageSize, chunkSize);
        byteBufferChunks.add(chunk);
    }
}
项目:TechnicalAnalysisTool    文件:Market.java   
/**
 * Get the OHLC data start date in the Calendar representation
 * @param code - the code to be checked
 * @return start date in Calendar
 */
public Calendar getMarketDataStartCalendar(String code) {
    if (data != null && data.keySet().size() > 0) {
        ConcurrentSkipListSet<OHLC> result = data.get(code);
        if (result != null) {
            return result.first().getDate();
        }
    }else {
        return null;
    }
    return null;
}
项目:TechnicalAnalysisTool    文件:FinancialMarket.java   
/**
 * Remove this market data from financial market with specified market code
 * This can be used when reload data
 * @param category the market data search category
 * @param marketCode the market code that is going to be removed
 */
public void removeMarket(String category, String marketCode) {
    if (financialMarketData.get(category) != null) {
        ConcurrentSkipListSet<Market> markets = financialMarketData.get(category);
        Iterator<Market> iterator = markets.iterator();
        while(iterator.hasNext()) {
            Market market = iterator.next();
            if (market.getMarketCode().compareToIgnoreCase(marketCode)==0) {
                markets.remove(market);
            }
        }
    }
}