本文整理汇总了Java中org.apache.commons.collections4.queue.CircularFifoQueue类的典型用法代码示例。如果您正苦于以下问题:Java CircularFifoQueue类的具体用法?Java CircularFifoQueue怎么用?Java CircularFifoQueue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CircularFifoQueue类属于org.apache.commons.collections4.queue包,在下文中一共展示了CircularFifoQueue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BittrexPriceVerticle
import org.apache.commons.collections4.queue.CircularFifoQueue; //导入依赖的package包/类
public BittrexPriceVerticle(OrderFillService service){
super();
service = service;
indicators = new IndicatorDTO();
cachedTicks = new CircularFifoQueue<MarketTick>(20);
SimpleMovingAverage ma_1 = new SimpleMovingAverage(20, "ma_1");
BollingerBands bb_1 = new BollingerBands(ma_1, 2);
VolumeWeightedMovingAverage vwma_1 = new VolumeWeightedMovingAverage(20, "vwma_1");
RSI rsi_1 = new RSI(14, "rsi_1");
currentTick = new MarketTick();
indicators.setBb(bb_1);
indicators.setRsi(rsi_1);
indicators.setSma(ma_1);
indicators.setVwma(vwma_1);
timerInterval = 5*60*1000;
}
示例2: incrementQueue
import org.apache.commons.collections4.queue.CircularFifoQueue; //导入依赖的package包/类
public void incrementQueue(CircularFifoQueue<MinuteInfo> queue) {
ZonedDateTime now = MinuteInfo.getCurrentMinute();
MinuteInfo minuteInfo = null;
if (!queue.isEmpty()) {
minuteInfo = queue.get(queue.size()-1);
//minuteInfo = queue.get(0);
//Log.info("first: {0}", queue.get(0).getMinute());
//Log.info("last: {0}", queue.get(queue.size() -1).getMinute());
//Log.info("now: {0}", now);
if (!minuteInfo.getMinute().equals(now)) {
//Log.info("Minutes do not matched, prepare for new minute");
minuteInfo = null;
}
}
if (minuteInfo == null) {
minuteInfo = new MinuteInfo();
minuteInfo.setMinute(now);
queue.add(minuteInfo);
}
//Log.info("Increment minute {0} {1}", minuteInfo.getMinute().toString(), minuteInfo.getCount().get());
minuteInfo.getCount().incrementAndGet();
}
示例3: measure
import org.apache.commons.collections4.queue.CircularFifoQueue; //导入依赖的package包/类
@Override
public List<Measurement> measure() {
return eventQueues.entrySet().stream()
.map((Map.Entry<String, CircularFifoQueue<Event>> e) -> {
List<Event> events = e.getValue().stream().collect(toList());
int all = events.size();
long success = events.stream().filter(a -> a == Event.SUCCESS).count();
long failure = events.stream().filter(a -> a == Event.FAILURE).count();
double percentFailureDouble = all > 0 ? (double) failure / (double) all : 0;
boolean enoughDataToAlert = all == numberToKeep;
String display = String.format("Last %s calls: %s success, %s failure (%.2f%% failure)%s",
Integer.min(all, numberToKeep),
success,
all-success,
percentFailureDouble * 100,
enoughDataToAlert ? "" : " - not enough calls to report status yet"
);
return new Measurement(e.getKey(), getStatusFromPercentage(enoughDataToAlert, percentFailureDouble), display, new Measurement.CloudwatchValue(percentFailureDouble * 100, StandardUnit.Percent));
})
.collect(toList());
}
示例4: getLastReceivedMessageFromLog
import org.apache.commons.collections4.queue.CircularFifoQueue; //导入依赖的package包/类
public Message getLastReceivedMessageFromLog(CircularFifoQueue<Message> received, boolean ignoreSystemMessages, Class type) {
if (received.size() == 0) {
return null;
}
for (int i = received.size() - 1; i >= 0; i--) {
Message message = received.get(i);
if (type != null) {
if (!type.isAssignableFrom(message.getClass())) {
continue;
}
} else if (ignoreSystemMessages) {
if (message instanceof SequenceKeepAlive) continue;
if (message instanceof AckMessage) continue;
if (message instanceof ConnectResponse) continue;
if (message instanceof RequestSeqIdsMessage) continue;
if (message instanceof StackedMessage) continue;
}
return message;
}
// If all are system messages, return the last
return received.get(received.size() - 1);
}
示例5: getLastReceivedMessagesFromLog
import org.apache.commons.collections4.queue.CircularFifoQueue; //导入依赖的package包/类
public List<Message> getLastReceivedMessagesFromLog(Class type) {
List<Message> messages = new ArrayList<>();
CircularFifoQueue<Message> received = server.getState().getProcessorOf(MessageLogProcessor.class).getMessageLog().getReceived();
if (received.size() == 0) {
return null;
}
for (int i = received.size() - 1; i >= 0; i--) {
Message message = received.get(i);
if (type != null) {
if (type.isAssignableFrom(message.getClass())) {
messages.add(message);
}
}
}
return messages;
}
示例6: initView
import org.apache.commons.collections4.queue.CircularFifoQueue; //导入依赖的package包/类
private void initView(Context context, AttributeSet attrs) {
this.mContext = context;
if (attrs != null) {
TypedArray a = context.getTheme().obtainStyledAttributes(
attrs,
R.styleable.LifeCycleView,
0, 0);
try {
mMaxEvents = a.getInt(R.styleable.BeaconView_maxEvents, mMaxEvents);
} finally {
a.recycle();
}
}
this.lastEvents = new CircularFifoQueue<>();
mUiHandler = new Handler(Looper.getMainLooper());
}
示例7: isFull_add2266
import org.apache.commons.collections4.queue.CircularFifoQueue; //导入依赖的package包/类
@Test(timeout = 1000)
public void isFull_add2266() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "isFull_add2266");
final Set<java.lang.String> set = new HashSet<java.lang.String>();
set.add("1");
set.add("1");
set.add("2");
set.add("3");
try {
org.apache.commons.collections4.CollectionUtils.isFull(null);
} catch (final NullPointerException ex) {
}
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6924,null,6923,org.apache.commons.collections4.CollectionUtils.isFull(set));
final CircularFifoQueue<java.lang.String> buf = new CircularFifoQueue<java.lang.String>(set);
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6926,null,6925,org.apache.commons.collections4.CollectionUtils.isFull(buf));
buf.remove("2");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6928,null,6927,org.apache.commons.collections4.CollectionUtils.isFull(buf));
buf.add("2");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6930,null,6929,org.apache.commons.collections4.CollectionUtils.isFull(buf));
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
示例8: isFull_add2267
import org.apache.commons.collections4.queue.CircularFifoQueue; //导入依赖的package包/类
@Test(timeout = 1000)
public void isFull_add2267() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "isFull_add2267");
final Set<java.lang.String> set = new HashSet<java.lang.String>();
set.add("1");
set.add("2");
set.add("2");
set.add("3");
try {
org.apache.commons.collections4.CollectionUtils.isFull(null);
} catch (final NullPointerException ex) {
}
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6924,null,6923,org.apache.commons.collections4.CollectionUtils.isFull(set));
final CircularFifoQueue<java.lang.String> buf = new CircularFifoQueue<java.lang.String>(set);
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6926,null,6925,org.apache.commons.collections4.CollectionUtils.isFull(buf));
buf.remove("2");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6928,null,6927,org.apache.commons.collections4.CollectionUtils.isFull(buf));
buf.add("2");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6930,null,6929,org.apache.commons.collections4.CollectionUtils.isFull(buf));
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
示例9: isFull_add2268
import org.apache.commons.collections4.queue.CircularFifoQueue; //导入依赖的package包/类
@Test(timeout = 1000)
public void isFull_add2268() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "isFull_add2268");
final Set<java.lang.String> set = new HashSet<java.lang.String>();
set.add("1");
set.add("2");
set.add("3");
set.add("3");
try {
org.apache.commons.collections4.CollectionUtils.isFull(null);
} catch (final NullPointerException ex) {
}
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6924,null,6923,org.apache.commons.collections4.CollectionUtils.isFull(set));
final CircularFifoQueue<java.lang.String> buf = new CircularFifoQueue<java.lang.String>(set);
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6926,null,6925,org.apache.commons.collections4.CollectionUtils.isFull(buf));
buf.remove("2");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6928,null,6927,org.apache.commons.collections4.CollectionUtils.isFull(buf));
buf.add("2");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6930,null,6929,org.apache.commons.collections4.CollectionUtils.isFull(buf));
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
示例10: isFull_add2269
import org.apache.commons.collections4.queue.CircularFifoQueue; //导入依赖的package包/类
@Test(timeout = 1000)
public void isFull_add2269() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "isFull_add2269");
final Set<java.lang.String> set = new HashSet<java.lang.String>();
set.add("1");
set.add("2");
set.add("3");
try {
org.apache.commons.collections4.CollectionUtils.isFull(null);
org.apache.commons.collections4.CollectionUtils.isFull(null);
} catch (final NullPointerException ex) {
}
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6924,null,6923,org.apache.commons.collections4.CollectionUtils.isFull(set));
final CircularFifoQueue<java.lang.String> buf = new CircularFifoQueue<java.lang.String>(set);
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6926,null,6925,org.apache.commons.collections4.CollectionUtils.isFull(buf));
buf.remove("2");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6928,null,6927,org.apache.commons.collections4.CollectionUtils.isFull(buf));
buf.add("2");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6930,null,6929,org.apache.commons.collections4.CollectionUtils.isFull(buf));
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
示例11: isFull_add2270
import org.apache.commons.collections4.queue.CircularFifoQueue; //导入依赖的package包/类
@Test(timeout = 1000)
public void isFull_add2270() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "isFull_add2270");
final Set<java.lang.String> set = new HashSet<java.lang.String>();
set.add("1");
set.add("2");
set.add("3");
try {
org.apache.commons.collections4.CollectionUtils.isFull(null);
} catch (final NullPointerException ex) {
}
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6924,null,6923,org.apache.commons.collections4.CollectionUtils.isFull(set));
final CircularFifoQueue<java.lang.String> buf = new CircularFifoQueue<java.lang.String>(set);
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6926,null,6925,org.apache.commons.collections4.CollectionUtils.isFull(buf));
buf.remove("2");
buf.remove("2");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6928,null,6927,org.apache.commons.collections4.CollectionUtils.isFull(buf));
buf.add("2");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6930,null,6929,org.apache.commons.collections4.CollectionUtils.isFull(buf));
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
示例12: isFull_add2271
import org.apache.commons.collections4.queue.CircularFifoQueue; //导入依赖的package包/类
@Test(timeout = 1000)
public void isFull_add2271() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "isFull_add2271");
final Set<java.lang.String> set = new HashSet<java.lang.String>();
set.add("1");
set.add("2");
set.add("3");
try {
org.apache.commons.collections4.CollectionUtils.isFull(null);
} catch (final NullPointerException ex) {
}
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6924,null,6923,org.apache.commons.collections4.CollectionUtils.isFull(set));
final CircularFifoQueue<java.lang.String> buf = new CircularFifoQueue<java.lang.String>(set);
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6926,null,6925,org.apache.commons.collections4.CollectionUtils.isFull(buf));
buf.remove("2");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6928,null,6927,org.apache.commons.collections4.CollectionUtils.isFull(buf));
buf.add("2");
buf.add("2");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6930,null,6929,org.apache.commons.collections4.CollectionUtils.isFull(buf));
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
示例13: isFull
import org.apache.commons.collections4.queue.CircularFifoQueue; //导入依赖的package包/类
@Test
public void isFull() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "isFull");
final Set<java.lang.String> set = new HashSet<java.lang.String>();
set.add("foo");
set.add("2");
set.add("3");
try {
org.apache.commons.collections4.CollectionUtils.isFull(null);
} catch (final NullPointerException ex) {
}
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6924,null,6923,org.apache.commons.collections4.CollectionUtils.isFull(set));
final CircularFifoQueue<java.lang.String> buf = new CircularFifoQueue<java.lang.String>(set);
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6926,null,6925,org.apache.commons.collections4.CollectionUtils.isFull(buf));
buf.remove("2");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6928,null,6927,org.apache.commons.collections4.CollectionUtils.isFull(buf));
buf.add("2");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6930,null,6929,org.apache.commons.collections4.CollectionUtils.isFull(buf));
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
示例14: isFull_literalMutation2214
import org.apache.commons.collections4.queue.CircularFifoQueue; //导入依赖的package包/类
@Test
public void isFull_literalMutation2214() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "isFull_literalMutation2214");
final Set<java.lang.String> set = new HashSet<java.lang.String>();
set.add("1");
set.add("foo");
set.add("3");
try {
org.apache.commons.collections4.CollectionUtils.isFull(null);
} catch (final NullPointerException ex) {
}
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6924,null,6923,org.apache.commons.collections4.CollectionUtils.isFull(set));
final CircularFifoQueue<java.lang.String> buf = new CircularFifoQueue<java.lang.String>(set);
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6926,null,6925,org.apache.commons.collections4.CollectionUtils.isFull(buf));
buf.remove("2");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6928,null,6927,org.apache.commons.collections4.CollectionUtils.isFull(buf));
buf.add("2");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6930,null,6929,org.apache.commons.collections4.CollectionUtils.isFull(buf));
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
示例15: isFull_literalMutation2215
import org.apache.commons.collections4.queue.CircularFifoQueue; //导入依赖的package包/类
@Test
public void isFull_literalMutation2215() {
fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "isFull_literalMutation2215");
final Set<java.lang.String> set = new HashSet<java.lang.String>();
set.add("1");
set.add("2");
set.add("foo");
try {
org.apache.commons.collections4.CollectionUtils.isFull(null);
} catch (final NullPointerException ex) {
}
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6924,null,6923,org.apache.commons.collections4.CollectionUtils.isFull(set));
final CircularFifoQueue<java.lang.String> buf = new CircularFifoQueue<java.lang.String>(set);
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6926,null,6925,org.apache.commons.collections4.CollectionUtils.isFull(buf));
buf.remove("2");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6928,null,6927,org.apache.commons.collections4.CollectionUtils.isFull(buf));
buf.add("2");
fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),6930,null,6929,org.apache.commons.collections4.CollectionUtils.isFull(buf));
fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}