congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Duration
Code IndexAdd Tabnine to your IDE (free)

How to use
Duration
in
com.nuecho.rivr.core.util

Best Java code snippets using com.nuecho.rivr.core.util.Duration (Showing top 20 results out of 315)

origin: nuecho/rivr

/**
 * Waits for the dialogue thread to end.
 *
 * @param timeout maximum time to wait for the thread to end. A value of
 *            Duration.ZERO (or equivalent) means to wait forever.
 * @throws InterruptedException if the current thread was interrupted while
 *             waiting for the dialogue thread to terminate.
 */
public void join(Duration timeout) throws InterruptedException {
  mDialogueThread.join(timeout.getMilliseconds());
}
origin: nuecho/rivr

duration = Duration.sum(duration, Duration.year(Long.parseLong(yearsMatch)));
duration = Duration.sum(duration, Duration.days(Long.parseLong(daysMatch)));
duration = Duration.sum(duration, Duration.hours(Long.parseLong(hoursMatch)));
duration = Duration.sum(duration, Duration.minutes(Long.parseLong(minutesMatch)));
duration = Duration.sum(duration, Duration.seconds(Long.parseLong(secondsMatch)));
duration = Duration.sum(duration, Duration.milliseconds(Long.parseLong(millisecondsMatch)));
origin: nuecho/rivr

public static Duration sum(Duration a, Duration b) {
  long millisecondsA = a.getMilliseconds();
  long millisecondsB = b.getMilliseconds();
  long allowedMax = Long.MAX_VALUE - millisecondsA;
  if (millisecondsB > allowedMax) throw new AssertionError("Time sum would overflow Long capacity.");
  return new Duration(millisecondsA + millisecondsB);
}
origin: nuecho/rivr

@Override
public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result + ((mDuration == null) ? 0 : mDuration.hashCode());
  return result;
}
origin: nuecho/rivr

  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;
    Pause other = (Pause) obj;
    if (mDuration == null) {
      if (other.mDuration != null) return false;
    } else if (!mDuration.equals(other.mDuration)) return false;
    return true;
  }
}
origin: nuecho/rivr

private static void addRecordingInfo(JsonObject resultObject,
                   VoiceXmlInputTurn voiceXmlInputTurn,
                   Map<String, FileUpload> files) {
  if (!resultObject.containsKey(RECORDING_META_DATA_PROPERTY)) return;
  JsonObject recordingMetaData = resultObject.getJsonObject(RECORDING_META_DATA_PROPERTY);
  Duration duration;
  if (recordingMetaData.containsKey(DURATION_PROPERTY)) {
    long durationInMilliseconds = JsonUtils.getLongProperty(recordingMetaData, DURATION_PROPERTY);
    duration = Duration.milliseconds(durationInMilliseconds);
  } else {
    duration = null;
  }
  boolean maxTime = recordingMetaData.getBoolean(MAX_TIME_PROPERTY, false);
  String dtmfTermChar = recordingMetaData.getString(TERM_CHAR_PROPERTY, null);
  FileUpload file;
  if (!files.containsKey(RECORDING_PARAMETER)) {
    file = null;
  } else {
    file = files.get(RECORDING_PARAMETER);
  }
  voiceXmlInputTurn.setRecordingInfo(new RecordingInfo(file, duration, maxTime, dtmfTermChar));
}
origin: nuecho/rivr

waitForDialoguesToTerminateThread.join(Duration.seconds(10).getMilliseconds());
if (waitForDialoguesToTerminateThread.isAlive()) {
  waitForDialoguesToTerminateThread.interrupt();
  waitForDialoguesToTerminateThread.join(Duration.seconds(2).getMilliseconds());
origin: nuecho/rivr

public static Duration seconds(long seconds) {
  Assert.between(0, seconds, Long.MAX_VALUE / SECOND_IN_MILLIS);
  return new Duration(seconds * SECOND_IN_MILLIS);
}
origin: nuecho/rivr

@Override
public String toString() {
  if (mMilliseconds == 0) return "0 ms";
  StringBuffer buffer = new StringBuffer();
  long value = append(buffer, YEAR_IN_MILLIS, "year", mMilliseconds, true, true);
  value = append(buffer, DAY_IN_MILLIS, "day", value, true, true);
  value = append(buffer, HOUR_IN_MILLIS, "hour", value, true, true);
  value = append(buffer, MINUTE_IN_MILLIS, "minute", value, true, true);
  value = append(buffer, SECOND_IN_MILLIS, "second", value, true, true);
  append(buffer, 1, "millisecond", value, true, true);
  if (mMilliseconds > 1000) {
    buffer.append("(");
    buffer.append(mMilliseconds);
    buffer.append(" ms)");
  }
  return buffer.toString();
}
origin: nuecho/rivr

private Duration getDuration(String key) throws ServletException {
  ServletConfig servletConfig = getServletConfig();
  String duration = servletConfig.getInitParameter(key);
  if (duration == null) return null;
  try {
    return Duration.parse(duration);
  } catch (IllegalArgumentException exception) {
    throw new ServletException("Unable to parse duration for init-arg '" + key + "'", exception);
  }
}
origin: nuecho/rivr

@Override
public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result + ((mName == null) ? 0 : mName.hashCode());
  result = prime * result + ((mTime == null) ? 0 : mTime.hashCode());
  return result;
}
origin: nuecho/rivr

