/** * If the buffer is full, the least recently added element is discarded so * that a new element can be inserted. * * @param element the element to add * @return true, always */ public boolean add(Object element) { if (isFull()) { remove(); } return super.add(element); }
/** * If the buffer is full, the least recently added element is discarded so * that a new element can be inserted. * * @param element the element to add * @return true, always */ public boolean add(Object element) { if (isFull()) { remove(); } return super.add(element); }
public boolean isFull() { return buffer.isFull(); }
@Override public Datum terminate(FunctionContext ctx) { LagContext lagCtx = (LagContext)ctx; if(lagCtx.lagBuffer.isFull()) { return (Datum)(lagCtx.lagBuffer.get()); } else { return lagCtx.defaultDatum; } }
@Override public Datum terminate(FunctionContext ctx) { LagContext lagCtx = (LagContext)ctx; if(lagCtx.lagBuffer.isFull()) { return (Datum)(lagCtx.lagBuffer.get()); } else { return lagCtx.defaultDatum; } }
/** * If the buffer is full, the least recently added element is discarded so * that a new element can be inserted. * * @param element the element to add * @return true, always */ public boolean add(Object element) { if (isFull()) { remove(); } return super.add(element); }
/** * If the buffer is full, the least recently added element is discarded so * that a new element can be inserted. * * @param element the element to add * @return true, always */ public boolean add(Object element) { if (isFull()) { remove(); } return super.add(element); }
/** * If the buffer is full, the least recently added element is discarded so * that a new element can be inserted. * * @param element the element to add * @return true, always */ public boolean add(Object element) { if (isFull()) { remove(); } return super.add(element); }
private static boolean areAllSamplesEqual(CircularFifoBuffer samplesQueue) { return samplesQueue.isFull() && samplesQueue.stream().allMatch(sample -> samplesQueue.get() != null && samplesQueue.get().equals(sample)); } }
private static boolean areAllSamplesEqual(CircularFifoBuffer samplesQueue) { return samplesQueue.isFull() && samplesQueue.stream().allMatch(sample -> samplesQueue.get() != null && samplesQueue.get().equals(sample)); } }
/** * If the buffer is full, the least recently added element is discarded so * that a new element can be inserted. * * @param element the element to add * @return true, always */ public boolean add(Object element) { if (isFull()) { remove(); } return super.add(element); }
/** * If the buffer is full, the least recently added element is discarded so * that a new element can be inserted. * * @param element the element to add * @return true, always */ public boolean add(Object element) { if (isFull()) { remove(); } return super.add(element); }
private void addToTimerDataList(MonitorData mdata) { // We should remove the oldest entry if (lastTimerDataList.isFull()) lastTimerDataList.remove(lastTimerDataList.get()); lastTimerDataList.add(mdata); }
private void addToLastUnfinishedTimerDataList(MonitorData mdata) { // We should remove the oldest entry if (lastUnfinishedTimerDataList.isFull()) lastUnfinishedTimerDataList.remove(lastUnfinishedTimerDataList.get()); lastUnfinishedTimerDataList.add(mdata); }
@Override public void execute(Tuple input) { long minute = input.getLongByField(Field.TIMESTAMP_MINUTES); MutableLong count = counts.get(minute); if (count == null) { if (buffer.isFull()) { long oldMinute = (Long) buffer.remove(); counts.remove(oldMinute); } count = new MutableLong(1); counts.put(minute, count); buffer.add(minute); } else { count.increment(); } collector.emit(input, new Values(minute, count.longValue())); collector.ack(input); }