• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java CircularFifoBuffer类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.apache.commons.collections15.buffer.CircularFifoBuffer的典型用法代码示例。如果您正苦于以下问题:Java CircularFifoBuffer类的具体用法?Java CircularFifoBuffer怎么用?Java CircularFifoBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

CircularFifoBuffer类属于org.apache.commons.collections15.buffer包,在下文中一共展示了CircularFifoBuffer类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: UnemploymentBasedWageAskAlgorithm

点赞 3

import org.apache.commons.collections15.buffer.CircularFifoBuffer; //导入依赖的package包/类
public UnemploymentBasedWageAskAlgorithm(
    double initialLabourWage,
    double wageAdaptationRate,
    double minimumWage,
    EmploymentProportionCallback employmentProportionCallback
    ) {
    super(initGuard(initialLabourWage));
    if(employmentProportionCallback == null)
        throw new NullArgumentException();
    this.wagePerturbation = wageAdaptationRate * initialLabourWage;
    this.dice = new Random(
        Simulation.getSimState().random.nextLong());
    this.employmentPropCallback = employmentProportionCallback;
    this.wageConfidence = new CircularFifoBuffer<Double>(5);
    this.minimumWage = minimumWage;
    wageConfidence.add(0.0);
}
 

开发者ID:crisis-economics,
项目名称:CRISIS,
代码行数:18,
代码来源:UnemploymentBasedWageAskAlgorithm.java

示例2: GenericTALibAggregatorFunction

点赞 3

import org.apache.commons.collections15.buffer.CircularFifoBuffer; //导入依赖的package包/类
public GenericTALibAggregatorFunction(Method function, int inputParamCount, int lookbackPeriod, List<Object> optInputParams,
		Map<String, Object> outputParams, Class<?> outputClass) {

	super();

	this.function = function;
	this.outputClass = outputClass;

	this.optInputParams = optInputParams;
	this.outputParams = outputParams;

	this.inputParams = new ArrayList<CircularFifoBuffer<Number>>();

	for (int i = 0; i < inputParamCount; i++) {
		this.inputParams.add(new CircularFifoBuffer<Number>(lookbackPeriod));
	}
}
 

开发者ID:curtiszimmerman,
项目名称:AlgoTrader,
代码行数:18,
代码来源:GenericTALibAggregatorFunction.java

示例3: enableHistoryTracking

点赞 2

import org.apache.commons.collections15.buffer.CircularFifoBuffer; //导入依赖的package包/类
public void enableHistoryTracking() {
    if (this.history == null) {
        synchronized (this) {
            if (this.history == null) {
                this.history = new CircularFifoBuffer<Long>(10000);
            }
        } // SYNCH
        if (debug.val)
            LOG.debug("Enabled history tracking in " + this);
    }
}
 

开发者ID:s-store,
项目名称:sstore-soft,
代码行数:12,
代码来源:ProfileMeasurement.java

示例4: MedianOverHistoryStockReturnExpectationFunction

点赞 2

import org.apache.commons.collections15.buffer.CircularFifoBuffer; //导入依赖的package包/类
/**
  * Create a {@link MedianOverHistoryStockReturnExpectationFunction}
  * object with a custom memory length (as specified by the argument).
  * 
  * @param The {@link StockReturnExpectationFunction} to which to 
  *        apply the moving median.
  * @param sizeOfMemory
  *        The length of the circular buffer over which to compute
  *        moving median returns. This argument should be strictly
  *        positive.
  */
@Inject
public MedianOverHistoryStockReturnExpectationFunction(
@Named("MEDIAN_OVER_HISTORY_PRIMITIVE_STOCK_RETURN_EXPECTATION_FUNCTION")
   StockReturnExpectationFunction expectationFunction,
@Named("MEDIAN_OVER_HISTORY_STOCK_RETURN_EXPECTATION_FUNCTION_MEMORY_LENGTH")
   final int sizeOfMemory
   ) {
   Preconditions.checkNotNull(expectationFunction);
   Preconditions.checkArgument(sizeOfMemory > 0);
   this.expectationFunction = expectationFunction;
   this.memory = new HashMap<String, CircularFifoBuffer<Double>>();
   this.sizeOfMemory = sizeOfMemory;
}
 