@Override
public boolean equals(Object obj) {
  if (this == obj) return true;
  if (obj == null) return false;
  if (getClass() != obj.getClass()) return false;
  FetchConfiguration other = (FetchConfiguration) obj;
  if (mFetchHint != other.mFetchHint) return false;
  if (mMaxAge == null) {
    if (other.mMaxAge != null) return false;
  } else if (!mMaxAge.equals(other.mMaxAge)) return false;
  if (mMaxStale == null) {
    if (other.mMaxStale != null) return false;
  } else if (!mMaxStale.equals(other.mMaxStale)) return false;
  if (mTimeOut == null) {
    if (other.mTimeOut != null) return false;
  } else if (!mTimeOut.equals(other.mTimeOut)) return false;
  return true;
}
origin: nuecho/rivr

private static void addTransferStatusInfo(JsonObject resultObject, VoiceXmlInputTurn voiceXmlInputTurn) {
  if (!resultObject.containsKey(TRANSFER_PROPERTY)) return;
  JsonObject transferResultObject = resultObject.getJsonObject(TRANSFER_PROPERTY);
  TransferStatus transferStatus = new TransferStatus(transferResultObject.getString(TRANSFER_STATUS_PROPERTY));
  long durationValue;
  if (transferResultObject.containsKey(TRANSFER_DURATION_PROPERTY)) {
    durationValue = JsonUtils.getLongProperty(transferResultObject, TRANSFER_DURATION_PROPERTY);
  } else {
    durationValue = 0;
  }
  Duration duration = Duration.milliseconds(durationValue);
  voiceXmlInputTurn.setTransferResult(new TransferStatusInfo(transferStatus, duration));
}
origin: nuecho/rivr

public static Duration minutes(long minutes) {
  Assert.between(0, minutes, Long.MAX_VALUE / MINUTE_IN_MILLIS);
  return new Duration(minutes * MINUTE_IN_MILLIS);
}
origin: nuecho/rivr

public static void addDurationProperty(JsonObjectBuilder builder, String propertyName, Duration duration) {
  if (duration == null) {
    builder.addNull(propertyName);
  } else {
    builder.add(propertyName, duration.getMilliseconds());
  }
}
origin: nuecho/rivr

@Override
public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result + (mFetchHint == null ? 0 : mFetchHint.hashCode());
  result = prime * result + (mMaxAge == null ? 0 : mMaxAge.hashCode());
  result = prime * result + (mMaxStale == null ? 0 : mMaxStale.hashCode());
  result = prime * result + (mTimeOut == null ? 0 : mTimeOut.hashCode());
  return result;
}
origin: nuecho/rivr

@Override
public boolean equals(Object obj) {
  if (this == obj) return true;
  if (obj == null) return false;
  if (getClass() != obj.getClass()) return false;
  MarkInfo other = (MarkInfo) obj;
  if (mName == null) {
    if (other.mName != null) return false;
  } else if (!mName.equals(other.mName)) return false;
  if (mTime == null) {
    if (other.mTime != null) return false;
  } else if (!mTime.equals(other.mTime)) return false;
  return true;
}
origin: nuecho/rivr

private void addRecognitionInfo(JsonObject jsonObject, VoiceXmlInputTurn voiceXmlInputTurn) {
  if (!jsonObject.containsKey(RECOGNITION_PROPERTY)) return;
  JsonObject recognitionObject = jsonObject.getJsonObject(RECOGNITION_PROPERTY);
  JsonArray recognitionResultArray = recognitionObject.getJsonArray(RESULT_PROPERTY);
  MarkInfo markInfo = null;
  if (recognitionObject.containsKey(MARK_PROPERTY)) {
    JsonObject markObject = recognitionObject.getJsonObject(MARK_PROPERTY);
    long timeInMilliseconds = JsonUtils.getLongProperty(markObject, MARK_TIME_PROPERTY);
    markInfo = new MarkInfo(markObject.getString(MARK_NAME_PROPERTY), Duration.milliseconds(timeInMilliseconds));
  }
  voiceXmlInputTurn.setRecognitionInfo(new RecognitionInfo(recognitionResultArray, markInfo));
}
origin: nuecho/rivr

public static Duration hours(long hours) {
  Assert.between(0, hours, Long.MAX_VALUE / HOUR_IN_MILLIS);
  return new Duration(hours * HOUR_IN_MILLIS);
}
origin: nuecho/rivr

public static void addDurationProperty(Element parent, String propertyName, Duration value) {
  if (value != null) {
    addProperty(parent, propertyName, value.getMilliseconds() + MILLISECOND_UNIT_SUFFIX);
  }
}
com.nuecho.rivr.core.utilDuration

Javadoc

Represents a delta of time.

Most used methods

  • getMilliseconds
  • milliseconds
  • <init>
  • append
  • days
  • equals
  • hashCode
  • hours
  • minutes
  • parse
  • seconds
  • sum
  • seconds,
  • sum,
  • year

Popular in Java

  • Start an intent from android
  • setContentView (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • requestLocationUpdates (LocationManager)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now