Examples of TimeSpan


Examples of org.encog.util.time.TimeSpan

public class TestTimeSpan extends TestCase {
  public void testDiffMonths()
  {
    Date date1 = DateUtil.createDate(1, 1, 2008);
    Date date2 = DateUtil.createDate(6, 1, 2008);
    TestCase.assertEquals(5, new TimeSpan(date1,date2).getSpan(TimeUnit.MONTHS));
    date1 = DateUtil.createDate(12, 1, 2008);
    date2 = DateUtil.createDate(1, 1, 2009);
    TestCase.assertEquals(1, new TimeSpan(date1,date2).getSpan(TimeUnit.MONTHS));
    date1 = DateUtil.createDate(12, 31, 2008);
    date2 = DateUtil.createDate(1, 1, 2009);
    TestCase.assertEquals(1, new TimeSpan(date1,date2).getSpan(TimeUnit.MONTHS));
  }
View Full Code Here

Examples of org.jamesii.core.util.misc.TimeSpan

        ts.getTotalNanoseconds());
  }

  /** Tests the constructor {@link TimeSpan#TimeSpan(int, int, int)}. */
  public void testCtorInt3() {
    checkFields(new TimeSpan(0, 0, 0), 0, 0, 0, 0, 0, 0, 0, 0L);
    checkFields(new TimeSpan(3, 5, 7), 0, 3, 5, 7, 0, 0, 0, 11107000000000L);
    // overflow into days
    checkFields(new TimeSpan(24, 0, 0), 1, 0, 0, 0, 0, 0, 0, 86400000000000L);
    checkFields(new TimeSpan(25, 1, 2), 1, 1, 1, 2, 0, 0, 0, 90062000000000L);
    // overflow into hours
    checkFields(new TimeSpan(0, 60, 0), 0, 1, 0, 0, 0, 0, 0, 3600000000000L);
    checkFields(new TimeSpan(0, 61, 28), 0, 1, 1, 28, 0, 0, 0, 3688000000000L);
    // overflow into minutes
    checkFields(new TimeSpan(0, 0, 60), 0, 0, 1, 0, 0, 0, 0, 60000000000L);
    checkFields(new TimeSpan(1, 2, 63), 0, 1, 3, 3, 0, 0, 0, 3783000000000L);

    checkFields(new TimeSpan(0, 60, 60), 0, 1, 1, 0, 0, 0, 0, 3660000000000L);
    checkFields(new TimeSpan(24, 60, 60), 1, 1, 1, 0, 0, 0, 0, 90060000000000L);
    checkFields(new TimeSpan(48, 128, 720), 2, 2, 20, 0, 0, 0, 0,
        181200000000000L);
  }
View Full Code Here