开发者ID:crisis-economics,
项目名称:CRISIS,
代码行数:25,
代码来源:MedianOverHistoryStockReturnExpectationFunction.java

示例5: computeExpectedReturn

点赞 2

import org.apache.commons.collections15.buffer.CircularFifoBuffer; //导入依赖的package包/类
@Override
public double computeExpectedReturn(final String stockName) {
   if(!memory.containsKey(stockName))
      memory.put(
         stockName,
         new CircularFifoBuffer<Double>(sizeOfMemory)
         );
   final double
      returnEstimate = expectationFunction.computeExpectedReturn(stockName);
   memory.get(stockName).add(returnEstimate);
   return medianOfSeries(
      ArrayUtils.asDouble(memory.get(stockName).toArray(new Double[0]))
      );
}
 

开发者ID:crisis-economics,
项目名称:CRISIS,
代码行数:15,
代码来源:MedianOverHistoryStockReturnExpectationFunction.java

示例6: GenericTALibFunction

点赞 2

import org.apache.commons.collections15.buffer.CircularFifoBuffer; //导入依赖的package包/类
public GenericTALibFunction() {

		super();
		this.inputParamCount = 0;
		this.inputParams = new ArrayList<CircularFifoBuffer<Number>>();
		this.optInputParams = new ArrayList<Object>();
		this.outputParams = new HashMap<String, Object>();
	}
 

开发者ID:curtiszimmerman,
项目名称:AlgoTrader,
代码行数:9,
代码来源:GenericTALibFunction.java

示例7: enter

点赞 2

import org.apache.commons.collections15.buffer.CircularFifoBuffer; //导入依赖的package包/类
@Override
public void enter(Object obj) {

	Object[] params = (Object[]) obj;

	// add all inputs to the correct buffers
	int paramCount = 1;
	for (CircularFifoBuffer<Number> buffer : this.inputParams) {
		Number value = (Number) params[paramCount];
		buffer.add(value);
		paramCount++;
	}
}
 

开发者ID:curtiszimmerman,
项目名称:AlgoTrader,
代码行数:14,
代码来源:GenericTALibFunction.java

示例8: leave

点赞 2

import org.apache.commons.collections15.buffer.CircularFifoBuffer; //导入依赖的package包/类
@Override
public void leave(Object obj) {

	// Remove the last element of each buffer
	for (CircularFifoBuffer<Number> buffer : this.inputParams) {
		if (buffer.contains(obj)) {
			buffer.remove(obj);
		}
	}
}
 

开发者ID:curtiszimmerman,
项目名称:AlgoTrader,
代码行数:11,
代码来源:GenericTALibFunction.java

示例9: clear

点赞 2

import org.apache.commons.collections15.buffer.CircularFifoBuffer; //导入依赖的package包/类
@Override
public void clear() {

	// clear all elements from the buffers
	for (CircularFifoBuffer<Number> buffer : this.inputParams) {
		buffer.clear();
	}
}
 

开发者ID:curtiszimmerman,
项目名称:AlgoTrader,
代码行数:9,
代码来源:GenericTALibFunction.java

示例10: ProfiSounderLogAppender

点赞 2

import org.apache.commons.collections15.buffer.CircularFifoBuffer; //导入依赖的package包/类
public ProfiSounderLogAppender(int logBufferSize) {
	if (logBufferSize < 1 || logBufferSize > MAX_BUFFERSIZE)
		throw new IllegalArgumentException("logBufferSize must be between 1 and " + MAX_BUFFERSIZE + "!");

	PersistentNotifications.setConsumer(this);
	logBuffer = new CircularFifoBuffer<>(logBufferSize);
}
 

开发者ID:MajorTom4711,
项目名称:ProfiSounder,
代码行数:8,
代码来源:ProfiSounderLogAppender.java

示例11: EmpiricalDistribution

点赞 2

import org.apache.commons.collections15.buffer.CircularFifoBuffer; //导入依赖的package包/类
public EmpiricalDistribution(int memoryLength) {
    m_dataStream = new CircularFifoBuffer<Double>(memoryLength);
    m_sortedData = new TreeSet<EmpiricalDistribution.SortedDatum>();
    lastValueInserted = Double.NaN;
}
 

开发者ID:crisis-economics,
项目名称:CRISIS,
代码行数:6,
代码来源:EmpiricalDistribution.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)