Examples of Duration


Examples of com.sun.syndication.feed.module.itunes.types.Duration

                    String extent = getOneDC(item, "dc.format.extent");         // assumed that user will enter this field with length of song in seconds
                    if (extent != null && extent.length() > 0) {
                        extent = extent.split(" ")[0];
                        Integer duration = Integer.parseInt(extent);
                        itunes.setDuration(new Duration(duration));             // <itunes:duration>
                    }

                    String subject = getOneDC(item, "dc.subject");
                    if (subject != null && subject.length() > 0) {
                        String[] subjects = new String[1];
View Full Code Here

Examples of com.twitter.util.Duration

public class ClusterTest {
  public Cluster cluster;

  @Before
  public void before() throws Exception {
    cluster = new Cluster("host1,host2", NullStatsReceiver$.MODULE$).mapHostsEvery(new Duration(0));
  }
View Full Code Here

Examples of com.yammer.dropwizard.util.Duration

        if (!_expire.isPresent() && !_maximumSize.isPresent()) {
            cacheBuilder.maximumSize(0);
        } else {
            if (_expire.isPresent()) {
                Duration expire = _expire.get();
                cacheBuilder.expireAfterWrite(expire.getQuantity(), expire.getUnit());
            }

            if (_maximumSize.isPresent()) {
                cacheBuilder
                        .weigher(CachedResponseWeigher.INSTANCE)
View Full Code Here

Examples of de.danet.an.util.Duration

      try {
    Object res = process.evalScript (getCondition ());
    if (res instanceof Date) {
        cond = (Date)res;
    } else if (res instanceof Number) {
        cond = new Duration ();
        ((Duration)cond).setSeconds
      (((Number)res).floatValue ());
    } else {
        throw new ParseException
      ("Evaluating duration \"" + getCondition()
       + "\" yields neither number nor date.", 0);
    }
      } catch (ScriptException e) {
    throw new ParseException
        ("Problem evaluating duration value \""
         + getCondition() + "\": " + e.getMessage(), 0);
      } finally {
    cx.exit();
      }
  }
  Date end = null;
  if (cond instanceof Date) {
      end = (Date)cond;
  } else {
      Duration dur = (Duration)cond;
      end = dur.addTo (baseTime);
  }
  return end;
    }
View Full Code Here

Examples of groovy.time.Duration

    public static Duration getDaylightSavingsOffset(BaseDuration self) {
        return getDaylightSavingsOffset(new Date(self.toMilliseconds() + 1));
    }

    public static Duration getRelativeDaylightSavingsOffset(Date self, Date other) {
        Duration d1 = getDaylightSavingsOffset(self);
        Duration d2 = getDaylightSavingsOffset(other);
        return new TimeDuration(0, 0, 0, (int) (d2.toMilliseconds() - d1.toMilliseconds()));
    }
View Full Code Here

Examples of io.airlift.units.Duration

        assertEquals(taskInfo.getState(), TaskState.RUNNING);

        taskInfo = sqlTaskManager.getTaskInfo(taskInfo.getTaskId(), false);
        assertEquals(taskInfo.getState(), TaskState.RUNNING);

        BufferResult results = sqlTaskManager.getTaskResults(taskId, "out", 0, new DataSize(1, Unit.MEGABYTE), new Duration(1, TimeUnit.SECONDS));
        assertEquals(results.isBufferClosed(), false);
        assertEquals(results.getElements().size(), 1);
        assertEquals(results.getElements().get(0).getPositionCount(), 1);

        results = sqlTaskManager.getTaskResults(taskId, "out", results.getStartingSequenceId() + results.getElements().size(), new DataSize(1, Unit.MEGABYTE), new Duration(1, TimeUnit.SECONDS));
        // todo this should be true
        assertEquals(results.isBufferClosed(), false);
        assertEquals(results.getElements().size(), 0);

        sqlTaskManager.waitForStateChange(taskInfo.getTaskId(), taskInfo.getState(), new Duration(1, TimeUnit.SECONDS));
        taskInfo = sqlTaskManager.getTaskInfo(taskInfo.getTaskId(), false);
        assertEquals(taskInfo.getState(), TaskState.FINISHED);
        taskInfo = sqlTaskManager.getTaskInfo(taskInfo.getTaskId(), false);
        assertEquals(taskInfo.getState(), TaskState.FINISHED);
    }
View Full Code Here

Examples of io.dropwizard.util.Duration

     *
     * @param registry the SchemeRegistry
     * @return a InstrumentedClientConnManger instance
     */
    protected NHttpClientConnectionManager createConnectionManager(SchemeRegistry registry, String name) {
        final Duration ttl = configuration.getTimeToLive();
        ConnectingIOReactor ioReactor = createDefaultIOReactor(IOReactorConfig.custom()
                .setSoTimeout((int) configuration.getTimeout().toMilliseconds())
                .setConnectTimeout((int) configuration.getConnectionTimeout().toMilliseconds())
                .setTcpNoDelay(true).build());

        PoolingNHttpClientConnectionManager manager
                = new InstrumentedNClientConnManager(
                        ioReactor, null, null, //TODO: add this parameters values
                        metricRegistry,
                        convertRegistry(this.registry),
                        ttl.getQuantity(),
                        ttl.getUnit(),
                        resolver,
                        name);
        manager.setDefaultMaxPerRoute(configuration.getMaxConnectionsPerRoute());
        manager.setMaxTotal(configuration.getMaxConnections());
        return manager;
View Full Code Here

Examples of java.time.Duration

   * time in terms of seconds and nanoseconds.
   */
  @Test
  public void testDurationToAlterTime() {
    // A duration of 3 seconds and 5 nanoseconds
    Duration duration = Duration.ofSeconds(3, 5);

    // You can modify the values of a DateTime using a Duration
    final LocalDateTime localDateTime = LocalDateTime.of(2014, Month.SEPTEMBER, 1, 17, 29, 40);
    final LocalDateTime futureDateTime = localDateTime.plus(duration);
    assertThat(futureDateTime, is(LocalDateTime.of(localDateTime.toLocalDate(), LocalTime.of(17, 29, 43, 5))));
View Full Code Here

Examples of javafx.util.Duration

  public void start(Stage primaryStage) throws Exception {
    Button button = new Button("BindableTransition");
    DropShadow shadow = DropShadowBuilder.create().build();
    button.setEffect(shadow);
    button.setStyle("-fx-font-size: 32px;");
    final Duration duration = Duration.millis(1200);
    BindableTransition transition = new BindableTransition(duration);
    transition.setCycleCount(1000);
    transition.setAutoReverse(true);
    shadow.offsetXProperty().bind(transition.fractionProperty().multiply(32));
    shadow.offsetYProperty().bind(transition.fractionProperty().multiply(32));
View Full Code Here

Examples of javax.cache.expiry.Duration

         if (isConditional && !current.equals(oldValue)) {
            updateTTLForAccessed(cache, key, value);
            return false;
         }

         Duration ttl = Expiration.getExpiry(expiryPolicy, Expiration.Operation.UPDATE);

         if (ttl == null || ttl.isEternal()) {
            return isConditional
                  ? cache.replace(key, oldValue, value)
                  : cache.replace(key, value) != null;
         } else if (ttl.equals(Duration.ZERO)) {
            // TODO: Can this be avoided?
            // Remove explicitly
            return cache.remove(key) != null;
         } else {
            long duration = ttl.getDurationAmount();
            TimeUnit timeUnit = ttl.getTimeUnit();
            return isConditional
                  ? cache.replace(key, oldValue, value, duration, timeUnit)
                  : cache.replace(key, value, duration, timeUnit) != null;
         }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.