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


Java CircularFifoBuffer类代码示例

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


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

示例1: shouldBombWithErrorWhenStatusCodeReturnedIsRequestEntityTooLarge

import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
@Test
public void shouldBombWithErrorWhenStatusCodeReturnedIsRequestEntityTooLarge() throws IOException, InterruptedException {
    long size = anyLong();
    when(httpService.upload(any(String.class), size, any(File.class), any(Properties.class))).thenReturn(HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE);

    CircularFifoBuffer buffer = (CircularFifoBuffer) ReflectionUtil.getField(ReflectionUtil.getField(goPublisher, "consoleOutputTransmitter"), "buffer");
    synchronized (buffer) {
        try {
            goArtifactsManipulatorStub.publish(goPublisher, "some_dest", tempFile, jobIdentifier);
            fail("should have thrown request entity too large error");
        } catch (RuntimeException e) {
            String expectedMessage = "Artifact upload for file " + tempFile.getAbsolutePath() + " (Size: "+size+") was denied by the server. This usually happens when server runs out of disk space.";
            assertThat(e.getMessage(), is("java.lang.RuntimeException: " + expectedMessage + ".  HTTP return code is 413"));
            assertThat(buffer.toString().contains(expectedMessage), is(true));
        }
    }
}
 
开发者ID:gocd,项目名称:gocd,代码行数:18,代码来源:GoArtifactsManipulatorTest.java

示例2: Statistics

