예제 #1
0
  // Extracts the number value form String
  public static int decimalToInt(String string) {
    try {
      int i = string.indexOf('.');
      if (i < 0) {
        return Integer.parseInt(string) * 1000;

      } else {
        int value = Integer.parseInt(string.substring(0, i)) * 1000;
        string = string.substring(i + 1, Math.min(string.length(), i + 1 + 3));
        while (string.length() < 3) {
          string = string + "0";
        }
        return value + Integer.parseInt(string);
      }
    } catch (Exception ignored) {
      return 0;
    }
  }
예제 #2
0
  public void __setStatus(String resource, int priority, byte index, String statusText) {
    if (StatusInfo.STATUS_OFFLINE == index) {
      resource = StringUtils.notNull(resource);
      if (resource.equals(currentResource)) {
        currentResource = null;
      }
      removeSubContact(resource);
      if (0 == subContacts.size()) {
        setOfflineStatus();
      }

    } else {
      SubContact c = getSubContact(resource);
      c.priority = (byte) Math.min(127, Math.max(priority, -127));
      c.status = index;
      c.statusText = statusText;
    }
  }