Examples of Tick


Examples of com.mdimension.jchronic.utils.Tick

  protected Span _nextSpan(PointerType pointer) {
    int halfDay = RepeaterDay.DAY_SECONDS / 2;
    int fullDay = RepeaterDay.DAY_SECONDS;

    Calendar now = getNow();
    Tick tick = getType();
    boolean first = false;
    if (_currentTime == null) {
      first = true;
      Calendar midnight = Time.ymd(now);
      Calendar yesterdayMidnight = Time.cloneAndAdd(midnight, Calendar.SECOND, -fullDay);
      Calendar tomorrowMidnight = Time.cloneAndAdd(midnight, Calendar.SECOND, fullDay);
      boolean done = false;
      if (pointer == Pointer.PointerType.FUTURE) {
        if (tick.isAmbiguous()) {
          List<Calendar> futureDates = new LinkedList<Calendar>();
          futureDates.add(Time.cloneAndAdd(midnight, Calendar.SECOND, tick.intValue()));
          futureDates.add(Time.cloneAndAdd(midnight, Calendar.SECOND, halfDay + tick.intValue()));
          futureDates.add(Time.cloneAndAdd(tomorrowMidnight, Calendar.SECOND, tick.intValue()));
          for (Calendar futureDate : futureDates) {
            if (futureDate.after(now) || futureDate.equals(now)) {
              _currentTime = futureDate;
              done = true;
              break;
            }
          }
        }
        else {
          List<Calendar> futureDates = new LinkedList<Calendar>();
          futureDates.add(Time.cloneAndAdd(midnight, Calendar.SECOND, tick.intValue()));
          futureDates.add(Time.cloneAndAdd(tomorrowMidnight, Calendar.SECOND, tick.intValue()));
          for (Calendar futureDate : futureDates) {
            if (futureDate.after(now) || futureDate.equals(now)) {
              _currentTime = futureDate;
              done = true;
              break;
            }
          }
        }
      }
      else {
        if (tick.isAmbiguous()) {
          List<Calendar> pastDates = new LinkedList<Calendar>();
          pastDates.add(Time.cloneAndAdd(midnight, Calendar.SECOND, halfDay + tick.intValue()));
          pastDates.add(Time.cloneAndAdd(midnight, Calendar.SECOND, tick.intValue()));
          pastDates.add(Time.cloneAndAdd(yesterdayMidnight, Calendar.SECOND, tick.intValue() * 2));
          for (Calendar pastDate : pastDates) {
            if (pastDate.before(now) || pastDate.equals(now)) {
              _currentTime = pastDate;
              done = true;
              break;
            }
          }
        }
        else {
          List<Calendar> pastDates = new LinkedList<Calendar>();
          pastDates.add(Time.cloneAndAdd(midnight, Calendar.SECOND, tick.intValue()));
          pastDates.add(Time.cloneAndAdd(yesterdayMidnight, Calendar.SECOND, tick.intValue()));
          for (Calendar pastDate : pastDates) {
            if (pastDate.before(now) || pastDate.equals(now)) {
              _currentTime = pastDate;
              done = true;
              break;
            }
          }
        }
      }

      if (!done && _currentTime == null) {
        throw new IllegalStateException("Current time cannot be null at this point.");
      }
    }

    if (!first) {
      int increment = (tick.isAmbiguous()) ? halfDay : fullDay;
      int direction = (pointer == Pointer.PointerType.FUTURE) ? 1 : -1;
      _currentTime.add(Calendar.SECOND, direction * increment);
    }

    return new Span(_currentTime, Time.cloneAndAdd(_currentTime, Calendar.SECOND, getWidth()));
View Full Code Here

Examples of com.positive.charts.axis.ticks.Tick

        } else if ((edge == RectangleEdge.LEFT)
            || (edge == RectangleEdge.RIGHT)) {
          max = Math.max(max, this.calculateTextBlockWidth(label,
              position, g2));
        }
        final Tick tick = new CategoryTick(category, label, position
            .getLabelAnchor(), position.getRotationAnchor(),
            position.getAngle());
        ticks.add(tick);
        categoryIndex = categoryIndex + 1;
      }
View Full Code Here