import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
public Statistics ( final DataItemFactory itemFactory, final int size )
{
    this.stateItem = itemFactory.createInput ( "state", null );
    this.timeoutStateItem = itemFactory.createInput ( "timeout", null );
    this.lastUpdateItem = itemFactory.createInput ( "lastUpdate", null );
    this.lastTimeDiffItem = itemFactory.createInput ( "lastDiff", null );
    this.avgDiffItem = itemFactory.createInput ( "avgDiff", null );
    this.checksumErrorsItem = itemFactory.createInput ( "checksumErrors", null );

    this.sizeItem = itemFactory.createInput ( "size", null );
    this.sizeItem.updateData ( Variant.valueOf ( size ), null, null );

    this.lastUpdate = System.currentTimeMillis ();
    this.diffBuffer = new CircularFifoBuffer ( 20 );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:16,代码来源:AbstractRequestBlock.java

示例3: AsyncPollingHelper

import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
/***********************************************************************************************
 * @param driver Handle to the driver class that will do the polling
 ***********************************************************************************************/
public AsyncPollingHelper(Driver driver) {
	this.driver = driver;
	
	//Default the max buffer size to 10 seconds worth of imu data
	int maxSize = Math.round(driver.getDatarate().getHz() * 10);
	fifo = BufferUtils.synchronizedBuffer(new CircularFifoBuffer(maxSize));
}
 
开发者ID:soblenes32,项目名称:LSM9DS1-Pi4j-Driver,代码行数:11,代码来源:AsyncPollingHelper.java

示例4: NthLastModifiedTimeTracker

import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
public NthLastModifiedTimeTracker(int numTimesToTrack) {
  if (numTimesToTrack < 1) {
    throw new IllegalArgumentException(
        "numTimesToTrack must be greater than zero (you requested " + numTimesToTrack + ")");
  }
  lastModifiedTimesMillis = new CircularFifoBuffer(numTimesToTrack);
  initLastModifiedTimesMillis();
}
 
开发者ID:Paleozoic,项目名称:storm_spring_boot_demo,代码行数:9,代码来源:NthLastModifiedTimeTracker.java

示例5: getInstance

import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
public static PlotSource getInstance()
{
    if(instance == null)
    {
        instance = new PlotSource();
        buffer = new CircularFifoBuffer(BUFFER_SIZE);
    }

    return instance;
}
 
开发者ID:CentriaUniversityOfAppliedSciences,项目名称:Android_RuuvitagScannner,代码行数:11,代码来源:PlotSource.java

示例6: convert2String

import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
/**
 * TODO: Javadoc missing
 *
 * @param bBuf
 * @return
 */
private String convert2String(CircularFifoBuffer bBuf) {
    byte[] tmp = new byte[bBuf.size()];
    int tmpCnt = 0;
    for (Object aBBuf : bBuf) {
        tmp[tmpCnt++] = (Byte) aBBuf;
    }
    return new String(tmp);
}
 
开发者ID:PRIDE-Utilities,项目名称:jmzml,代码行数:15,代码来源:MzMLUnmarshaller.java

示例7: eval

import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
@Override
public void eval(FunctionContext ctx, Tuple params) {
  LagContext lagCtx = (LagContext)ctx;
  if(lagCtx.lagBuffer == null) {
    int lagNum = 0;
    if (params.size() == 1) {
      lagNum = 1;
    } else {
      lagNum = params.getInt4(1);
    }
    lagCtx.lagBuffer = new CircularFifoBuffer(lagNum+1);
  }

  if (!params.isBlankOrNull(0)) {
    lagCtx.lagBuffer.add(params.asDatum(0));
  } else {
    lagCtx.lagBuffer.add(NullDatum.get());
  }

  if (lagCtx.defaultDatum == null) {
   if (params.size() == 3) {
     lagCtx.defaultDatum = params.asDatum(2);
   } else {
     lagCtx.defaultDatum = NullDatum.get();
   }
  }
}
 
开发者ID:apache,项目名称:tajo,代码行数:28,代码来源:Lag.java

示例8: eegPort

import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
public eegPort(PApplet applet, Serial serial) {
  app = applet;
  serialPort = serial;
  
  rawDataBuffer = new CircularFifoBuffer(4096);
  vectorBuffer = new CircularFifoBuffer(4096);
  attentionBuffer = new CircularFifoBuffer(3600);
  meditationBuffer = new CircularFifoBuffer(3600);
}
 
开发者ID:josemlp91,项目名称:NeuroWaveWar,代码行数:10,代码来源:eegPort.java

示例9: VQVADTrainer

import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
/**
 * See the class documentation for a full explanation of the parameters.
 *
 * @param trainingBufferSize
 * @param energyMinLevel
 * @param energyFraction
 * @param vqSize
 * @param maxKMeansIter
 */
public VQVADTrainer(int trainingBufferSize, int minFrameCount, double energyMinLevel, double energyFraction, int vqSize, int maxKMeansIter) {
	this.minFrameCount = minFrameCount;
	this.energyMinLevel = energyMinLevel;
	this.energyFraction = energyFraction;
	this.vqSize = vqSize;

	trainingFrameBuffer = new CircularFifoBuffer(trainingBufferSize);
	clusterer = new KMeansPlusPlusClusterer<DoublePoint>(vqSize, maxKMeansIter);
}
 
开发者ID:knowledgetechnologyuhh,项目名称:docks,代码行数:19,代码来源:VQVADTrainer.java

示例10: SlidingWindowState

import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
public SlidingWindowState(long windowSize, long slideInterval, long timeUnitInMillis) {
	this.currentRecordCount = 0;
	// here we assume that windowSize and slidingStep is divisible by
	// computationGranularity.
	this.fullRecordCount = (int) (windowSize / timeUnitInMillis);
	this.slideRecordCount = (int) (slideInterval / timeUnitInMillis);
	this.buffer = new CircularFifoBuffer(fullRecordCount);
	this.iterator = new SlidingWindowStateIterator<T>(buffer);
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:10,代码来源:SlidingWindowState.java

示例11: NthLastModifiedTimeTracker

import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
public NthLastModifiedTimeTracker(int numTimesToTrack) {
    if (numTimesToTrack < 1) {
        throw new IllegalArgumentException("numTimesToTrack must be greater than zero (you requested "
            + numTimesToTrack + ")");
    }
    lastModifiedTimesMillis = new CircularFifoBuffer(numTimesToTrack);
    initLastModifiedTimesMillis();
}
 
开发者ID:adarshms,项目名称:sentweet,代码行数:9,代码来源:NthLastModifiedTimeTracker.java

示例12: NthLastModifiedTimeTracker

import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
public NthLastModifiedTimeTracker(int numTimesToTrack) {
	if (numTimesToTrack < 1) {
		throw new IllegalArgumentException(
				"numTimesToTrack must be greater than zero (you requested "
						+ numTimesToTrack + ")");
	}
	lastModifiedTimesMillis = new CircularFifoBuffer(numTimesToTrack);
	initLastModifiedTimesMillis();
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:10,代码来源:NthLastModifiedTimeTracker.java

示例13: NthLastModifiedTimeTracker

import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
public NthLastModifiedTimeTracker(int numTimesToTrack) {
    if (numTimesToTrack < 1) {
        throw new IllegalArgumentException(
                "numTimesToTrack must be greater than zero (you requested " + numTimesToTrack + ")");
    }
    lastModifiedTimesMillis = new CircularFifoBuffer(numTimesToTrack);
    initLastModifiedTimesMillis();
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:9,代码来源:NthLastModifiedTimeTracker.java

示例14: setBufferSize

import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
/************************************************************************************************
 * @param size sets the maximum size of the circular fifo buffer
 ************************************************************************************************/
public void setBufferSize(int size){
	fifo = (CircularFifoBuffer) BufferUtils.synchronizedBuffer(new CircularFifoBuffer(size));
}
 
开发者ID:soblenes32,项目名称:LSM9DS1-Pi4j-Driver,代码行数:7,代码来源:AsyncPollingHelper.java

示例15: RollingLogOutputStream

import org.apache.commons.collections.buffer.CircularFifoBuffer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
RollingLogOutputStream(int maxLines) {
	ringBuffer = new CircularFifoBuffer(maxLines);
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:5,代码来源:RollingLogOutputStream.java


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