当前位置: 首页>>代码示例>>Java>>正文


Java ConcurrentSkipListSet.toArray方法代码示例

本文整理汇总了Java中java.util.concurrent.ConcurrentSkipListSet.toArray方法的典型用法代码示例。如果您正苦于以下问题:Java ConcurrentSkipListSet.toArray方法的具体用法?Java ConcurrentSkipListSet.toArray怎么用?Java ConcurrentSkipListSet.toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.concurrent.ConcurrentSkipListSet的用法示例。


在下文中一共展示了ConcurrentSkipListSet.toArray方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertSetsToArrays

import java.util.concurrent.ConcurrentSkipListSet; //导入方法依赖的package包/类
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();
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:11,代码来源:ConstantContainer.java

示例2: testToArray

import java.util.concurrent.ConcurrentSkipListSet; //导入方法依赖的package包/类
/**
 * toArray contains all elements in sorted order
 */
public void testToArray() {
    ConcurrentSkipListSet q = populatedSet(SIZE);
    Object[] o = q.toArray();
    for (int i = 0; i < o.length; i++)
        assertSame(o[i], q.pollFirst());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:ConcurrentSkipListSetTest.java

示例3: doCalculation

import java.util.concurrent.ConcurrentSkipListSet; //导入方法依赖的package包/类
/**
 * Do OBV Calculation when input is a ConcurrentSkipListSet
 * @param orgData 
 */
public void doCalculation(ConcurrentSkipListSet<OHLC> orgData){
    //Convert set to array
    Object[] rawData;
    rawData = (Object[])orgData.toArray();
    calculateObv(rawData);   
}
 
开发者ID:ztan5,项目名称:TechnicalAnalysisTool,代码行数:11,代码来源:OnBalanceVolume.java

示例4: doCalculation

import java.util.concurrent.ConcurrentSkipListSet; //导入方法依赖的package包/类
/**
 * Most important method to calculate moving average data and store it in 
 * smaData set
 * @param orgData original data used to calculate smaData
 */
public void doCalculation(ConcurrentSkipListSet<OHLC> orgData){
    //Everytime is a new calculation
    smaPrice.clear();
    smaVolume.clear();
    
    int avgOn = avgOnProperty.getValue();
    CalculationBase calBase = calBaseProperty.getValue();
    //If source data is empty or less or equals to avgOn do nothing
    if (orgData.isEmpty() || orgData.size() < avgOn){
        return;
    }
    
    //Convert set to array
    Object[] rawData;
    rawData = (Object[])orgData.toArray();

    //Start calculation
    for (int i = 0; i<=rawData.length - avgOn; i++){
        float totalPrice = 0f;
        double totalVolume = 0l;
        OHLC ohlc = null;
        
        for(int j = i; j < i + avgOn; j++){                    
            ohlc = (OHLC)rawData[j];
            switch(calBase){
                case OPEN:
                    totalPrice += ohlc.getOpen();
                    break;
                case HIGH:
                    totalPrice += ohlc.getHigh();
                    break;
                case LOW:
                    totalPrice += ohlc.getLow();
                    break;
                case CLOSE:
                    totalPrice += ohlc.getClose();
                    break;
                case MIDDIUM:
                    totalPrice += ((float)(ohlc.getHigh() + ohlc.getLow()) /(float)2);
                    break;
                case TYPICAL:
                    totalPrice += (((float)(ohlc.getHigh() + ohlc.getLow() + ohlc.getClose()))/ (float)3);
                    break;
                case WEIGHTED:
                    totalPrice += (((float)(ohlc.getHigh() + ohlc.getLow() + ohlc.getClose() + ohlc.getClose()))/ (float)4);
                    break;
                case VOLUME:
                    totalVolume += ohlc.getVolume();
                    break;
            }
        }
        
        float avgPrice = totalPrice / avgOn;
        double avgVolume = totalVolume / avgOn;
        if (ohlc != null){
            if (calBase == CalculationBase.VOLUME){
                //Volume is using Million as the units
                //And it is keep 4 digits floating point
                avgVolume/=1000000;
                avgVolume *= 10000;
                avgVolume = (float)Math.round(avgVolume);
                avgVolume /= 10000;
                smaVolume.put(ohlc.getDate(), avgVolume);  
            } else {
                //round to 4 digits floating points
                avgPrice *= 10000;
                avgPrice = Math.round(avgPrice);
                avgPrice /= 10000;
                smaPrice.put(ohlc.getDate(), avgPrice);
            }
        }
    }
}
 
开发者ID:ztan5,项目名称:TechnicalAnalysisTool,代码行数:79,代码来源:SimpleMovingAverage.java


注:本文中的java.util.concurrent.ConcurrentSkipListSet.toArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。