Codota Logo
Time
Code IndexAdd Codota to your IDE (free)

How to use
Time
in
org.diirt.vtype

Best Java code snippets using org.diirt.vtype.Time (Showing top 6 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: org.diirt/datasource-sample

private void setTime(Time time) {
  if (time == null) {
    pvTime.setText("");
  } else {
    pvTime.setText(time.getTimestamp().toString());
  }
}
origin: org.diirt/vtype-json

public JsonVTypeBuilder addTime(Time time) {
  return add("time", new JsonVTypeBuilder()
      .add("unixSec", time.getTimestamp().getEpochSecond())
      .add("nanoSec", time.getTimestamp().getNano())
      .addNullableObject("userTag", time.getTimeUserTag()));
}
origin: org.diirt/datasource-vtype

private void prune() {
  // Remove all values that are too old
  TimeInterval periodAllowed = TimeInterval.before(cachedPeriod, buffer.getLast().getTimestamp());
  while (!buffer.isEmpty() && !periodAllowed.contains(buffer.getFirst().getTimestamp())) {
    // Discard value
    buffer.removeFirst();
  }
}
origin: org.diirt/datasource-sample

private String timeStampOf(Object value) {
  if (value == null)
    return "";
  return ValueUtil.timeOf(value).getTimestamp().toString();
}
origin: org.diirt/datasource-vtype

static <T extends Time> Instant electReferenceTimeStamp(List<ReadFunction<List<T>>> collectors) {
  for (ReadFunction<List<T>> collector : collectors) {
    List<T> data = collector.readValue();
    if (data.size() > 1) {
      Instant time = data.get(data.size() - 2).getTimestamp();
      if (time != null)
        return time;
    }
  }
  return null;
}
origin: org.diirt/datasource-vtype

static <T extends Time> T closestElement(List<T> data, TimeInterval interval, Instant reference) {
  StringBuilder buffer = new StringBuilder();
  T latest = null;
  long latestDistance = Long.MAX_VALUE;
  for (T value : data) {
    Instant newTime = value.getTimestamp();
    if (log.isLoggable(Level.FINEST)) {
      buffer.append(newTime.getNano()).append(", ");
    }
    if (interval.contains(newTime)) {
      if (latest == null) {
        latest = value;
        latestDistance = Math.abs(reference.until(newTime, ChronoUnit.NANOS));
      } else {
        long newDistance = Math.abs(reference.until(newTime, ChronoUnit.NANOS));
        if (newDistance < latestDistance) {
          latest = value;
          latestDistance = newDistance;
        }
      }
    }
  }
  if (log.isLoggable(Level.FINEST)) {
    buffer.append("[").append(latest.getTimestamp().getNano()).append("|").append(reference.getNano()).append("]");
    log.finest(buffer.toString());
  }
  return latest;
}
org.diirt.vtypeTime

Most used methods

  • getTimestamp
  • getTimeUserTag

Popular in Java

  • Reading from database using SQL prepared statement
  • notifyDataSetChanged (ArrayAdapter)
  • onCreateOptionsMenu (Activity)
  • onRequestPermissionsResult (Fragment)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • IOException (java.io)
    Signals that an I/O exception of some sort has occurred. This class is the general class of exceptio
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • TimerTask (java.util)
    A task that can be scheduled for one-time or repeated execution by a Timer.
  • JButton (javax.swing)
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now