Examples of er.chronic.utils.Tick

  private static final Pattern TIME_PATTERN = Pattern.compile("^\\d{1,2}(:?\\d{2})?([\\.:]?\\d{2})?$");

  public RepeaterTime(String time) {
    super(null);
    String t = time.replaceAll(":", "");
    Tick type;
    int length = t.length();
    if (length <= 2) {
      int hours = Integer.parseInt(t);
      int hoursInSeconds = hours * 60 * 60;
      if (hours == 12) {
        type = new Tick(0 * 60 * 60, true);
      }
      else {
        type = new Tick(hoursInSeconds, true);
      }
    }
    else if (length == 3) {
      int hoursInSeconds = Integer.parseInt(t.substring(0, 1)) * 60 * 60;
      int minutesInSeconds = Integer.parseInt(t.substring(1)) * 60;
      type = new Tick(hoursInSeconds + minutesInSeconds, true);
    }
    else if (length == 4) {
      // DIFF: we need to support 05:45 vs 5:45
      //boolean ambiguous = (time.contains(":") && Integer.parseInt(t.substring(0, 1) != 0 && Integer.parseInt(t.substring(0, 2)) <= 12);
      boolean ambiguous = (time.contains(":") && Integer.parseInt(t.substring(0, 2)) <= 12);
      int hours = Integer.parseInt(t.substring(0, 2));
      int hoursInSeconds = hours * 60 * 60;
      int minutesInSeconds = Integer.parseInt(t.substring(2)) * 60;
      if (hours == 12) {
        type = new Tick(0 * 60 * 60 + minutesInSeconds, ambiguous);
      }
      else {
        type = new Tick(hoursInSeconds + minutesInSeconds, ambiguous);
      }
    }
    else if (length == 5) {
      int hoursInSeconds = Integer.parseInt(t.substring(0, 1)) * 60 * 60;
      int minutesInSeconds = Integer.parseInt(t.substring(1, 3)) * 60;
      int seconds = Integer.parseInt(t.substring(3));
      type = new Tick(hoursInSeconds + minutesInSeconds + seconds, true);
    }
    else if (length == 6) {
      // DIFF: we need to support 05:45 vs 5:45
      //boolean ambiguous = (time.contains(":") && Integer.parseInt(t.substring(0, 1)) != 0 && Integer.parseInt(t.substring(0, 2)) <= 12);
      boolean ambiguous = (time.contains(":") && Integer.parseInt(t.substring(0, 2)) <= 12);
      int hours = Integer.parseInt(t.substring(0, 2));
      int hoursInSeconds = hours * 60 * 60;
      int minutesInSeconds = Integer.parseInt(t.substring(2, 4)) * 60;
      int seconds = Integer.parseInt(t.substring(4, 6));
      //type = new Tick(hoursInSeconds + minutesInSeconds + seconds, ambiguous);
      if (hours == 12) {
        type = new Tick(0 * 60 * 60 + minutesInSeconds + seconds, ambiguous);
      }
      else {
        type = new Tick(hoursInSeconds + minutesInSeconds + seconds, ambiguous);
      }
    }
    else {
      throw new IllegalArgumentException("Time cannot exceed six digits");
    }
View Full Code Here

Examples of er.chronic.utils.Tick

  protected Span _nextSpan(PointerType pointer) {
    int halfDay = RepeaterDay.DAY_SECONDS / 2;
    int fullDay = RepeaterDay.DAY_SECONDS;

    Calendar now = getNow();
    Tick tick = getType();
    boolean first = false;
    if (_currentTime == null) {
      first = true;
      Calendar midnight = Time.ymd(now);
      Calendar yesterdayMidnight = Time.cloneAndAdd(midnight, Calendar.SECOND, -fullDay);
      Calendar tomorrowMidnight = Time.cloneAndAdd(midnight, Calendar.SECOND, fullDay);
     
      int offsetFix = (midnight.get(Calendar.ZONE_OFFSET) - tomorrowMidnight.get(Calendar.ZONE_OFFSET)) / 1000;
      tomorrowMidnight.add(Calendar.SECOND, offsetFix);

      boolean done = false;
      if (pointer == Pointer.PointerType.FUTURE) {
        if (tick.isAmbiguous()) {
          List<Calendar> futureDates = new LinkedList<Calendar>();
          futureDates.add(Time.cloneAndAdd(midnight, Calendar.SECOND, tick.intValue() + offsetFix));
          futureDates.add(Time.cloneAndAdd(midnight, Calendar.SECOND, halfDay + tick.intValue() + offsetFix));
          futureDates.add(Time.cloneAndAdd(tomorrowMidnight, Calendar.SECOND, tick.intValue()));
          for (Calendar futureDate : futureDates) {
            if (futureDate.after(now) || futureDate.equals(now)) {
              _currentTime = futureDate;
              done = true;
              break;
            }
          }
        }
        else {
          List<Calendar> futureDates = new LinkedList<Calendar>();
          futureDates.add(Time.cloneAndAdd(midnight, Calendar.SECOND, tick.intValue() + offsetFix));
          futureDates.add(Time.cloneAndAdd(tomorrowMidnight, Calendar.SECOND, tick.intValue()));
          for (Calendar futureDate : futureDates) {
            if (futureDate.after(now) || futureDate.equals(now)) {
              _currentTime = futureDate;
              done = true;
              break;
            }
          }
        }
      }
      else {
        if (tick.isAmbiguous()) {
          List<Calendar> pastDates = new LinkedList<Calendar>();
          pastDates.add(Time.cloneAndAdd(midnight, Calendar.SECOND, halfDay + tick.intValue() + offsetFix));
          pastDates.add(Time.cloneAndAdd(midnight, Calendar.SECOND, tick.intValue() + offsetFix));
          pastDates.add(Time.cloneAndAdd(yesterdayMidnight, Calendar.SECOND, tick.intValue() + halfDay));
          for (Calendar pastDate : pastDates) {
            if (pastDate.before(now) || pastDate.equals(now)) {
              _currentTime = pastDate;
              done = true;
              break;
            }
          }
        }
        else {
          List<Calendar> pastDates = new LinkedList<Calendar>();
          pastDates.add(Time.cloneAndAdd(midnight, Calendar.SECOND, tick.intValue() + offsetFix));
          pastDates.add(Time.cloneAndAdd(yesterdayMidnight, Calendar.SECOND, tick.intValue()));
          for (Calendar pastDate : pastDates) {
            if (pastDate.before(now) || pastDate.equals(now)) {
              _currentTime = pastDate;
              done = true;
              break;
            }
          }
        }
      }

      if (!done && _currentTime == null) {
        throw new IllegalStateException("Current time cannot be null at this point.");
      }
    }

    if (!first) {
      int increment = (tick.isAmbiguous()) ? halfDay : fullDay;
      int direction = (pointer == Pointer.PointerType.FUTURE) ? 1 : -1;
      _currentTime.add(Calendar.SECOND, direction * increment);
    }

    return new Span(_currentTime, Time.cloneAndAdd(_currentTime, Calendar.SECOND, getWidth()));
View Full Code Here

Examples of models.Tick

        Application application = new DefaultApplication(new File(args[0]), TickJob.class.getClassLoader(), null, Mode.Prod());

        Play.start(application);

        Tick tick = new Tick("Hello from the TickJob");
        tick.save();
       
        Play.stop();
    }
View Full Code Here

Examples of models.Tick

import java.util.List;

public class Application extends Controller {

    public static Result index() {
        Tick tick = new Tick("Hello from the Application Controller");
        tick.save();
        List<Tick> ticks = new Model.Finder(Long.class, Tick.class).all();
        return ok(views.html.index.render(ticks));
    }
View Full Code Here

Examples of org.akka.essentials.unittest.actors.TickTock.Tick

  @Test
  public void testTwo() throws Exception {
    TestActorRef<TickTock> actorRef = TestActorRef.apply(new Props(
        TickTock.class), _system);

    String result = (String) Await.result(ask(actorRef, new Tick("msg"), 5000),
        Duration.parse("5 second"));

    Assert.assertEquals("processed the tick message", result);
  }
View Full Code Here

Examples of org.goda.chronic.utils.Tick

  private static final String TIME_PATTERN = "^\\d{1,2}(:?\\d{2})?([\\.:]?\\d{2})?$";

  public RepeaterTime(String time) {
    super(null);
    String t = time.replaceAll(":", "");
    Tick type;
    int length = t.length();
    if (length <= 2) {
      double hours = Double.parseDouble(t);
      int hoursInSeconds = (int) Math.round(hours * 60D * 60D);
      if (hours == 12) {
        type = new Tick(0 * 60 * 60, true);
      }
      else {
        type = new Tick(hoursInSeconds, true);
      }
    }
    else if (length == 3) {
      int hoursInSeconds = (int) (Double.parseDouble(t.substring(0, 1)) * 60 * 60);
      int minutesInSeconds = (int) (Double.parseDouble(t.substring(1)) * 60D);
      type = new Tick(hoursInSeconds + minutesInSeconds, true);
    }
    else if (length == 4) {
      boolean ambiguous = (time.contains(":") && Integer.parseInt(t.substring(0, 1)) != 0 && Integer.parseInt(t.substring(0, 2)) <= 12);
      double hours = Double.parseDouble(t.substring(0, 2));
      int hoursInSeconds = (int)(hours * 60 * 60);
      int minutesInSeconds = (int)(Double.parseDouble(t.substring(2)) * 60);
      if (hours == 12) {
        type = new Tick(0 * 60 * 60 + minutesInSeconds, ambiguous);
      }
      else {
        type = new Tick(hoursInSeconds + minutesInSeconds, ambiguous);
      }
    }
    else if (length == 5) {
      int hoursInSeconds = (int)(Double.parseDouble(t.substring(0, 1)) * 60 * 60);
      int minutesInSeconds =(int)(Double.parseDouble(t.substring(1, 3)) * 60);
      int seconds = (int) Double.parseDouble(t.substring(3));
      type = new Tick(hoursInSeconds + minutesInSeconds + seconds, true);
    }
    else if (length == 6) {
      boolean ambiguous = (time.contains(":") && Integer.parseInt(t.substring(0, 1)) != 0 && Integer.parseInt(t.substring(0, 2)) <= 12);
      int hours = Integer.parseInt(t.substring(0, 2));
      int hoursInSeconds = hours * 60 * 60;
      int minutesInSeconds = Integer.parseInt(t.substring(2, 4)) * 60;
      int seconds = Integer.parseInt(t.substring(4, 6));
      //type = new Tick(hoursInSeconds + minutesInSeconds + seconds, ambiguous);
      if (hours == 12) {
        type = new Tick(0 * 60 * 60 + minutesInSeconds + seconds, ambiguous);
      }
      else {
        type = new Tick(hoursInSeconds + minutesInSeconds + seconds, ambiguous);
      }
    }
    else {
      throw new IllegalArgumentException("Time cannot exceed six digits");
    }
View Full Code Here

Examples of org.goda.chronic.utils.Tick

  protected MutableInterval _nextMutableInterval(PointerType pointer) {
    int halfDay = RepeaterDay.DAY_SECONDS / 2;
    int fullDay = RepeaterDay.DAY_SECONDS;

    DateTime now = getNow();
    Tick tick = getType();
    boolean first = false;
    if (_currentTime == null) {
      first = true;
      DateTime midnight = Time.ymd(now);
      DateTime yesterdayMidnight = midnight.minusSeconds(fullDay);
      DateTime tomorrowMidnight = midnight.plusSeconds(fullDay);
      boolean done = false;
      if (pointer == Pointer.PointerType.FUTURE) {
        if (tick.isAmbiguous()) {
          List<DateTime> futureDates = new LinkedList<DateTime>();
          futureDates.add( midnight.plusSeconds(tick.intValue()));
          futureDates.add(midnight.plusSeconds( halfDay + tick.intValue()));
          futureDates.add(tomorrowMidnight.plusSeconds(tick.intValue()));
          for (DateTime futureDate : futureDates) {
            if (futureDate.getMillis() > now.getMillis() || futureDate.equals(now)) {
              _currentTime = futureDate;
              done = true;
              break;
            }
          }
        }
        else {
          List<DateTime> futureDates = new LinkedList<DateTime>();
          futureDates.add(midnight.plusSeconds(tick.intValue()));
          futureDates.add(tomorrowMidnight.plusSeconds(tick.intValue()));
          for (DateTime futureDate : futureDates) {
            if (futureDate.getMillis() > now.getMillis() || futureDate.equals(now)) {
              _currentTime = futureDate;
              done = true;
              break;
            }
          }
        }
      }
      else {
        if (tick.isAmbiguous()) {
          List<DateTime> pastDates = new LinkedList<DateTime>();
          pastDates.add(midnight.plusSeconds(halfDay + tick.intValue()));
          pastDates.add(midnight.plusSeconds(tick.intValue()));
          pastDates.add(yesterdayMidnight.plusSeconds(tick.intValue() * 2));
          for (DateTime pastDate : pastDates) {
            if (pastDate.getMillis() > now.getMillis() || pastDate.equals(now)) {
              _currentTime = pastDate;
              done = true;
              break;
            }
          }
        }
        else {
          List<DateTime> pastDates = new LinkedList<DateTime>();
          pastDates.add(midnight.plusSeconds( tick.intValue()));
          pastDates.add(yesterdayMidnight.plusSeconds( tick.intValue()));
          for (DateTime pastDate : pastDates) {
            if (pastDate.getMillis() > now.getMillis() || pastDate.equals(now)) {
              _currentTime = pastDate;
              done = true;
              break;
            }
          }
        }
      }

      if (!done && _currentTime == null) {
        throw new IllegalStateException("Current time cannot be null at this point.");
      }
    }

    if (!first) {
      int increment = (tick.isAmbiguous()) ? halfDay : fullDay;
      int direction = (pointer == Pointer.PointerType.FUTURE) ? 1 : -1;
      _currentTime = _currentTime.plusSeconds( direction * increment);
    }

    return new MutableInterval(_currentTime, _currentTime.plusSeconds(getWidth()));
View Full Code Here

Examples of org.jboss.errai.cdi.demo.stock.client.shared.Tick

    for (Map.Entry<String, TickCache> tickEntry : tickCaches.entrySet()) {
      if (random.nextInt(1000) > 200) {
        continue;
      }
      TickCache tickCache = tickEntry.getValue();
      Tick newTick = generateTick(tickCache.getNewestEntry());
      tickCache.add(newTick);
      tickEvent.fire(newTick);
    }
  }
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.