com.google.gwt.core.client.Duration类的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中com.google.gwt.core.client.Duration类的一些代码示例,展示了Duration类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Duration类的具体详情如下:
包路径:com.google.gwt.core.client.Duration
类名称:Duration

Duration介绍

[英]A utility class for measuring elapsed time.
[中]用于测量运行时间的实用程序类。

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
 public void run() {
  assert (!isExecuting());
  setExecutionTimerPending(false);
  doExecuteCommands(Duration.currentTimeMillis());
 }
};

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
  * Iterate over all animations and update them.
  */
 private void updateAnimations() {
  // Copy the animation requests to avoid concurrent modifications.
  AnimationHandleImpl[] curAnimations = new AnimationHandleImpl[animationRequests.size()];
  curAnimations = animationRequests.toArray(curAnimations);

  // Iterate over the animation requests.
  Duration duration = new Duration();
  for (AnimationHandleImpl requestId : curAnimations) {
   // Remove the current request.
   animationRequests.remove(requestId);

   // Execute the callback.
   requestId.getCallback().execute(duration.getStartMillis());
  }

  // Reschedule the timer if there are more animation requests.
  if (animationRequests.size() > 0) {
   /*
    * In order to achieve as close to 60fps as possible, we calculate the new
    * delay based on the execution time of this method. The delay will be
    * less than 16ms, assuming this method takes more than 1ms to complete.
    */
   timer.schedule(Math.max(MIN_FRAME_DELAY, DEFAULT_FRAME_DELAY - duration.elapsedMillis()));
  }
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Returns the number of milliseconds that have elapsed since this object was
 * created.
 */
public int elapsedMillis() {
 return uncheckedConversion(currentTimeMillis() - start);
}

代码示例来源:origin: org.eclipse.che.core/che-core-ide-app

/** Returns the time (mm:ss) that have elapsed since this timer was created. */
private String getElapsedTime() {
 final int elapsedSec = duration.elapsedMillis() / 1000;
 final int minutesPart = elapsedSec / 60;
 final int secondsPart = elapsedSec - minutesPart * 60;
 return (minutesPart < 10 ? "0" + minutesPart : minutesPart)
   + ":"
   + (secondsPart < 10 ? "0" + secondsPart : secondsPart);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * there for testing
 */
Duration createDuration() {
 return new Duration();
}

代码示例来源:origin: com.googlecode.gwtquery/gwtquery

private boolean delayConditionMet() {
 if (mouseUpDuration == null) {
  return false;
 }
 return options.getDelay() <= mouseUpDuration.elapsedMillis();
}

代码示例来源:origin: net.wetheinter/gwt-user

/**
 * there for testing
 */
Duration createDuration() {
 return new Duration();
}

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
 public boolean execute() {
  double currentTime = Duration.currentTimeMillis();
  Iterator<TemporalPoint> iter = touchPositionsDuringMomentum.iterator();
  while (iter.hasNext()) {
   TemporalPoint point = iter.next();
   if (currentTime - point.getTime() >= TIME_THRESHOLD) {
    iter.remove();
   }
  }
  return !touchPositionsDuringMomentum.isEmpty();
 }
}

代码示例来源:origin: net.wetheinter/gwt-user

/**
 * Returns the number of milliseconds that have elapsed since this object was
 * created.
 */
public int elapsedMillis() {
 return uncheckedConversion(currentTimeMillis() - start);
}

代码示例来源:origin: net.wetheinter/gwt-user

/**
  * Iterate over all animations and update them.
  */
 private void updateAnimations() {
  // Copy the animation requests to avoid concurrent modifications.
  AnimationHandleImpl[] curAnimations = new AnimationHandleImpl[animationRequests.size()];
  curAnimations = animationRequests.toArray(curAnimations);

  // Iterate over the animation requests.
  Duration duration = new Duration();
  for (AnimationHandleImpl requestId : curAnimations) {
   // Remove the current request.
   animationRequests.remove(requestId);

   // Execute the callback.
   requestId.getCallback().execute(duration.getStartMillis());
  }

  // Reschedule the timer if there are more animation requests.
  if (animationRequests.size() > 0) {
   /*
    * In order to achieve as close to 60fps as possible, we calculate the new
    * delay based on the execution time of this method. The delay will be
    * less than 16ms, assuming this method takes more than 1ms to complete.
    */
   timer.schedule(Math.max(MIN_FRAME_DELAY, DEFAULT_FRAME_DELAY - duration.elapsedMillis()));
  }
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

while (duration.elapsedMillis() < TIME_SLICE) {
 boolean executedSomeTask = false;
 for (int i = 0; i < length; i++) {

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

/**
 * there for testing
 */
Duration createDuration() {
 return new Duration();
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Immediately run this animation. If the animation is already running, it
 * will be canceled first.
 * <p>
 * If the element is not <code>null</code>, the {@link #onUpdate(double)}
 * method might be called only if the element may be visible (generally left
 * at the appreciation of the browser). Otherwise, it will be called
 * unconditionally.
 * 
 * @param duration the duration of the animation in milliseconds
 * @param element the element that visually bounds the entire animation
 */
public void run(int duration, Element element) {
 run(duration, Duration.currentTimeMillis(), element);
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

/**
 * Returns the number of milliseconds that have elapsed since this object was
 * created.
 */
public int elapsedMillis() {
 return uncheckedConversion(currentTimeMillis() - start);
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

/**
  * Iterate over all animations and update them.
  */
 private void updateAnimations() {
  // Copy the animation requests to avoid concurrent modifications.
  AnimationHandleImpl[] curAnimations = new AnimationHandleImpl[animationRequests.size()];
  curAnimations = animationRequests.toArray(curAnimations);

  // Iterate over the animation requests.
  Duration duration = new Duration();
  for (AnimationHandleImpl requestId : curAnimations) {
   // Remove the current request.
   animationRequests.remove(requestId);

   // Execute the callback.
   requestId.getCallback().execute(duration.getStartMillis());
  }

  // Reschedule the timer if there are more animation requests.
  if (animationRequests.size() > 0) {
   /*
    * In order to achieve as close to 60fps as possible, we calculate the new
    * delay based on the execution time of this method. The delay will be
    * less than 16ms, assuming this method takes more than 1ms to complete.
    */
   timer.schedule(Math.max(MIN_FRAME_DELAY, DEFAULT_FRAME_DELAY - duration.elapsedMillis()));
  }
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

int cumulativeElapsedMillis = duration.elapsedMillis();
state.setElapsedMillis(cumulativeElapsedMillis - lastElapsedMillis);
lastElapsedMillis = cumulativeElapsedMillis;

代码示例来源:origin: com.google.web.bindery/requestfactory-server

/**
 * there for testing
 */
Duration createDuration() {
 return new Duration();
}

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
public void onBrowserEvent(Event event) {
 // Align the scrollbars with the content.
 if (Event.ONSCROLL == event.getTypeInt()) {
  double curTime = Duration.currentTimeMillis();
  if (curTime > ignoreContentUntil) {
   ignoreScrollbarsUntil = curTime + IGNORE_SCROLL_TIMEOUT;
   maybeUpdateScrollbarPositions();
  }
 }
 super.onBrowserEvent(event);
}

代码示例来源:origin: com.google.web.bindery/requestfactory-server

/**
 * Returns the number of milliseconds that have elapsed since this object was
 * created.
 */
public int elapsedMillis() {
 return uncheckedConversion(currentTimeMillis() - start);
}

代码示例来源:origin: apache/incubator-wave

void add(String name) {
 events.put(name, duration.elapsedMillis());
}

相关文章