Examples of org.jboss.bpm.monitor.model.metric.Timespan

  public List<HistoryProcessInstanceRef> getHistoryProcessInstances(
      String definitionkey, String status, long starttime, long endtime,
      String correlationkey) {
   
    String dkey =  ModelAdaptor.decodeId(definitionkey);
    List<Event> events = ds.getInstanceEvents(dkey, new Timespan(starttime, endtime, "Custom"), getStatus(status));
    List<String> instanceIds = null;
    if (correlationkey != null && !("".equals(correlationkey.trim()))) {
      String ckey = null;
      try {
        ckey = URLDecoder.decode(correlationkey.replace("~", "="), "UTF-8");
View Full Code Here

Examples of org.jboss.bpm.monitor.model.metric.Timespan

    public Set<String> getTerminatedInstances(String definitionKey, long timestamp, String timespan) {
        return getInstances(definitionKey, timestamp, timespan, State.Closed_Cancelled_Terminated);
    }

    public String getCompletedInstances4Chart(String processDefinition, String timespanValue) {
        final Timespan timespan = TimespanFactory.fromValue(timespanValue);

        String decodedId = ModelAdaptor.decodeId(processDefinition);

        List<Event> events = ds.getInstanceEvents(decodedId, timespan, State.Closed_Completed);
View Full Code Here

Examples of org.jboss.bpm.monitor.model.metric.Timespan

        return createDatasetJSO(
                new String[]{"Completed"}, timespan, true, events);
    }

    public String getFailedInstances4Chart(String processDefinition, String timespanValue) {
        final Timespan timespan = TimespanFactory.fromValue(timespanValue);
        String decodedId = ModelAdaptor.decodeId(processDefinition);

        List<Event> completed = ds.getInstanceEvents(decodedId, timespan, State.Closed_Completed);
        List<Event> failed  = ds.getInstanceEvents(decodedId, timespan, State.Closed_Completed_Failed);
        List<Event> terminated = ds.getInstanceEvents(decodedId, timespan, State.Closed_Cancelled_Terminated);
View Full Code Here

Examples of org.jboss.bpm.monitor.model.metric.Timespan

        String decodedId = ModelAdaptor.decodeId(definitionKey);

        Set<String> instanceIds = new HashSet<String>();

        Timespan chartTimespan = TimespanFactory.fromValue(timespan);
        long[] bounds = TimespanFactory.getLeftBounds(chartTimespan, new Date(timestamp));

        List<Event> events = ds.getInstanceEvents(
                decodedId,
                new Timespan(bounds[0], bounds[1], chartTimespan.getUnit(), "custom"),
                completionState
        );

        // parity matched, only consider actual 'Closed_...' events
        for(Event e : events)
View Full Code Here

Examples of org.jboss.bpm.monitor.model.metric.Timespan

    private Set<String> getInstances(String definitionKey, long timestamp, String timespan, State completionState) {

        Set<String> instanceIds = new HashSet<String>();

        Timespan chartTimespan = TimespanFactory.fromValue(timespan);
        long[] bounds = TimespanFactory.getLeftBounds(chartTimespan, new Date(timestamp));
       
        List<Event> events = dataSource.getInstanceEvents(
                definitionKey,
                new Timespan(bounds[0], bounds[1], chartTimespan.getUnit(), "custom"),
                completionState
        );

        // parity matched, only consider actual 'Closed_...' events
        for(Event e : events)
View Full Code Here

Examples of org.jboss.bpm.monitor.model.metric.Timespan

     */
    public String getCompletedInstances(String processDefiniton, String timespanValue)
    {
        assertDataSource();

        final Timespan timespan = TimespanFactory.fromValue(timespanValue);

        List<Event> events = dataSource.getInstanceEvents(processDefiniton, timespan, State.Closed_Completed);

        return createDatasetJSO(
                new String[]{"Completed"}, timespan, true, events);
View Full Code Here

Examples of org.jboss.bpm.monitor.model.metric.Timespan

     */
    public String getFailedInstances(String processDefiniton, String timespanValue)
    {
        assertDataSource();

        final Timespan timespan = TimespanFactory.fromValue(timespanValue);

        List<Event> completed = dataSource.getInstanceEvents(processDefiniton, timespan, State.Closed_Completed);
        List<Event> failed  = dataSource.getInstanceEvents(processDefiniton, timespan, State.Closed_Completed_Failed);
        List<Event> terminated = dataSource.getInstanceEvents(processDefiniton, timespan, State.Closed_Cancelled_Terminated);

View Full Code Here

Examples of org.linkedin.util.clock.Timespan

    assertFalse(futureWithException.isDone());

    // now we verify that shutdown is still not complete (until both tasks are complete)
    try
    {
      shutdown.waitForShutdown(new Timespan(200));
      fail("should timeout");
    }
    catch(TimeoutException e)
    {
      // expected
    }

    assertFalse(futureWithRes.isDone());
    assertFalse(futureWithException.isDone());

    // we finally unblock the tasks
    o.wakeUp();

    // we get both normal results
    assertEquals(10, (int) futureWithRes.get());
    try
    {
      futureWithException.get();
      fail("MyException should be thrown");
    }
    catch(ExecutionException ex)
    {
      assertTrue(ex.getCause() instanceof MyException);
    }

    // now we should be able to shutdown
    shutdown.waitForShutdown(new Timespan(200));

    executorService.shutdown();
    executorService.awaitTermination(200, TimeUnit.MILLISECONDS);
  }
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.