Package com.esri.gpt.framework.util.TimePeriod

Examples of com.esri.gpt.framework.util.TimePeriod.Unit


  long value = getValue();
  StringBuilder sb = new StringBuilder();

  Unit[] vals = Unit.values();
  for (int i = vals.length - 1; i >= 0; i--) {
    Unit u = vals[i];
    if (!u.isToStringeable())
      continue;
    if (value >= u.getMilliseconds()) {
      long part = value / u.getMilliseconds();
      value = value % u.getMilliseconds();
      if (sb.length() > 0)
        sb.append(", ");
        sb.append(Long.toString(part)).append(" ").append(u.name().toLowerCase()).append(part > 1 ? "s" : "");
    }
  }

  return sb.length() > 0 ? sb.toString() : "0";
}
View Full Code Here


  StringBuilder sb = new StringBuilder();

  Unit[] vals = Unit.values();

  for (int i = vals.length - 1; i >= 0; i--) {
    Unit u = vals[i];
    if (!u.isToLocalizedStringeable())
      continue;
    if (value >= u.getMilliseconds()) {
      long part = value / u.getMilliseconds();
      value = value % u.getMilliseconds();
      if (part>0) {
        String resKey = u.getResourceKey();
        if (part>1) {
          resKey += "s"; // for plural
        }
        String message = mb.retrieveMessage(resKey, new String[]{Long.toString(part)});
        if (message.length()>0) {
View Full Code Here

* @param value value
* @return provider or <code>null</code> if can not be parsed
*/
public static WaitTimeProvider parse(String value) {
  value = Val.chkStr(value).toLowerCase();
  Unit unit = null;

  for (Unit u : Unit.values()) {
    String patternDef =
        "\\[\\p{Blank}*" + u.name().toLowerCase() + "\\p{Blank}*\\]";
    Pattern pattern = Pattern.compile(patternDef);
View Full Code Here

TOP

Related Classes of com.esri.gpt.framework.util.TimePeriod.Unit

Copyright © 2018 www.massapicom. 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.