public TopologyDetails getNextHighest() { return tds.peekFirst(); }
public static Z z() { return instances2.get().peekFirst(); }
public E peekFirst() { lock.lock(); try { return list.size() == 0 ? null : list.peekFirst(); } finally { lock.unlock(); } }
private synchronized long getAverageRenderingTime() { int frames = mDrawTimes.size(); if(frames <= 0) return 0; Long first = mDrawTimes.peekFirst(); Long last = mDrawTimes.peekLast(); if (first == null || last == null) { return 0; } long dtime = last - first; return dtime / frames; }
private float fps() { long lastTime = SystemClock.uptimeMillis(); mDrawTimes.addLast(lastTime); Long first = mDrawTimes.peekFirst(); if (first == null) { return 0.0f; } float dtime = lastTime - first; int frames = mDrawTimes.size(); if (frames > MAX_RECORD_SIZE) { mDrawTimes.removeFirst(); } return dtime > 0 ? mDrawTimes.size() * ONE_SECOND / dtime : 0.0f; }
private float fps() { long lastTime = SystemClock.uptimeMillis(); mDrawTimes.addLast(lastTime); Long first = mDrawTimes.peekFirst(); if (first == null) { return 0.0f; } float dtime = lastTime - first; int frames = mDrawTimes.size(); if (frames > MAX_RECORD_SIZE) { mDrawTimes.removeFirst(); } return dtime > 0 ? mDrawTimes.size() * ONE_SECOND / dtime : 0.0f; } @Override
private float fps() { long lastTime = SystemClock.uptimeMillis(); mDrawTimes.addLast(lastTime); Long first = mDrawTimes.peekFirst(); if (first == null) { return 0.0f; } float dtime = lastTime - first; int frames = mDrawTimes.size(); if (frames > MAX_RECORD_SIZE) { mDrawTimes.removeFirst(); } return dtime > 0 ? mDrawTimes.size() * ONE_SECOND / dtime : 0.0f; } @Override
if (this.buffers.peekFirst() == null) { this.nextBlockSize = targetCapacity - size();
@Override public DomainEventMessage<?> peek() { if (!hasNext()) { return null; } return streams.peekFirst().peek(); }
if (this.buffers.peekFirst() == null) { this.nextBlockSize = targetCapacity - size();
public Iterator<Proposal> getProposalsFromTxnLog(long peerZxid, long limit) { if (peerZxid >= txnLog.peekFirst().packet.getZxid()) { return txnLog.iterator(); } else { return (new LinkedList<Proposal>()).iterator(); } }
@Override public DomainEventMessage<?> next() { if (!hasNext()) { return null; } DomainEventMessage<?> next = streams.peekFirst().next(); lastSequenceNumber = next.getSequenceNumber(); return next; }
/** * This draw method abstracts out what is common between drawing all shapes * * @param canvas The canvas to draw on * @param currentFreqAve The average frequency for the same, which determines the boost in size * @param currentAngle The current angle around the center to draw the shape */ void draw(Canvas canvas, float currentFreqAve, double currentAngle) { float currentSize = sMinSize + mMultiplier * currentFreqAve; // Calculate where the shape is float shapeCenterX = calcLocationInAnimationX(mShapeRadiusFromCenter, currentAngle); float shapeCenterY = calcLocationInAnimationY(mShapeRadiusFromCenter, currentAngle); // Calculate where the next point in the trail is float trailX = calcLocationInAnimationX((mShapeRadiusFromCenter + currentSize - sMinSize), currentAngle); float trailY = calcLocationInAnimationY((mShapeRadiusFromCenter + currentSize - sMinSize), currentAngle); mTrailPath.rewind(); // clear the trail mTrailList.add(new TrailPoint(trailX, trailY, currentAngle)); // add the new line segment // Keep the trail size correct while (currentAngle - mTrailList.peekFirst().theta > 2 * Math.PI) { mTrailList.poll(); } // Draw the trail mTrailPath.moveTo(mTrailList.peekFirst().x, mTrailList.peekFirst().y); for (TrailPoint trailPoint : mTrailList) { mTrailPath.lineTo(trailPoint.x, trailPoint.y); } canvas.drawPath(mTrailPath, mTrailPaint); // Call the abstract drawThisShape method, this must be defined for each shape. drawThisShape(shapeCenterX, shapeCenterY, currentSize, canvas, mPaint); }
/** * This draw method abstracts out what is common between drawing all shapes * * @param canvas The canvas to draw on * @param currentFreqAve The average frequency for the same, which determines the boost in size * @param currentAngle The current angle around the center to draw the shape */ void draw(Canvas canvas, float currentFreqAve, double currentAngle) { float currentSize = sMinSize + mMultiplier * currentFreqAve; // Calculate where the shape is float shapeCenterX = calcLocationInAnimationX(mShapeRadiusFromCenter, currentAngle); float shapeCenterY = calcLocationInAnimationY(mShapeRadiusFromCenter, currentAngle); // Calculate where the next point in the trail is float trailX = calcLocationInAnimationX((mShapeRadiusFromCenter + currentSize - sMinSize), currentAngle); float trailY = calcLocationInAnimationY((mShapeRadiusFromCenter + currentSize - sMinSize), currentAngle); mTrailPath.rewind(); // clear the trail mTrailList.add(new TrailPoint(trailX, trailY, currentAngle)); // add the new line segment // Keep the trail size correct while (currentAngle - mTrailList.peekFirst().theta > 2 * Math.PI) { mTrailList.poll(); } // Draw the trail mTrailPath.moveTo(mTrailList.peekFirst().x, mTrailList.peekFirst().y); for (TrailPoint trailPoint : mTrailList) { mTrailPath.lineTo(trailPoint.x, trailPoint.y); } canvas.drawPath(mTrailPath, mTrailPaint); // Call the abstract drawThisShape method, this must be defined for each shape. drawThisShape(shapeCenterX, shapeCenterY, currentSize, canvas, mPaint); }
/** * This draw method abstracts out what is common between drawing all shapes * * @param canvas The canvas to draw on * @param currentFreqAve The average frequency for the same, which determines the boost in size * @param currentAngle The current angle around the center to draw the shape */ void draw(Canvas canvas, float currentFreqAve, double currentAngle) { float currentSize = sMinSize + mMultiplier * currentFreqAve; // Calculate where the shape is float shapeCenterX = calcLocationInAnimationX(mShapeRadiusFromCenter, currentAngle); float shapeCenterY = calcLocationInAnimationY(mShapeRadiusFromCenter, currentAngle); // Calculate where the next point in the trail is float trailX = calcLocationInAnimationX((mShapeRadiusFromCenter + currentSize - sMinSize), currentAngle); float trailY = calcLocationInAnimationY((mShapeRadiusFromCenter + currentSize - sMinSize), currentAngle); mTrailPath.rewind(); // clear the trail mTrailList.add(new TrailPoint(trailX, trailY, currentAngle)); // add the new line segment // Keep the trail size correct while (currentAngle - mTrailList.peekFirst().theta > 2 * Math.PI) { mTrailList.poll(); } // Draw the trail mTrailPath.moveTo(mTrailList.peekFirst().x, mTrailList.peekFirst().y); for (TrailPoint trailPoint : mTrailList) { mTrailPath.lineTo(trailPoint.x, trailPoint.y); } canvas.drawPath(mTrailPath, mTrailPaint); // Call the abstract drawThisShape method, this must be defined for each shape. drawThisShape(shapeCenterX, shapeCenterY, currentSize, canvas, mPaint); }
/** * This draw method abstracts out what is common between drawing all shapes * * @param canvas The canvas to draw on * @param currentFreqAve The average frequency for the same, which determines the boost in size * @param currentAngle The current angle around the center to draw the shape */ void draw(Canvas canvas, float currentFreqAve, double currentAngle) { float currentSize = sMinSize + mMultiplier * currentFreqAve; // Calculate where the shape is float shapeCenterX = calcLocationInAnimationX(mShapeRadiusFromCenter, currentAngle); float shapeCenterY = calcLocationInAnimationY(mShapeRadiusFromCenter, currentAngle); // Calculate where the next point in the trail is float trailX = calcLocationInAnimationX((mShapeRadiusFromCenter + currentSize - sMinSize), currentAngle); float trailY = calcLocationInAnimationY((mShapeRadiusFromCenter + currentSize - sMinSize), currentAngle); mTrailPath.rewind(); // clear the trail mTrailList.add(new TrailPoint(trailX, trailY, currentAngle)); // add the new line segment // Keep the trail size correct while (currentAngle - mTrailList.peekFirst().theta > 2 * Math.PI) { mTrailList.poll(); } // Draw the trail mTrailPath.moveTo(mTrailList.peekFirst().x, mTrailList.peekFirst().y); for (TrailPoint trailPoint : mTrailList) { mTrailPath.lineTo(trailPoint.x, trailPoint.y); } canvas.drawPath(mTrailPath, mTrailPaint); // Call the abstract drawThisShape method, this must be defined for each shape. drawThisShape(shapeCenterX, shapeCenterY, currentSize, canvas, mPaint); }
/** * This draw method abstracts out what is common between drawing all shapes * * @param canvas The canvas to draw on * @param currentFreqAve The average frequency for the same, which determines the boost in size * @param currentAngle The current angle around the center to draw the shape */ void draw(Canvas canvas, float currentFreqAve, double currentAngle) { float currentSize = sMinSize + mMultiplier * currentFreqAve; // Calculate where the shape is float shapeCenterX = calcLocationInAnimationX(mShapeRadiusFromCenter, currentAngle); float shapeCenterY = calcLocationInAnimationY(mShapeRadiusFromCenter, currentAngle); // Calculate where the next point in the trail is float trailX = calcLocationInAnimationX((mShapeRadiusFromCenter + currentSize - sMinSize), currentAngle); float trailY = calcLocationInAnimationY((mShapeRadiusFromCenter + currentSize - sMinSize), currentAngle); mTrailPath.rewind(); // clear the trail mTrailList.add(new TrailPoint(trailX, trailY, currentAngle)); // add the new line segment // Keep the trail size correct while (currentAngle - mTrailList.peekFirst().theta > 2 * Math.PI) { mTrailList.poll(); } // Draw the trail mTrailPath.moveTo(mTrailList.peekFirst().x, mTrailList.peekFirst().y); for (TrailPoint trailPoint : mTrailList) { mTrailPath.lineTo(trailPoint.x, trailPoint.y); } canvas.drawPath(mTrailPath, mTrailPaint); // Call the abstract drawThisShape method, this must be defined for each shape. drawThisShape(shapeCenterX, shapeCenterY, currentSize, canvas, mPaint); }
private CacheGetResult convertCacheGetResult(CacheGetResult originResult) { try { CacheValueHolder originHolder = (CacheValueHolder) getHolder.invoke(originResult); LinkedList<CacheValueHolder> list = new LinkedList<>(); while (originHolder != null) { CacheValueHolder h = new CacheValueHolder(); if (list.size() > 0) { list.getLast().setValue(h); } list.add(h); h.setAccessTime(originHolder.getAccessTime()); h.setExpireTime(originHolder.getExpireTime()); Object v = originHolder.getValue(); if (v != null && !(v instanceof CacheValueHolder)) { h.setValue(config.getValueDecoder().apply((byte[]) v)); break; } else if (originHolder.getValue() == null) { originHolder = (CacheValueHolder) originHolder.getValue(); } } return new CacheGetResult(originResult.getResultCode(), originResult.getMessage(), list.peekFirst()); } catch (Exception e) { throw new CacheException(e); } }