public void run() {
    try {
      while (true) {
        String message = in.readLine();

        if (message.equals("mousePressed")) {
          try {
            String x = in.readLine();
            String y = in.readLine();
            String flag = in.readLine();
            String re = in.readLine();
            String gree = in.readLine();
            String blac = in.readLine();
            String size = in.readLine();
            int x_ = Integer.parseInt(x);
            int y_ = Integer.parseInt(y);
            int red = Integer.parseInt(re);
            int green = Integer.parseInt(gree);
            int black = Integer.parseInt(blac);
            flagtool = Integer.parseInt(flag);
            border = Integer.parseInt(size);
            flagcolor = new Color(red, green, black);
            onePoint pp1 = new onePoint(x_, y_, flagtool, flagcolor, border);
            points.add(pp1);
            repaint();
          } catch (Exception ex) {
            ex.getSuppressed();
          }
        } else if (message.equals("mouseReleased")) {
          String isPen = in.readLine();
          if (isPen.equals("isPen")) {
            if (isEraser == 0) points.addElement(new onePoint(-1, -1, 22, flagcolor, border));
            else if (isEraser == 1) points.addElement(new onePoint(-1, -1, 22, Color.WHITE, 6 * 2));
          } else {
            String x = in.readLine();
            String y = in.readLine();
            String flag = in.readLine();
            String re = in.readLine();
            String gree = in.readLine();
            String blac = in.readLine();
            String size = in.readLine();
            try {
              int x_ = Integer.parseInt(x);
              int y_ = Integer.parseInt(y);
              int red = Integer.parseInt(re);
              int green = Integer.parseInt(gree);
              int black = Integer.parseInt(blac);
              flagtool = Integer.parseInt(flag);
              border = Integer.parseInt(size);
              flagcolor = new Color(red, green, black);
              onePoint pp1 = new onePoint(x_, y_, flagtool, flagcolor, border);
              points.addElement(pp1);
              points.add(new onePoint(-1, -1, 22, flagcolor, border));
              repaint();
            } catch (NumberFormatException e) {
              e.getSuppressed();
            }
          }
        } else if (message.equals("itemStateChanged")) {
          String item = in.readLine();
          if (item.equals("colorchoice")) {
            String color = in.readLine();
            if (color.equals("black")) flagcolor = new Color(0, 0, 0);
            else if (color.equals("red")) flagcolor = new Color(255, 0, 0);
            else if (color.equals("blue")) flagcolor = new Color(0, 0, 255);
            else if (color.equals("green")) flagcolor = new Color(0, 255, 0);

          } else if (item.equals("sizechoice")) {
            String size = in.readLine();
            if (size.equals("1")) {
              border = 1;
            } else if (size.equals("2")) border = 2 * 2;
            else if (size.equals("4")) border = 4 * 2;
            else if (size.equals("6")) border = 6 * 2;
            else if (size.equals("8")) border = 8 * 2;
          }
        } else if (message.equals("actionPerformed")) {
          String ispen = in.readLine();
          if (ispen.equals("pen")) {
            flagtool = 0;
            isEraser = 0;
          } else if (ispen.equals("line")) {
            flagtool = 1;
          } else if (ispen.equals("clear")) {
            flagtool = 2;
            points.removeAllElements();
            repaint();
          } else if (ispen.equals("ellipse")) {
            flagtool = 3;
          } else if (ispen.equals("rect")) {
            flagtool = 4;
          } else if (ispen.equals("colorboard")) {
            try {
              String red = in.readLine();
              String green = in.readLine();
              String blue = in.readLine();
              flagcolor =
                  new Color(Integer.parseInt(red), Integer.parseInt(green), Integer.parseInt(blue));

            } catch (Exception e) {
              e.getSuppressed();
            }
          } else if (ispen.equals("eraser")) {
            flagtool = 0;
            isEraser = 1;
          }
        } else if (message.equals("mouseDragged")) {
          String a = in.readLine();
          if (a.equals("0")) {
            try {
              String x = in.readLine();
              String y = in.readLine();
              String flag = in.readLine();
              String red = in.readLine();
              String green = in.readLine();
              String blue = in.readLine();
              String bord = in.readLine();
              int x_ = Integer.parseInt(x);
              int y_ = Integer.parseInt(y);
              flagtool = Integer.parseInt(flag);
              flagcolor =
                  new Color(Integer.parseInt(red), Integer.parseInt(green), Integer.parseInt(blue));
              border = Integer.parseInt(bord);
              onePoint pp = new onePoint(x_, y_, flagtool, flagcolor, border);
              points.addElement(pp);
              repaint();
            } catch (Exception e) {
              e.getSuppressed();
            }
          } else if (a.equals("1")) {
            try {
              String x = in.readLine();
              String y = in.readLine();
              String flag = in.readLine();
              String red = in.readLine();
              String green = in.readLine();
              String blue = in.readLine();
              String bord = in.readLine();
              int x_ = Integer.parseInt(x);
              int y_ = Integer.parseInt(y);
              flagtool = Integer.parseInt(flag);
              flagcolor =
                  new Color(Integer.parseInt(red), Integer.parseInt(green), Integer.parseInt(blue));
              border = Integer.parseInt(bord);
              onePoint pp = new onePoint(x_, y_, flagtool, flagcolor, border);
              points.add(pp);
              repaint();
            } catch (Exception e) {
              e.getSuppressed();
            }
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  /**
   * read the transition matrix from the file
   *
   * @param fp
   * @return
   */
  public static Map<Integer, Set<Integer>> readTransitionMatrix(String fp) {
    Map<Integer, Set<Integer>> res = new HashMap<Integer, Set<Integer>>();

    if (fp == null || fp.length() == 0) return res;

    try {
      BufferedReader reader =
          new BufferedReader(new InputStreamReader(new FileInputStream(new File(fp))));

      String line = null;
      while ((line = reader.readLine()) != null) {
        String[] fields = line.split(" ");
        int from = Integer.parseInt(fields[0]);
        int to = Integer.parseInt(fields[1]);

        if (res.containsKey(from)) {
          res.get(from).add(to);
        } else {
          Set<Integer> cset = new HashSet<Integer>();
          cset.add(to);

          res.put(from, cset);
        }
      }
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (NumberFormatException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }

    return Collections.unmodifiableMap(res);
  }
  /**
   * 数据解包,解包顺序参见<A href ={@docRoot}/dataStructure/tb.html#PrpLECRecommendation>历史记账凭证主表信息</A>表字段
   *
   * @param: strMessage String 包含一条纪录数据的字符串
   * @return: boolean
   */
  public boolean decode(String strMessage) {
    try {
      recommend = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 1, SysConst.PACKAGESPILTER);
      recommended = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 2, SysConst.PACKAGESPILTER);
      sendtimes =
          new Integer(ChgData.chgNumericStr(StrTool.getStr(strMessage, 3, SysConst.PACKAGESPILTER)))
              .intValue();
      success = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 4, SysConst.PACKAGESPILTER);
      registered = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 5, SysConst.PACKAGESPILTER);
      field1 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 6, SysConst.PACKAGESPILTER);
      field2 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 7, SysConst.PACKAGESPILTER);
      field3 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 8, SysConst.PACKAGESPILTER);
      makedate = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 9, SysConst.PACKAGESPILTER);
      maketime = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 10, SysConst.PACKAGESPILTER);
      modifydate = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 11, SysConst.PACKAGESPILTER);
      modifytime = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 12, SysConst.PACKAGESPILTER);
    } catch (NumberFormatException ex) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LECRecommendationSchema";
      tError.functionName = "decode";
      tError.errorMessage = ex.toString();
      this.mErrors.addOneError(tError);

      return false;
    }
    return true;
  }
示例#4
0
  private void save_buttonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_save_buttonActionPerformed
    for (int i = 0; i < rubric_table.getColumnCount(); i++) {
      try {
        GradeAccess.enterGrade(
            studentID,
            courseID,
            actName,
            rubric_table.getModel().getValueAt(i, 0).toString(),
            Float.parseFloat(rubric_table.getModel().getValueAt(i, 1).toString()));
      } catch (NumberFormatException e) {
        e.printStackTrace();
      } catch (SQLException e) {
        GradeAccess.updateGrade(
            studentID,
            courseID,
            actName,
            rubric_table.getModel().getValueAt(i, 0).toString(),
            Float.parseFloat(rubric_table.getModel().getValueAt(i, 1).toString()));
      }
    }

    try {
      PrintWriter out = new PrintWriter(paths[0] + "/" + studentID + "/" + actName + ".py");
      out.write(submission_text_area.getText());
      out.close();
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
    setOkToNav();
    JOptionPane.showMessageDialog(this, "Grade and comments saved.");
  } // GEN-LAST:event_save_buttonActionPerformed
示例#5
0
 public static void main(String[] args) {
   int n = 0;
   int m = 0;
   while (true) {
     try {
       BufferedReader sisse = new BufferedReader(new InputStreamReader(System.in));
       System.out.println("V2ljumiseks vajutage ctrl-C");
       System.out.print("Laste arv: ");
       String s = sisse.readLine();
       n = Integer.parseInt(s);
       if (n < 0) throw new IllegalArgumentException(String.valueOf(n));
       System.out.print("6unte arv: ");
       s = sisse.readLine();
       m = Integer.parseInt(s);
       if (m < 0) throw new IllegalArgumentException(String.valueOf(m));
       System.out.println(
           "Igale lapsele "
               + String.valueOf(m / n)
               + " 6una ja "
               + String.valueOf(m % n)
               + " j22b yle");
     } catch (NumberFormatException e) {
       System.out.println("Ei ole arv: " + e.toString());
     } catch (ArithmeticException e) {
       System.out.println("Aritmeetikakatkestus: " + e.toString());
     } catch (Exception muu) {
       System.out.println("Probleem: " + muu.toString());
     } finally {
       System.out.println("n = " + n + "  m = " + m);
     }
   }
 } // main
示例#6
0
  public static DataSet createFromFile(
      String filePath, int inputsCount, int outputsCount, String delimiter) {
    FileReader fileReader = null;

    try {
      DataSet trainingSet = new DataSet(inputsCount, outputsCount);
      fileReader = new FileReader(new File(filePath));
      BufferedReader reader = new BufferedReader(fileReader);

      String line = "";

      while ((line = reader.readLine()) != null) {
        double[] inputs = new double[inputsCount];
        double[] outputs = new double[outputsCount];
        String[] values = line.split(delimiter);

        if (values[0].equals("")) {
          continue; // skip if line was empty
        }
        for (int i = 0; i < inputsCount; i++) {
          inputs[i] = Double.parseDouble(values[i]);
        }

        for (int i = 0; i < outputsCount; i++) {
          outputs[i] = Double.parseDouble(values[inputsCount + i]);
        }

        if (outputsCount > 0) {
          trainingSet.addRow(new DataSetRow(inputs, outputs));
        } else {
          trainingSet.addRow(new DataSetRow(inputs));
        }
      }

      return trainingSet;

    } catch (FileNotFoundException ex) {
      ex.printStackTrace();
    } catch (IOException ex) {
      if (fileReader != null) {
        try {
          fileReader.close();
        } catch (IOException ex1) {
        }
      }
      ex.printStackTrace();
    } catch (NumberFormatException ex) {
      if (fileReader != null) {
        try {
          fileReader.close();
        } catch (IOException ex1) {
        }
      }
      ex.printStackTrace();
      throw ex;
    }

    return null;
  }
示例#7
0
 public static boolean isNumber(String n) {
   try {
     double d = Double.valueOf(n).doubleValue();
     return true;
   } catch (NumberFormatException e) {
     e.printStackTrace();
     return false;
   }
 }
示例#8
0
 /**
  * @param v
  * @exception DicomException
  */
 public void addValue(String v) throws DicomException {
   short shortValue = 0;
   try {
     shortValue = (short) Integer.parseInt(v);
   } catch (NumberFormatException e) {
     throw new DicomException(e.toString());
   }
   addValue(shortValue);
 }
示例#9
0
 /**
  * Return a integer parsed from the value associated with the given key, or "def" in key wasn't
  * found.
  */
 public static int parseProperty(Properties preferences, String key, int def) {
   String val = preferences.getProperty(key);
   if (val == null) return def;
   try {
     return Integer.parseInt(val);
   } catch (NumberFormatException nfe) {
     nfe.printStackTrace();
     return def;
   }
 }
示例#10
0
 /** @return the pot */
 public static int getPort() {
   int port = 0;
   try {
     port = Integer.parseInt(pot.getText());
   } catch (NumberFormatException f) {
     f.printStackTrace();
     new WhatIDo("Entrer un port valide", f.toString());
   }
   return port;
 }
示例#11
0
 /**
  * @param v
  * @exception DicomException
  */
 public void addValue(String v) throws DicomException {
   flushCachedCopies();
   double doubleValue = 0;
   try {
     doubleValue = Double.parseDouble(v);
   } catch (NumberFormatException e) {
     throw new DicomException(e.toString());
   }
   addValue(doubleValue);
 }
示例#12
0
  public static void main(String args[]) {
    int port;
    String host;

    if (args.length == 1) {
      try {
        port = Integer.parseInt(args[0]);

        doEcho(port);

      } catch (IOException io_ex) {
        io_ex.printStackTrace();
        System.exit(1);

      } catch (NumberFormatException num_ex) {
        num_ex.printStackTrace();
        System.exit(1);
      }
    } else if (args.length == 2) {
      try {
        host = args[0];
        port = Integer.parseInt(args[1]);

        UDPEcho ut = new UDPEcho(host, port);
        Thread thread = new Thread(ut);
        thread.start();

        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String s;
        System.out.print("Enter datagram:");
        s = in.readLine();
        while (s != null) {
          ut.send(s);
          try {
            Thread.currentThread().sleep(100);
          } catch (InterruptedException i_ex) {
          }
          System.out.print("Enter datagram:");
          s = in.readLine();
        }
        System.exit(1);

      } catch (IOException io_ex) {
        io_ex.printStackTrace();
        System.exit(1);
      } catch (NumberFormatException num_ex) {
        num_ex.printStackTrace();
        System.exit(1);
      }

    } else {
      usage();
    }
  }
示例#13
0
    public void actionPerformed(ActionEvent e) {
      JTextField fieldEdited = (JTextField) e.getSource();
      try {
        systemOrder = Integer.parseInt(fieldEdited.getText());
      } catch (NumberFormatException nfex) {
        System.out.println("Number format exception in getting system order");
        nfex.printStackTrace();
      }

      String updatedStatusText = prepareStatusText();
      statusAreaTop.setText(updatedStatusText);
    }
示例#14
0
 Term createIntegerOrLong(String x) throws ParseException {
   try {
     Term retval = null;
     if (x.endsWith("L") || x.endsWith("l")) {
       try {
         retval =
             TermWare.getInstance()
                 .getTermFactory()
                 .createLong(Long.decode(x.substring(0, x.length() - 1)));
       } catch (NumberFormatException ex) {
         // it can be just too big, becouse literals can be unsigned, while decode does not handle
         // unsogned,
         //  bigger then MAX
         // Here we will handle one case, which exists in JDK sources. (java/lang/Long.java)
         if (x.length() > 2) {
           char last = x.charAt(x.length() - 2);
           long l = Long.decode(x.substring(0, x.length() - 2));
           char x0 = x.charAt(0);
           char x1 = x.charAt(1);
           if (x0 == '0') {
             if (x1 == 'x' || x1 == 'X') {
               // hex
               int l1 = Character.digit(last, 16);
               l = ((l << 8) + l1);
             } else {
               // oct
               int l1 = Character.digit(last, 8);
               l = ((l << 4) + l1);
             }
           }
           retval = TermWare.getInstance().getTermFactory().createLong(l);
         } else {
           throw ex;
         }
       }
     } else {
       long l = Long.decode(x);
       retval = TermWare.getInstance().getTermFactory().createInt((int) l);
     }
     return retval;
   } catch (NumberFormatException ex) {
     throw new ParseException(
         "Can't read IntegerLiteral "
             + ex.getMessage()
             + "(s="
             + x
             + ") "
             + " in file "
             + inFname);
   }
 }
示例#15
0
  public static void main(String[] args) {
    int myPeerID;
    actualPeerProcess pp;

    try {
      myPeerID = Integer.parseInt(args[0]);
    } catch (NumberFormatException exp) {
      System.out.println("Exception converting string in main" + exp.getMessage());
      return;
    }

    pp = new actualPeerProcess(myPeerID);
    return;
  }
    /**
     * Eclipse compiler hopefully only uses println(String).
     *
     * <p>{@inheritDoc}
     */
    public void println(String x) {
      if (x.startsWith("[completed ")) {
        int pos = x.lastIndexOf("#");
        int endpos = x.lastIndexOf("/");
        String fileno_str = x.substring(pos + 1, endpos - pos - 1);
        try {
          int fileno = Integer.parseInt(fileno_str);
          this.listener.progress(fileno, x);
        } catch (NumberFormatException _nfe) {
          Debug.log("could not parse eclipse compiler output: '" + x + "': " + _nfe.getMessage());
        }
      }

      super.println(x);
    }
示例#17
0
 public void message(String s) {
   if (firstLine == null) firstLine = s;
   else {
     StringTokenizer st = new StringTokenizer(s, " ");
     try {
       st.nextToken();
       st.nextToken();
       st.nextToken();
       size = (new Integer(st.nextToken().trim())).longValue();
     } catch (NoSuchElementException e) {
       exception = new RunnerException(e.toString());
     } catch (NumberFormatException e) {
       exception = new RunnerException(e.toString());
     }
   }
 }
  /**
   * This method gets called when a property we're interested in is about to change. In case we
   * don't like the new value we throw a PropertyVetoException to prevent the actual change from
   * happening.
   *
   * @param evt a <tt>PropertyChangeEvent</tt> object describing the event source and the property
   *     that will change.
   * @exception PropertyVetoException if we don't want the change to happen.
   */
  public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
    if (evt.getPropertyName().equals(PROP_STUN_SERVER_ADDRESS)) {
      // make sure that we have a valid fqdn or ip address.

      // null or empty port is ok since it implies turning STUN off.
      if (evt.getNewValue() == null) return;

      String host = evt.getNewValue().toString();
      if (host.trim().length() == 0) return;

      boolean ipv6Expected = false;
      if (host.charAt(0) == '[') {
        // This is supposed to be an IPv6 litteral
        if (host.length() > 2 && host.charAt(host.length() - 1) == ']') {
          host = host.substring(1, host.length() - 1);
          ipv6Expected = true;
        } else {
          // This was supposed to be a IPv6 address, but it's not!
          throw new PropertyVetoException("Invalid address string" + host, evt);
        }
      }

      for (int i = 0; i < host.length(); i++) {
        char c = host.charAt(i);
        if (Character.isLetterOrDigit(c)) continue;

        if ((c != '.' && c != ':') || (c == '.' && ipv6Expected) || (c == ':' && !ipv6Expected))
          throw new PropertyVetoException(host + " is not a valid address nor host name", evt);
      }

    } // is prop_stun_server_address
    else if (evt.getPropertyName().equals(PROP_STUN_SERVER_PORT)) {

      // null or empty port is ok since it implies turning STUN off.
      if (evt.getNewValue() == null) return;

      String port = evt.getNewValue().toString();
      if (port.trim().length() == 0) return;

      try {
        Integer.valueOf(evt.getNewValue().toString());
      } catch (NumberFormatException ex) {
        throw new PropertyVetoException(port + " is not a valid port! " + ex.getMessage(), evt);
      }
    }
  }
  /**
   * 数据解包,解包顺序参见<A href ={@docRoot}/dataStructure/tb.html#PrpSearchRecord>历史记账凭证主表信息</A>表字段
   *
   * @param: strMessage String 包含一条纪录数据的字符串
   * @return: boolean
   */
  public boolean decode(String strMessage) {
    try {
      tradeNo = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 1, SysConst.PACKAGESPILTER);
      contNo = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 2, SysConst.PACKAGESPILTER);
      userCode = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 3, SysConst.PACKAGESPILTER);
      name = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 4, SysConst.PACKAGESPILTER);
      gender = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 5, SysConst.PACKAGESPILTER);
      birthday =
          fDate.getDate(
              StrTool.getStr(StrTool.GBKToUnicode(strMessage), 6, SysConst.PACKAGESPILTER));
      province = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 7, SysConst.PACKAGESPILTER);
      city = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 8, SysConst.PACKAGESPILTER);
      mobile = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 9, SysConst.PACKAGESPILTER);
      userIDType = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 10, SysConst.PACKAGESPILTER);
      userIDNo = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 11, SysConst.PACKAGESPILTER);
      riskname = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 12, SysConst.PACKAGESPILTER);
      riskcode = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 13, SysConst.PACKAGESPILTER);
      userState = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 14, SysConst.PACKAGESPILTER);
      userSource = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 15, SysConst.PACKAGESPILTER);
      field1 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 16, SysConst.PACKAGESPILTER);
      field2 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 17, SysConst.PACKAGESPILTER);
      field3 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 18, SysConst.PACKAGESPILTER);
      field4 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 19, SysConst.PACKAGESPILTER);
      field5 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 20, SysConst.PACKAGESPILTER);
      field6 = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 21, SysConst.PACKAGESPILTER);
      searchDate =
          fDate.getDate(
              StrTool.getStr(StrTool.GBKToUnicode(strMessage), 22, SysConst.PACKAGESPILTER));
      searchTime = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 23, SysConst.PACKAGESPILTER);
      makedate =
          fDate.getDate(
              StrTool.getStr(StrTool.GBKToUnicode(strMessage), 24, SysConst.PACKAGESPILTER));
      maketime = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 25, SysConst.PACKAGESPILTER);
    } catch (NumberFormatException ex) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "SearchRecordSchema";
      tError.functionName = "decode";
      tError.errorMessage = ex.toString();
      this.mErrors.addOneError(tError);

      return false;
    }
    return true;
  }
示例#20
0
  /**
   * Decodes data encoded using {@link #toHex(byte[],int,int) toHex}.
   *
   * @param hex data to be converted
   * @param start offset
   * @param len count
   * @throws IOException if input does not represent hex encoded value
   * @since 1.29
   */
  public static byte[] fromHex(char[] hex, int start, int len) throws IOException {

    if (hex == null) throw new IOException("null");

    int i = hex.length;
    if (i % 2 != 0) throw new IOException("odd length");
    byte[] magic = new byte[i / 2];
    for (; i > 0; i -= 2) {
      String g = new String(hex, i - 2, 2);
      try {
        magic[(i / 2) - 1] = (byte) Integer.parseInt(g, 16);
      } catch (NumberFormatException ex) {
        throw new IOException(ex.getLocalizedMessage());
      }
    }

    return magic;
  }
  /**
   * 数据解包,解包顺序参见<A href ={@docRoot}/dataStructure/tb.html#PrpLEPRiskDuty>历史记账凭证主表信息</A>表字段
   *
   * @param: strMessage String 包含一条纪录数据的字符串
   * @return: boolean
   */
  public boolean decode(String strMessage) {
    try {
      riskCode = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 1, SysConst.PACKAGESPILTER);
      riskVer = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 2, SysConst.PACKAGESPILTER);
      dutyCode = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 3, SysConst.PACKAGESPILTER);
      choFlag = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 4, SysConst.PACKAGESPILTER);
      specFlag = StrTool.getStr(StrTool.GBKToUnicode(strMessage), 5, SysConst.PACKAGESPILTER);
    } catch (NumberFormatException ex) {
      // @@错误处理
      CError tError = new CError();
      tError.moduleName = "LEPRiskDutySchema";
      tError.functionName = "decode";
      tError.errorMessage = ex.toString();
      this.mErrors.addOneError(tError);

      return false;
    }
    return true;
  }
示例#22
0
 public List<Object> readExcel(Workbook wb, Class clz, int readLine, int tailLine) {
   Sheet sheet = wb.getSheetAt(0); // 取第一张表
   List<Object> objs = null;
   try {
     Row row = sheet.getRow(readLine); // 开始行,主题栏
     objs = new ArrayList<Object>();
     Map<Integer, String> maps = getHeaderMap(row, clz); // 设定对应的字段顺序与方法名
     if (maps == null || maps.size() <= 0)
       throw new RuntimeException("要读取的Excel的格式不正确,检查是否设定了合适的行"); // 与order顺序不符
     for (int i = readLine + 1; i <= sheet.getLastRowNum() - tailLine; i++) { // 取数据
       row = sheet.getRow(i);
       Object obj = clz.newInstance(); //   调用无参结构
       for (Cell c : row) {
         int ci = c.getColumnIndex();
         String mn = maps.get(ci).substring(3); // 消除get
         mn = mn.substring(0, 1).toLowerCase() + mn.substring(1);
         Map<String, Object> params = new HashMap<String, Object>();
         if (!"enterDate".equals(mn)) c.setCellType(Cell.CELL_TYPE_STRING); // 设置单元格格式
         else c.setCellType(Cell.CELL_TYPE_NUMERIC);
         if (this.getCellValue(c).trim().equals("是")) {
           BeanUtils.copyProperty(obj, mn, 1);
         } else if (this.getCellValue(c).trim().equals("否")) {
           BeanUtils.copyProperty(obj, mn, 0);
         } else BeanUtils.copyProperty(obj, mn, this.getCellValue(c));
       }
       objs.add(obj);
     }
   } catch (InstantiationException e) {
     e.printStackTrace();
     logger.error(e);
   } catch (IllegalAccessException e) {
     e.printStackTrace();
     logger.error(e);
   } catch (InvocationTargetException e) {
     e.printStackTrace();
     logger.error(e);
   } catch (NumberFormatException e) {
     e.printStackTrace();
     logger.error(e);
   }
   return objs;
 }
示例#23
0
 /**
  * @return a double parsed from the value associated with the given key in the given Properties.
  *     returns "def" in key wasn't found, or if a parsing error occured. If "value" contains a "%"
  *     sign, we use a <code>NumberFormat.getPercentInstance</code> to convert it to a double.
  */
 public static double parseProperty(Properties preferences, String key, double def) {
   NumberFormat formatPercent = NumberFormat.getPercentInstance(Locale.US); // for zoom factor
   String val = preferences.getProperty(key);
   if (val == null) return def;
   if (val.indexOf("%") == -1) { // not in percent format !
     try {
       return Double.parseDouble(val);
     } catch (NumberFormatException nfe) {
       nfe.printStackTrace();
       return def;
     }
   }
   // else it's a percent format -> parse it
   try {
     Number n = formatPercent.parse(val);
     return n.doubleValue();
   } catch (ParseException ex) {
     ex.printStackTrace();
     return def;
   }
 }
示例#24
0
  protected void getDimensionsFromLogFile(BufferedReader reader, PicText text) {
    if (reader == null) {
      return;
    }
    String line = ""; // il rale si j'initialise pas ...
    boolean finished = false;
    while (!finished) {
      try {
        line = reader.readLine();
      } catch (IOException ioex) {
        ioex.printStackTrace();
        return;
      }
      if (line == null) {
        System.out.println("Size of text not found in log file...");
        return;
      }

      System.out.println(line);
      Matcher matcher = LogFilePattern.matcher(line);

      if (line != null && matcher.find()) {
        System.out.println("FOUND :" + line);
        finished = true;
        try {
          text.setDimensions(
              0.3515 * Double.parseDouble(matcher.group(1)), // height, pt->mm (1pt=0.3515 mm)
              0.3515 * Double.parseDouble(matcher.group(2)), // width
              0.3515 * Double.parseDouble(matcher.group(3))); // depth
          areDimensionsComputed = true;
        } catch (NumberFormatException e) {
          System.out.println("Logfile number format problem: $line" + e.getMessage());
        } catch (IndexOutOfBoundsException e) {
          System.out.println("Logfile regexp problem: $line" + e.getMessage());
        }
      }
    }
    return;
  }
 private void inputIPAddr() {
   try {
     String ipSample = getIPAndroid();
     String hostStr =
         Messages.showInputDialog(
             "What is your host?",
             "Input your host address",
             Messages.getQuestionIcon(),
             ipSample + ":" + port,
             null);
     if (hostStr == null) {
       hostStr = ipSample + ":1234";
     }
     int index = hostStr.indexOf(":");
     serverName = hostStr.substring(0, index);
     port = Integer.parseInt(hostStr.substring(index + 1));
   } catch (NumberFormatException e) {
     e.printStackTrace();
     serverName = "localhost";
     port = 1234;
   }
 }
示例#26
0
  public VirtualMachine attach(Map arguments)
      throws IOException, IllegalConnectorArgumentsException {
    int pid = 0;
    try {
      pid = Integer.parseInt(argument(ARG_PID, arguments).value());
    } catch (NumberFormatException nfe) {
      throw (IllegalConnectorArgumentsException)
          new IllegalConnectorArgumentsException(nfe.getMessage(), ARG_PID).initCause(nfe);
    }

    checkProcessAttach(pid);

    VirtualMachine myVM = null;
    try {
      try {
        Class vmImplClass = loadVirtualMachineImplClass();
        myVM = createVirtualMachine(vmImplClass, pid);
      } catch (InvocationTargetException ite) {
        Class vmImplClass = handleVMVersionMismatch(ite);
        if (vmImplClass != null) {
          return createVirtualMachine(vmImplClass, pid);
        } else {
          throw ite;
        }
      }
    } catch (Exception ee) {
      if (DEBUG) {
        System.out.println("VirtualMachineImpl() got an exception:");
        ee.printStackTrace();
        System.out.println("pid = " + pid);
      }
      throw (IOException) new IOException().initCause(ee);
    }
    setVMDisposeObserver(myVM);
    return myVM;
  }
  private void jsonReadContElements(JsonReader jReader) throws IOException {
    jReader.beginObject();
    List<String> loadedLfs = new ArrayList<>();
    boolean exceptForDecimal5Raised = false;
    boolean enumChecked = false;
    boolean bitsChecked = false;
    boolean lfdecimal6Checked = false;
    boolean lfdecimal4Checked = false;
    boolean lfdecimal3Checked = false;
    boolean lfdecimal2Checked = false;
    boolean lfdecimal1Checked = false;
    boolean lfbool1Checked = false;
    boolean lfbool2Checked = false;
    boolean lfstrChecked = false;
    boolean lfbinaryChecked = false;
    // boolean lfref1Checked = false;
    boolean lfemptyChecked = false;
    boolean lfstr1Checked = false;

    while (jReader.hasNext()) {
      String keyName = jReader.nextName();
      JsonToken peek = null;
      try {
        peek = jReader.peek();
      } catch (IOException e) {
        if (keyName.equals("lfdecimal5")) {
          exceptForDecimal5Raised = true;
        } else {
          assertTrue("Key " + keyName + " has incorrect value for specifed type", false);
        }
      }

      if (keyName.startsWith("lfnint") || keyName.startsWith("lfnuint")) {
        assertEquals("Key " + keyName + " has incorrect type", JsonToken.NUMBER, peek);
        try {
          jReader.nextLong();
        } catch (NumberFormatException e) {
          assertTrue("Key " + keyName + " has incorrect value - " + e.getMessage(), false);
        }
        loadedLfs.add(keyName.substring(3));
      } else if (keyName.equals("lfstr")) {
        assertEquals("Key " + keyName + " has incorrect type", JsonToken.STRING, peek);
        assertEquals("lfstr", jReader.nextString());
        lfstrChecked = true;
      } else if (keyName.equals("lfstr1")) {
        assertEquals("Key " + keyName + " has incorrect type", JsonToken.STRING, peek);
        assertEquals("", jReader.nextString());
        lfstr1Checked = true;
      } else if (keyName.equals("lfbool1")) {
        assertEquals("Key " + keyName + " has incorrect type", JsonToken.BOOLEAN, peek);
        assertEquals(true, jReader.nextBoolean());
        lfbool1Checked = true;
      } else if (keyName.equals("lfbool2")) {
        assertEquals("Key " + keyName + " has incorrect type", JsonToken.BOOLEAN, peek);
        assertEquals(false, jReader.nextBoolean());
        lfbool2Checked = true;
      } else if (keyName.equals("lfbool3")) {
        assertEquals("Key " + keyName + " has incorrect type", JsonToken.BOOLEAN, peek);
        assertEquals(false, jReader.nextBoolean());
      } else if (keyName.equals("lfdecimal1")) {
        assertEquals("Key " + keyName + " has incorrect type", JsonToken.NUMBER, peek);
        assertEquals(new Double(43.32), (Double) jReader.nextDouble());
        lfdecimal1Checked = true;
      } else if (keyName.equals("lfdecimal2")) {
        assertEquals("Key " + keyName + " has incorrect type", JsonToken.NUMBER, peek);
        assertEquals(new Double(-0.43), (Double) jReader.nextDouble());
        lfdecimal2Checked = true;
      } else if (keyName.equals("lfdecimal3")) {
        assertEquals("Key " + keyName + " has incorrect type", JsonToken.NUMBER, peek);
        assertEquals(new Double(43), (Double) jReader.nextDouble());
        lfdecimal3Checked = true;
      } else if (keyName.equals("lfdecimal4")) {
        assertEquals("Key " + keyName + " has incorrect type", JsonToken.NUMBER, peek);
        assertEquals(new Double(43E3), (Double) jReader.nextDouble());
        lfdecimal4Checked = true;
      } else if (keyName.equals("lfdecimal6")) {
        assertEquals("Key " + keyName + " has incorrect type", JsonToken.NUMBER, peek);
        assertEquals(new Double(33.12345), (Double) jReader.nextDouble());
        lfdecimal6Checked = true;
      } else if (keyName.equals("lfenum")) {
        assertEquals("enum3", jReader.nextString());
        enumChecked = true;
      } else if (keyName.equals("lfbits")) {
        assertEquals("bit3", jReader.nextString());
        bitsChecked = true;
      } else if (keyName.equals("lfbinary")) {
        assertEquals(
            "AAaacdabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ%%-#^",
            jReader.nextString());
        lfbinaryChecked = true;
      } else if (keyName.equals("lfempty")) {
        jReader.beginArray();
        jReader.nextNull();
        jReader.endArray();
        lfemptyChecked = true;
      } else if (keyName.startsWith("lfunion")) {
        checkLfUnion(jReader, keyName, peek);
      } else {
        assertTrue("Key " + keyName + " doesn't exists in yang file.", false);
      }
    }
    Collections.sort(loadedLfs);
    String expectedLfsStr =
        "[int16Max, int16Min, int32Max, int32Min, int64Max, int64Min, int8Max, int8Min, uint16Max, uint32Max, uint8Max]";
    String actualLfsStr = loadedLfs.toString();
    assertEquals("Some leaves are missing", expectedLfsStr, actualLfsStr);
    // assertTrue("For lfdecimal5 wasn't catch error",exceptForDecimal5Raised);
    assertTrue("Enum wasn't checked", enumChecked);
    assertTrue("Bits wasn't checked", bitsChecked);
    assertTrue("Decimal1 wasn't checked", lfdecimal1Checked);
    assertTrue("Decimal2 wasn't checked", lfdecimal2Checked);
    assertTrue("Decimal3 wasn't checked", lfdecimal3Checked);
    assertTrue("Decimal4 wasn't checked", lfdecimal4Checked);
    assertTrue("Decimal5 wasn't checked", lfdecimal6Checked);
    assertTrue("lfbool1 wasn't checked", lfbool1Checked);
    assertTrue("lfbool2 wasn't checked", lfbool2Checked);
    assertTrue("lfstr wasn't checked", lfstrChecked);
    assertTrue("lfstr1 wasn't checked", lfstr1Checked);
    assertTrue("lfbinary wasn't checked", lfbinaryChecked);
    assertTrue("lfempty wasn't checked", lfemptyChecked);
    // assertTrue("lfref1 wasn't checked", lfref1Checked);

    jReader.endObject();
  }
示例#28
0
  /**
   * If we know in advance that the table is numeric, can optimize a lot... For example, on 9803 x
   * 294 table, TableFileLoader.readNumeric takes 6s compared to 12s for WekaMine readFromTable.
   */
  public static Instances readNumeric(String fileName, String relationName, String delimiter)
      throws Exception {

    int numAttributes = FileUtils.fastCountLines(fileName) - 1; // -1 exclude heading.
    String[] attrNames = new String[numAttributes];

    // Read the col headings and figure out the number of columns in the table..
    BufferedReader reader = new BufferedReader(new FileReader(fileName), 4194304);
    String line = reader.readLine();
    String[] instanceNames = parseColNames(line, delimiter);
    int numInstances = instanceNames.length;

    System.err.print("reading " + numAttributes + " x " + numInstances + " table..");

    // Create an array to hold the data as we read it in...
    double dataArray[][] = new double[numAttributes][numInstances];

    // Populate the matrix with values...
    String valToken = "";
    try {
      int rowIdx = 0;
      while ((line = reader.readLine()) != null) {

        String[] tokens = line.split(delimiter, -1);
        attrNames[rowIdx] = tokens[0].trim();
        for (int colIdx = 0; colIdx < (tokens.length - 1); colIdx++) {
          valToken = tokens[colIdx + 1];
          double value;

          if (valToken.equals("null")) {
            value = Instance.missingValue();
          } else if (valToken.equals("?")) {
            value = Instance.missingValue();
          } else if (valToken.equals("NA")) {
            value = Instance.missingValue();
          } else if (valToken.equals("")) {
            value = Instance.missingValue();
            // }else value = DoubleParser.lightningParse(valToken); // faster double parser with
            // MANY assumptions
          } else value = Double.parseDouble(valToken);
          dataArray[rowIdx][colIdx] = value;
        }
        rowIdx++;
      }
    } catch (NumberFormatException e) {
      System.err.println(e.toString());
      System.err.println("Parsing line: " + line);
      System.err.println("Parsing token: " + valToken);
    }

    // Set up attributes, which for colInstances will be the rowNames...
    FastVector atts = new FastVector();
    for (int a = 0; a < numAttributes; a++) {
      atts.addElement(new Attribute(attrNames[a]));
    }

    // Create Instances object..
    Instances data = new Instances(relationName, atts, 0);
    data.setRelationName(relationName);

    System.err.print("creating instances..");

    // System.err.println("DEBUG: numAttributes "+numAttributes);

    /** ***** CREATE INSTANCES ************* */
    // Fill the instances with data...
    // For each instance...
    for (int c = 0; c < numInstances; c++) {
      double[] vals =
          new double[data.numAttributes()]; // Even nominal values are stored as double pointers.

      for (int r = 0; r < numAttributes; r++) {
        double val = dataArray[r][c];
        vals[r] = val;
      }
      // Add the a newly minted instance with those attribute values...
      data.add(new Instance(1.0, vals));
    }

    // System.err.println("DEBUG: data.numInstances: "+data.numInstances());
    // System.err.println("DEBUG: data.numAttributes: "+data.numAttributes());
    // System.err.println("DEBUG: data.relationNAme"+data.relationName());
    System.err.print("add feature names..");

    /** ***** ADD FEATURE NAMES ************* */
    // takes basically zero time... all time is in previous 2 chunks.
    Instances newData = new Instances(data);
    newData.insertAttributeAt(new Attribute("ID", (FastVector) null), 0);
    int attrIdx = newData.attribute("ID").index(); // Paranoid... should be 0

    for (int c = 0; c < numInstances; c++) {
      newData.instance(c).setValue(attrIdx, instanceNames[c]);
    }
    data = newData;

    // System.err.println("DEBUG: data.numInstances: "+data.numInstances());
    // System.err.println("DEBUG: data.numAttributes: "+data.numAttributes());

    return (data);
  }
 /**
  * Reads a given line and decides what to do with it depending on the contents of the line Calls
  * find, add, or sell depending on what the line says
  *
  * @param line - a single command
  */
 public void parse(String line) {
   // Splits the input by commas into an array for easier parsing
   String[] delimited = line.split(",");
   AudioFormat audioFormat = null;
   try {
     if (delimited[0].equals(MusicStoreInventory.ADD)) { // ADD command
       // Creates a new CD, Vinyl, or Cassette depending on the input
       if (delimited[4].equals("CD")) {
         audioFormat = new CD(delimited[1], delimited[2], this.convertStringToInt(delimited[3]));
       } else if (delimited[4].equals("VINYL")) {
         audioFormat =
             new Vinyl(delimited[1], delimited[2], this.convertStringToInt(delimited[3]));
       } else if (delimited[4].equals("CASSETTE")) {
         audioFormat =
             new Cassette(delimited[1], delimited[2], this.convertStringToInt(delimited[3]));
       } else {
         // If it's not any of the three types, throws an exception
         throw new IllegalArgumentException("Invalid input: not a valid record type (ADD).");
       }
       // Adds the item to the inventory
       this.addItem(
           audioFormat,
           this.convertStringToInt(delimited[5]),
           this.convertStringToDouble(delimited[6]));
     } else if (delimited[0].equals(MusicStoreInventory.SELL)) { // SELL command
       // Creates a new CD, Vinyl, or Cassette depending on the input
       if (delimited[4].equals("CD")) {
         audioFormat = new CD(delimited[1], delimited[2], this.convertStringToInt(delimited[3]));
       } else if (delimited[4].equals("VINYL")) {
         audioFormat =
             new Vinyl(delimited[1], delimited[2], this.convertStringToInt(delimited[3]));
       } else if (delimited[4].equals("CASSETTE")) {
         audioFormat =
             new Cassette(delimited[1], delimited[2], this.convertStringToInt(delimited[3]));
       } else {
         // If it's not any of the three types, throws an exception
         throw new IllegalArgumentException("Invalid input: not a valid record type (SELL)");
       }
       // Sells the item
       this.sellItem(audioFormat, this.convertStringToInt(delimited[5]));
     } else if (delimited[0].equals(MusicStoreInventory.FIND)) { // FIND command
       // There should only be 2 parameters for a FIND command
       if (delimited.length != 2) {
         throw new IllegalArgumentException("Invalid input: wrong number of commands (FIND).");
       }
       this.findItemsByArtist(delimited[1]);
     } else {
       // The only thing that can remain is the initial input of data, which has exactly 6 commands
       if (delimited.length != 6) {
         throw new IllegalArgumentException("Invalid input: wrong number of commands.");
       }
       // Creates a new CD, Vinyl, or Cassette depending on the input
       if (delimited[3].equals("CD")) {
         audioFormat = new CD(delimited[0], delimited[1], this.convertStringToInt(delimited[2]));
       } else if (delimited[3].equals("VINYL")) {
         audioFormat =
             new Vinyl(delimited[0], delimited[1], this.convertStringToInt(delimited[2]));
       } else if (delimited[3].equals("CASSETTE")) {
         audioFormat =
             new Cassette(delimited[0], delimited[1], this.convertStringToInt(delimited[2]));
       } else {
         // If it's not any of the three types, throws an exception
         throw new IllegalArgumentException("Invalid input: not a valid record type (ADD)");
       }
       // Adds the item to the inventory
       this.addItem(
           audioFormat,
           this.convertStringToInt(delimited[4]),
           this.convertStringToDouble(delimited[5]));
     }
   } catch (NumberFormatException e) {
     System.out.println("Invalid input: price or year is not valid.");
     e.printStackTrace();
   } catch (IllegalArgumentException | NullPointerException e) {
     e.printStackTrace();
   }
 }
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    javax.servlet.jsp.PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;

    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html;charset=ISO-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\n\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n\n");
      out.write("\n\n");

      PollerConfiguration pollconfig = getPollerConfiguration();
      org.opennms.netmgt.config.poller.Package pkg = null;

      int pkgIdx = -1;

      String pkgIdxStr = (String) request.getParameter("pkgidx");
      if (pkgIdxStr != null && pkgIdxStr.trim().length() > 0) {
        try {
          pkgIdx = Integer.parseInt(pkgIdxStr);
          if (pkgIdx >= 0) {
            if (pollconfig != null) {
              pkg = pollconfig.getPackage(pkgIdx);
            }
          }
        } catch (NumberFormatException ne) {
          ne.printStackTrace();
        }
      }

      if (pkg == null) {
        if ((org.opennms.netmgt.config.poller.Package) request.getSession().getAttribute("pkg")
            != null) {
          pkg = (org.opennms.netmgt.config.poller.Package) request.getSession().getAttribute("pkg");
        }
      }

      if (pkgIdx == -1) {
        pkgIdxStr = (String) request.getSession().getAttribute("pkgidx");
        if (pkgIdxStr != null && pkgIdxStr.trim().length() > 0) {
          try {
            pkgIdx = Integer.parseInt(pkgIdxStr);
          } catch (NumberFormatException ne) {
            ne.printStackTrace();
          }
        }
      }

      request.getSession().setAttribute("pkg", pkg);
      request.getSession().setAttribute("pkgidx", String.valueOf(pkgIdx));

      String title = " Poller Package Downtime Model";
      if (pkg != null) {
        title = " Poller Package - Downtime Model for: " + pkg.getName();
      }

      out.write("\n\n");
      out.write("<html>\n");
      out.write("<head>\n  ");
      out.write("<title>");
      out.print(title);
      out.write("</title>\n  ");
      out.write(
          "<link rel=\"stylesheet\" type=\"text/css\" href=\"/wt-portal/css/default.css\" />\n  ");
      out.write("<script type=\"text/javascript\" src=\"/wt-portal/javascript/WTtools.js\">");
      out.write("</script>\n\n");
      out.write(
          "<script language=javascript>\nfunction confirmDelete(msg)\n{\n\tvar agree=confirm(msg);\n\tif (agree)\n\t\treturn true;\n\telse\n\t\treturn false;\n}\n\nfunction addDowntime()\n{\n    var msg = \"\";\n    var error = false;\n    var begin = 0;\n    var end = 0;\n    var interval = 0;\n\n    dtbeginday = parseInt(document.downtime.dtbeginday.value) * 24 * 60 * 60 * 1000;\n    dtbeginhour = parseInt(document.downtime.dtbeginhour.value) * 60 * 60 * 1000;\n    dtbeginminute = parseInt(document.downtime.dtbeginminute.value) * 60 * 1000;\n    dtbeginsecond = parseInt(document.downtime.dtbeginsecond.value) * 1000;\n    dtbeginmillisecond = parseInt(document.downtime.dtbeginmillisecond.value);\n\n    dtendday = parseInt(document.downtime.dtendday.value) * 24 * 60 * 60 * 1000;\n    dtendhour = parseInt(document.downtime.dtendhour.value) * 60 * 60 * 1000;\n    dtendminute = parseInt(document.downtime.dtendminute.value) * 60 * 1000;\n    dtendsecond = parseInt(document.downtime.dtendsecond.value) * 1000;\n    dtendmillisecond = parseInt(document.downtime.dtendmillisecond.value);\n");
      out.write(
          "\n    dtintervalday = parseInt(document.downtime.dtintervalday.value) * 24 * 60 * 60 * 1000;\n    dtintervalhour = parseInt(document.downtime.dtintervalhour.value) * 60 * 60 * 1000;\n    dtintervalminute = parseInt(document.downtime.dtintervalminute.value) * 60 * 1000;\n    dtintervalsecond = parseInt(document.downtime.dtintervalsecond.value) * 1000;\n    dtintervalmillisecond = parseInt(document.downtime.dtintervalmillisecond.value);\n\n    document.downtime.dtbegin.value = dtbeginday + dtbeginhour + dtbeginminute + dtbeginsecond + dtbeginmillisecond;\n    document.downtime.dtend.value = dtendday + dtendhour + dtendminute + dtendsecond + dtendmillisecond;\n    document.downtime.dtinterval.value = dtintervalday + dtintervalhour + dtintervalminute + dtintervalsecond + dtintervalmillisecond;\n\n\tvar beginVal = trim(document.downtime.dtbegin.value);\n\tvar endVal = trim(document.downtime.dtend.value);\n\tvar intervalVal = trim(document.downtime.dtinterval.value);\n\n    if (beginVal == \"\") {\n        error = true;\n        msg += \"Must enter a numeric time value for \\\"begin\\\".\\n\";\n");
      out.write(
          "    }\n    if (endVal == \"\") {\n        error = true;\n        msg += \"\\nMust enter a numeric time value for \\\"end\\\".\\n\";\n    }\n    if (intervalVal  == \"\") {\n        error = true;\n        msg += \"\\nMust enter a numeric time value for \\\"interval\\\".\\n\";\n    }\n    if (isNaN(beginVal)) {\n        error = true;\n        msg += \"\\nMust enter a numeric time value for \\\"begin\\\".\\n\";\n    }\n    if (isNaN(endVal)) {\n        error = true;\n        msg += \"\\nMust enter a numeric time value for \\\"end\\\".\\n\";\n    }\n    if (isNaN(intervalVal)) {\n        error = true;\n        msg += \"\\nMust enter a numeric time value for \\\"interval\\\".\\n\";\n    }\n\n    if (!error) {\n        begin = parseInt(beginVal);\n        end = parseInt(endVal);\n        interval = parseInt(intervalVal);\n    \n        if (!(end > 0)) {\n            error = true;\n            msg = \"The end time must be greater than zero.\\n\";\n        }\n        if (!(interval > 0)) {\n            error = true;\n            msg += \"\\nThe 'interval' value must be greater than zero.\\n\";\n        }\n");
      out.write(
          "        if (!((end - begin) > 0)) {\n            error = true;\n            msg += \"\\nThe 'end' time must be greater than the 'begin'.\\n\";\n        }\n        if (!(interval ");
      out.write(
          "<= (end - begin))) {\n            error = true;\n            msg += \"\\nThe 'interval' time must be less than the difference of the 'begin' and the 'end'.\\n\";\n        }\n    }\n\n    if (error) {\n        alert (msg);\n        return;\n    }\n    else\n    {\n        document.downtime.target = \"pollerDetailFrame\";\n    \tdocument.downtime.action.value = 'adddt';\n    \tdocument.downtime.submit();\n    }\n}\n\nfunction removeDowntime(dtidx)\n{\n    if (confirmDelete('Are you sure you want to delete this downtime model?')) {\n        document.downtime.target = \"pollerDetailFrame\";\n        document.downtime.action.value = 'removedt';\n        document.downtime.dtidx.value = dtidx;\n    \tdocument.downtime.submit();\n    }\n}\n\nfunction updateDowntime()\n{\n    document.downtime.target = \"_parent\";\n    document.downtime.action.value = 'updatedt';\n\tdocument.downtime.submit();\n}\n\nfunction restoreDefaultDowntime()\n{\n    if (confirmDelete('Are you sure you want to restore the default downtime model? All your changes will be lost.')) {\n        document.downtime.target = \"pollerDetailFrame\";\n");
      out.write(
          "        document.downtime.action.value = 'restoredt';\n    \tdocument.downtime.submit();\n    }\n}\n");
      out.write("</script>\n");
      out.write("</head>\n");
      out.write("<body>\n\n\t");
      String breadcrumb1 = "<a href='admin/index.jsp'></a>";
      out.write("\n\t");
      String breadcrumb2 = "Poller Packages";
      out.write("\n\t");
      JspRuntimeLibrary.include(
          request,
          response,
          "/includes/header.jsp"
              + "?"
              + "title="
              + java.net.URLEncoder.encode("" + title)
              + "&"
              + "location="
              + "admin"
              + "&"
              + "help="
              + "monitoringadmin%2Fpolling%2FWTHelp_PollerPackageDowntimeModel.html"
              + "&"
              + "noPopOut="
              + "true"
              + "&"
              + "breadcrumb="
              + java.net.URLEncoder.encode("" + breadcrumb1)
              + "&"
              + "breadcrumb="
              + java.net.URLEncoder.encode("" + breadcrumb2),
          out,
          false);
      out.write("\n");
      out.write("<!-- BEGIN FRAMING TABLE:open tags, keep at 100%-->\n");
      out.write("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n\t");
      out.write("<tr>\n\t\t");
      out.write("<td width=\"10\">");
      out.write(
          "<img src=\"/wt-portal/images/spacers/spacer.gif\" height=\"1\" width=\"10\" border=\"0\" alt=\"WebTelemetry\">");
      out.write("</td>\n\t\t");
      out.write("<td>\n");
      out.write("<!-- END FRAMING TABLE:open tags, keep at 100%-->\n\t");
      out.write("<form action=\"");
      out.print(WTTools.getMonServletURL(request));
      out.write("WTPollerPackages\" method=\"post\" name=\"downtime\" target=\"_parent\">\n\t  ");
      out.write("<input type=\"hidden\" name=\"action\" value=\"\">\n\t  ");
      out.write("<input type=\"hidden\" name=\"pkgidx\" value=\"\">\n\t  ");
      out.write("<input type=\"hidden\" name=\"dtidx\" value=\"\">\n\t  ");
      out.write("<input type=\"hidden\" name=\"dtbegin\" value=\"\">\n\t  ");
      out.write("<input type=\"hidden\" name=\"dtend\" value=\"\">\n\t  ");
      out.write("<input type=\"hidden\" name=\"dtinterval\" value=\"\">\n\n");
      out.write("<table width=\"98%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n     ");
      out.write("<tr>\n        ");
      out.write("<td colspan=\"4\">");
      out.write("<b>Downtime Model:");
      out.write("</b>");
      out.write("<a class=\"tt\" href=\"javascript: towerTip(");
      out.print(WTTips.TIP_POLLER_MON_SERVICE);
      out.write(");\" title=\"Telemetry Tip\">");
      out.write("<img src=\"/wt-portal/images/icons/tower_tips.gif\" border=\"0\">");
      out.write("</a>");
      out.write("</td>\n    ");
      out.write("</tr>\n     ");
      out.write("<tr class=\"tableHeader\">\n        ");
      out.write("<td class=\"tableHeader\" width=\"25%\">Begin Time");
      out.write("<a class=\"tt\" href=\"javascript: towerTip(");
      out.print(WTTips.TIP_POLLER_DT_BEGIN);
      out.write(");\" title=\"Telemetry Tip\">");
      out.write("<img src=\"/wt-portal/images/icons/tower_tips.gif\" border=\"0\">");
      out.write("</a>");
      out.write("</td>\n        ");
      out.write("<td class=\"tableHeader\" width=\"25%\">End Time");
      out.write("<a class=\"tt\" href=\"javascript: towerTip(");
      out.print(WTTips.TIP_POLLER_DT_END);
      out.write(");\" title=\"Telemetry Tip\">");
      out.write("<img src=\"/wt-portal/images/icons/tower_tips.gif\" border=\"0\">");
      out.write("</a>");
      out.write("</td>\n        ");
      out.write("<td class=\"tableHeader\" width=\"25%\">Polling Interval");
      out.write("<a class=\"tt\" href=\"javascript: towerTip(");
      out.print(WTTips.TIP_POLLER_DT_INTERVAL);
      out.write(");\" title=\"Telemetry Tip\">");
      out.write("<img src=\"/wt-portal/images/icons/tower_tips.gif\" border=\"0\">");
      out.write("</a>");
      out.write("</td>\n        ");
      out.write("<td class=\"tableHeader\" width=\"25%\">Action");
      out.write("</td>\n    ");
      out.write("</tr>\n        ");

      long daymilli = 24 * 60 * 60 * 1000; // 86400000
      long hourmlli = 60 * 60 * 1000; // 3600000;
      long minutemilli = 60 * 1000; // 60000;
      long secondmilli = 1000;

      String pattern2digit = "00";
      DecimalFormat df2digit = new DecimalFormat(pattern2digit);

      String pattern3digit = "000";
      DecimalFormat df3digit = new DecimalFormat(pattern3digit);

      long begin = 0;
      long end = 0;
      long interval = 0;
      String delete = null;
      long addbegin = 0;
      if (pkg != null) {
        Downtime[] ds = pkg.getDowntime();
        if (ds != null) {
          for (int i = 0; i < ds.length; i++) {
            Downtime d = ds[i];

            begin = d.getBegin();
            end = d.getEnd();
            interval = d.getInterval();
            delete = d.getDelete();

            long dtbegin = begin;
            long dtend = end;
            long dtinterval = interval;
            addbegin = begin;

            long dtbeginday = 0;
            long dtbeginhour = 0;
            long dtbeginminute = 0;
            long dtbeginsecond = 0;
            long dtbeginmillisecond = 0;

            long dtendday = 0;
            long dtendhour = 0;
            long dtendminute = 0;
            long dtendsecond = 0;
            long dtendmillisecond = 0;

            long dtintervalday = 0;
            long dtintervalhour = 0;
            long dtintervalminute = 0;
            long dtintervalsecond = 0;
            long dtintervalmillisecond = 0;

            if (dtbegin > 0) {
              dtbeginday = dtbegin / daymilli;
              dtbegin -= (dtbeginday * daymilli);
            }
            if (dtbegin > 0) {
              dtbeginhour = dtbegin / hourmlli;
              dtbegin -= (dtbeginhour * hourmlli);
            }
            if (dtbegin > 0) {
              dtbeginminute = dtbegin / minutemilli;
              dtbegin -= (dtbeginminute * minutemilli);
            }
            if (dtbegin > 0) {
              dtbeginsecond = dtbegin / secondmilli;
              dtbegin -= (dtbeginsecond * secondmilli);
            }
            if (dtbegin > 0) {
              dtbeginmillisecond = dtbegin;
            }

            if (dtend > 0) {
              dtendday = dtend / daymilli;
              dtend -= (dtendday * daymilli);
            }
            if (dtend > 0) {
              dtendhour = dtend / hourmlli;
              dtend -= (dtendhour * hourmlli);
            }
            if (dtend > 0) {
              dtendminute = dtend / minutemilli;
              dtend -= (dtendminute * minutemilli);
            }
            if (dtend > 0) {
              dtendsecond = dtend / secondmilli;
              dtend -= (dtendsecond * secondmilli);
            }
            if (dtend > 0) {
              dtendmillisecond = dtend;
            }

            if (dtinterval > 0) {
              dtintervalday = dtinterval / daymilli;
              dtinterval -= (dtintervalday * daymilli);
            }
            if (dtinterval > 0) {
              dtintervalhour = dtinterval / hourmlli;
              dtinterval -= (dtintervalhour * hourmlli);
            }
            if (dtinterval > 0) {
              dtintervalminute = dtinterval / minutemilli;
              dtinterval -= (dtintervalminute * minutemilli);
            }
            if (dtinterval > 0) {
              dtintervalsecond = dtinterval / secondmilli;
              dtinterval -= (dtintervalsecond * secondmilli);
            }
            if (dtinterval > 0) {
              dtintervalmillisecond = dtinterval;
            }

            out.write("\n                    ");
            out.write("<!--\n            \t\t");
            out.write("<TR>\n                \t\t");
            out.write("<TD align=\"center\">\n                \t\t");
            out.write("<INPUT name=\"dtbegin_");
            out.print(String.valueOf(i));
            out.write("\" type=\"text\" value=\"");
            out.print(begin);
            out.write("\" disabled>\n                \t\t");
            out.write("</TD>\n                \t\t");
            out.write("<TD align=\"center\">");
            out.write("<INPUT name=\"dtend_");
            out.print(String.valueOf(i));
            out.write("\" type=\"text\" value=\"");
            out.print(end);
            out.write("\" disabled>");
            out.write("</TD>\n                \t\t");
            out.write("<TD align=\"center\">");
            out.write("<INPUT name=\"dtinterval_");
            out.print(String.valueOf(i));
            out.write("\" type=\"text\" value=\"");
            out.print(interval);
            out.write("\" disabled>");
            out.write("</TD>\n                \t\t");
            out.write("<TD align=\"center\">");
            out.write("<INPUT name=\"dtdel_");
            out.print(String.valueOf(i));
            out.write("\" type=\"checkbox\" value=\"true\" ");
            if (delete != null && delete.equals("true")) {
              out.write("checked");
            }
            out.write(" disabled>");
            out.write("</TD>\n                \t\t");
            out.write("<TD align=\"center\">\n                            ");
            if ((i + 2) == ds.length) {
              out.write("\n                                ");
              out.write("<a HREF=\"javascript:removeDowntime('");
              out.print(i);
              out.write("')\" title=\"Remove Downtime Model\">Remove");
              out.write("</a>\n                            ");
            } else {
              out.write("\n                               &nbsp;\n                            ");
            }
            out.write("\n                        ");
            out.write("</TD>\n            \t\t");
            out.write("</TR>\n            \t\t-->\n\n                \t\t");
            if (i < (ds.length - 1)) {
              out.write("\n                           ");
              out.write("<tr class=\"");
              out.print(((i % 2) == 0) ? "tableRowLIght" : "tableRowDark");
              out.write("\">\n                \t\t");
              out.write("<td class=\"tableText\">\n                    \t\t");
              out.print(dtbeginday);
              out.write(" days ");
              out.print(df2digit.format(dtbeginhour));
              out.write(":");
              out.print(df2digit.format(dtbeginminute));
              out.write(":");
              out.print(df2digit.format(dtbeginsecond));
              out.write(":");
              out.print(df3digit.format(dtbeginmillisecond));
              out.write("\n                        ");
              out.write("</td>\n                \t\t");
              out.write("<td class=\"tableText\">\n                   \t\t    ");
              out.print(dtendday);
              out.write(" days ");
              out.print(df2digit.format(dtendhour));
              out.write(":");
              out.print(df2digit.format(dtendminute));
              out.write(":");
              out.print(df2digit.format(dtendsecond));
              out.write(":");
              out.print(df3digit.format(dtendmillisecond));
              out.write("\n                        ");
              out.write("</td>\n                \t\t");
              out.write("<td class=\"tableText\">\n                    \t\t");
              out.print(dtintervalday);
              out.write(" days ");
              out.print(df2digit.format(dtintervalhour));
              out.write(":");
              out.print(df2digit.format(dtintervalminute));
              out.write(":");
              out.print(df2digit.format(dtintervalsecond));
              out.write(":");
              out.print(df3digit.format(dtintervalmillisecond));
              out.write("\n                        ");
              out.write("</td>\n                        ");
              out.write("<td class=\"tableText\">\n                                 ");
              if (i == (ds.length - 2)) {
                out.write("\n                                     ");
                out.write("<a href=\"javascript:removeDowntime('");
                out.print(i);
                out.write("')\" title=\"Remove Downtime Model\">Remove");
                out.write("</a>");
                out.write("</td>\n                                 ");
              }
              out.write("\n                        ");
              out.write("</td>\n                \t\t");
            } else {
              out.write("\n\t\t\t\t\t\t");
              out.write("<tr>");
              out.write("<td colspan=\"3\">&nbsp;");
              out.write("</td>");
              out.write("</tr>\n                           ");
              out.write("<tr class=\"tableHeader\">\n                \t\t");
              out.write("<td class=\"tableHeader\" colspan=\"3\">\n                            ");
              if ((delete == null || !delete.equals("true")) && end == 0 && interval > 0) {
                out.write("\n                    \t\tAfter\n                    \t\t");
                out.write("<b>\n                \t\t    ");
                if (dtbeginday > 0) {
                  out.print(dtbeginday);
                  out.write(" days");
                }
                out.write("\n                \t\t    ");
                if (dtbeginhour > 0) {
                  out.print(dtbeginhour);
                  out.write(" hr");
                }
                out.write("\n                \t\t    ");
                if (dtbeginminute > 0) {
                  out.print(dtbeginminute);
                  out.write(" min");
                }
                out.write("\n                \t\t    ");
                if (dtbeginsecond > 0) {
                  out.print(dtbeginsecond);
                  out.write(" sec");
                }
                out.write("\n                \t\t    ");
                if (dtbeginmillisecond > 0) {
                  out.print(dtbeginmillisecond);
                  out.write(" ms");
                }
                out.write("\n                    \t\t");
                out.write(
                    "</b>\n                    \t\tthe system will continue to poll downed nodes at a\n                    \t\t");
                out.write("<b>\n                \t\t    ");
                if (dtintervalday > 0) {
                  out.print(dtintervalday);
                  out.write(" day");
                }
                out.write("\n                \t\t    ");
                if (dtintervalhour > 0) {
                  out.print(dtintervalhour);
                  out.write(" hr");
                }
                out.write("\n                \t\t    ");
                if (dtintervalminute > 0) {
                  out.print(dtintervalminute);
                  out.write(" min");
                }
                out.write("\n                \t\t    ");
                if (dtintervalsecond > 0) {
                  out.print(dtintervalsecond);
                  out.write(" sec");
                }
                out.write("\n                \t\t    ");
                if (dtintervalmillisecond > 0) {
                  out.print(dtintervalmillisecond);
                  out.write(" ms");
                }
                out.write("\n                            ");
                out.write(
                    "</b>\n                            interval.\n                            ");
              }
              out.write("\n                        ");
              out.write("</td>\n                                   ");
              if (i == (ds.length - 2)) {
                out.write("\n                                   ");
              } else {
                out.write("\n                                      ");
                out.write("<td class=\"tableHeader\">&nbsp;");
                out.write("</td>\n                                   ");
              }
              out.write("\n                \t\t");
            }
            out.write("\n            \t\t");
            out.write("</tr>\n            \t\t");
          }
        }
      }

      out.write("\n        ");
      out.write("<!--\n    \t");
      out.write("<TR>\n        \t");
      out.write("<TD align=\"center\">");
      out.write("<INPUT name=\"dtbegin\" type=\"text\" value=\"");
      out.print(begin);
      out.write("\" readonly>");
      out.write("</TD>\n        \t");
      out.write("<TD align=\"center\">");
      out.write("<INPUT name=\"dtend\" type=\"text\" value=\"\">");
      out.write("</TD>\n        \t");
      out.write("<TD align=\"center\">");
      out.write("<INPUT name=\"dtinterval\" type=\"text\" value=\"\">");
      out.write("</TD>\n        \t");
      out.write("<TD align=\"center\">");
      out.write("<INPUT name=\"dtdel\" type=\"checkbox\" value=\"true\" disabled>");
      out.write("</TD>\n        \t");
      out.write("<TD align=\"center\">");
      out.write("<a HREF=\"javascript:addDowntime()\" title=\"Add Downtime Model\">Add Downtime");
      out.write("</a>");
      out.write("</TD>\n    \t");
      out.write("</TR>\n    \t-->\n    \t");

      long dtbeginday = 0;
      long dtbeginhour = 0;
      long dtbeginminute = 0;
      long dtbeginsecond = 0;
      long dtbeginmillisecond = 0;

      long dtendday = 0;
      long dtendhour = 0;
      long dtendminute = 0;
      long dtendsecond = 0;
      long dtendmillisecond = 0;

      long dtintervalday = 0;
      long dtintervalhour = 0;
      long dtintervalminute = 0;
      long dtintervalsecond = 0;
      long dtintervalmillisecond = 0;

      if (addbegin > 0) {
        dtbeginday = addbegin / daymilli;
        addbegin = addbegin - (dtbeginday * daymilli);
      }
      if (addbegin > 0) {
        dtbeginhour = addbegin / hourmlli;
        addbegin = addbegin - (dtbeginhour * hourmlli);
      }
      if (addbegin > 0) {
        dtbeginminute = addbegin / minutemilli;
        addbegin = addbegin - (dtbeginminute * minutemilli);
      }
      if (addbegin > 0) {
        dtbeginsecond = addbegin / secondmilli;
        addbegin = addbegin - (dtbeginsecond * secondmilli);
      }
      if (addbegin > 0) {
        dtbeginmillisecond = addbegin;
      }

      out.write("\n    \t");
      out.write("<tr class=\"tableRowLight\">\n        \t");
      out.write("<td>\n        \t  ");
      out.write("<input type=\"hidden\" name=\"dtbeginday\" value=\"");
      out.print(dtbeginday);
      out.write("\">\n        \t  ");
      out.write("<input type=\"hidden\" name=\"dtbeginhour\" value=\"");
      out.print(dtbeginhour);
      out.write("\">\n        \t  ");
      out.write("<input type=\"hidden\" name=\"dtbeginminute\" value=\"");
      out.print(dtbeginminute);
      out.write("\">\n        \t  ");
      out.write("<input type=\"hidden\" name=\"dtbeginsecond\" value=\"");
      out.print(dtbeginsecond);
      out.write("\">\n        \t  ");
      out.write("<input type=\"hidden\" name=\"dtbeginmillisecond\" value=\"");
      out.print(dtbeginmillisecond);
      out.write("\">\n        \t    ");
      out.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n        \t        ");
      out.write("<tr class=\"tableRowLight\">\n        \t            ");
      out.write("<td nowrap>Days: ");
      out.write("</td>\n        \t            ");
      out.write("<td nowrap>");
      out.print(dtbeginday);
      out.write("</td>\n        \t        ");
      out.write("</tr>\n        \t        ");
      out.write("<tr class=\"tableRowLight\">\n        \t            ");
      out.write("<td nowrap>Hours: ");
      out.write("</td>\n        \t            ");
      out.write("<td nowrap>");
      out.print(dtbeginhour);
      out.write("</td>\n        \t        ");
      out.write("</tr>\n        \t        ");
      out.write("<tr class=\"tableRowLight\">\n        \t            ");
      out.write("<td nowrap>Minutes: ");
      out.write("</td>\n        \t            ");
      out.write("<td nowrap>");
      out.print(dtbeginminute);
      out.write("</td>\n        \t        ");
      out.write("</tr>\n        \t        ");
      out.write("<tr class=\"tableRowLight\">\n        \t            ");
      out.write("<td nowrap>Seconds: ");
      out.write("</td>\n        \t            ");
      out.write("<td nowrap>");
      out.print(dtbeginsecond);
      out.write("</td>\n        \t        ");
      out.write("</tr>\n        \t        ");
      out.write("<tr class=\"tableRowLight\">\n        \t            ");
      out.write("<td nowrap>Milliseconds: ");
      out.write("</td>\n        \t            ");
      out.write("<td nowrap>");
      out.print(dtbeginmillisecond);
      out.write("</td>\n        \t        ");
      out.write("</tr>\n        \t    ");
      out.write("</table>\n        \t");
      out.write("</td>\n        \t");
      out.write("<td>\n        \t    ");
      out.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n        \t        ");
      out.write("<tr class=\"tableRowLight\">\n        \t            ");
      out.write("<td nowrap>Days: ");
      out.write("</td>\n        \t            ");
      out.write("<td nowrap>");
      out.write("<select name=\"dtendday\">\n\t\t        ");
      for (int i = 0; i <= 365; i++) {
        out.write("\n\t\t            ");
        out.write("<option value=");
        out.print(i);
        out.write(" ");
        if (dtendday == i) {
          out.write("selected");
        }
        out.write(">");
        out.print(df3digit.format(i));
        out.write("\n                ");
      }
      out.write("\n\t\t      ");
      out.write("</select>");
      out.write("</td>\n        \t        ");
      out.write("</tr>\n        \t        ");
      out.write("<tr class=\"tableRowLight\">\n        \t            ");
      out.write("<td nowrap>Hours: ");
      out.write("</td>\n        \t            ");
      out.write("<td nowrap>");
      out.write("<select name=\"dtendhour\">\n\t\t        ");
      for (int i = 0; i < 24; i++) {
        out.write("\n\t\t            ");
        out.write("<option value=");
        out.print(i);
        out.write(" ");
        if (dtendhour == i) {
          out.write("selected");
        }
        out.write(">");
        out.print(df3digit.format(i));
        out.write("\n                ");
      }
      out.write("\n\t\t      ");
      out.write("</select>");
      out.write("</td>\n        \t        ");
      out.write("</tr>\n        \t        ");
      out.write("<tr class=\"tableRowLight\">\n        \t            ");
      out.write("<td nowrap>Minutes: ");
      out.write("</td>\n        \t            ");
      out.write("<td nowrap>");
      out.write("<select name=\"dtendminute\">\n\t\t        ");
      for (int i = 0; i < 60; i++) {
        out.write("\n\t\t            ");
        out.write("<option value=");
        out.print(i);
        out.write(" ");
        if (dtendminute == i) {
          out.write("selected");
        }
        out.write(">");
        out.print(df3digit.format(i));
        out.write("\n                ");
      }
      out.write("\n\t\t      ");
      out.write("</select>");
      out.write("</td>\n        \t        ");
      out.write("</tr>\n        \t        ");
      out.write("<tr class=\"tableRowLight\">\n        \t            ");
      out.write("<td nowrap>Seconds: ");
      out.write("</td>\n        \t            ");
      out.write("<td nowrap>");
      out.write("<select name=\"dtendsecond\">\n\t\t        ");
      for (int i = 0; i < 60; i++) {
        out.write("\n\t\t            ");
        out.write("<option value=");
        out.print(i);
        out.write(" ");
        if (dtendsecond == i) {
          out.write("selected");
        }
        out.write(">");
        out.print(df3digit.format(i));
        out.write("\n                ");
      }
      out.write("\n\t\t      ");
      out.write("</select>");
      out.write("</td>\n        \t        ");
      out.write("</tr>\n        \t        ");
      out.write("<tr class=\"tableRowLight\">\n        \t            ");
      out.write("<td nowrap>Milliseconds: ");
      out.write("</td>\n        \t            ");
      out.write("<td nowrap>");
      out.write("<select name=\"dtendmillisecond\">\n\t\t        ");
      for (int i = 0; i < 1000; i++) {
        out.write("\n\t\t            ");
        out.write("<option value=");
        out.print(i);
        out.write(" ");
        if (dtendmillisecond == i) {
          out.write("selected");
        }
        out.write(">");
        out.print(df3digit.format(i));
        out.write("\n                ");
      }
      out.write("\n\t\t      ");
      out.write("</select>");
      out.write("</td>\n        \t        ");
      out.write("</tr>\n        \t    ");
      out.write("</table>\n\n         \t");
      out.write("</td>\n        \t");
      out.write("<td>\n        \t    ");
      out.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n        \t        ");
      out.write("<tr class=\"tableRowLight\">\n        \t            ");
      out.write("<td nowrap>Days: ");
      out.write("</td>\n        \t            ");
      out.write("<td nowrap>");
      out.write("<select name=\"dtintervalday\">\n\t\t        ");
      for (int i = 0; i <= 365; i++) {
        out.write("\n\t\t            ");
        out.write("<option value=");
        out.print(i);
        out.write(" ");
        if (dtintervalday == i) {
          out.write("selected");
        }
        out.write(">");
        out.print(df3digit.format(i));
        out.write("\n                ");
      }
      out.write("\n\t\t      ");
      out.write("</select>");
      out.write("</td>\n        \t        ");
      out.write("</tr>\n        \t        ");
      out.write("<tr class=\"tableRowLight\">\n        \t            ");
      out.write("<td nowrap>Hours: ");
      out.write("</td>\n        \t            ");
      out.write("<td nowrap>");
      out.write("<select name=\"dtintervalhour\">\n\t\t        ");
      for (int i = 0; i < 24; i++) {
        out.write("\n\t\t            ");
        out.write("<option value=");
        out.print(i);
        out.write(" ");
        if (dtintervalhour == i) {
          out.write("selected");
        }
        out.write(">");
        out.print(df3digit.format(i));
        out.write("\n                ");
      }
      out.write("\n\t\t      ");
      out.write("</select>");
      out.write("</td>\n        \t        ");
      out.write("</tr>\n        \t        ");
      out.write("<tr class=\"tableRowLight\">\n        \t            ");
      out.write("<td nowrap>Minutes: ");
      out.write("</td>\n        \t            ");
      out.write("<td nowrap>");
      out.write("<select name=\"dtintervalminute\">\n\t\t        ");
      for (int i = 0; i < 60; i++) {
        out.write("\n\t\t            ");
        out.write("<option value=");
        out.print(i);
        out.write(" ");
        if (dtintervalminute == i) {
          out.write("selected");
        }
        out.write(">");
        out.print(df3digit.format(i));
        out.write("\n                ");
      }
      out.write("\n\t\t      ");
      out.write("</select>");
      out.write("</td>\n        \t        ");
      out.write("</tr>\n        \t        ");
      out.write("<tr class=\"tableRowLight\">\n        \t            ");
      out.write("<td nowrap>Seconds: ");
      out.write("</td>\n        \t            ");
      out.write("<td nowrap>");
      out.write("<select name=\"dtintervalsecond\">\n\t\t        ");
      for (int i = 0; i < 60; i++) {
        out.write("\n\t\t            ");
        out.write("<option value=");
        out.print(i);
        out.write(" ");
        if (dtintervalsecond == i) {
          out.write("selected");
        }
        out.write(">");
        out.print(df3digit.format(i));
        out.write("\n                ");
      }
      out.write("\n\t\t      ");
      out.write("</select>");
      out.write("</td>\n        \t        ");
      out.write("</tr>\n        \t        ");
      out.write("<tr class=\"tableRowLight\">\n        \t            ");
      out.write("<td nowrap>Milliseconds: ");
      out.write("</td>\n        \t            ");
      out.write("<td nowrap>");
      out.write("<select name=\"dtintervalmillisecond\">\n\t\t        ");
      for (int i = 0; i < 1000; i++) {
        out.write("\n\t\t            ");
        out.write("<option value=");
        out.print(i);
        out.write(" ");
        if (dtintervalmillisecond == i) {
          out.write("selected");
        }
        out.write(">");
        out.print(df3digit.format(i));
        out.write("\n                ");
      }
      out.write("\n\t\t      ");
      out.write("</select>");
      out.write("</td>\n        \t        ");
      out.write("</tr>\n        \t    ");
      out.write("</table>\n        \t");
      out.write("</td>\n         \t");
      out.write("<!--\n        \t");
      out.write("<TD align=\"center\">\n        \t");
      out.write("<INPUT name=\"dtdel\" type=\"checkbox\" value=\"true\" disabled>\n        \t");
      out.write("</TD>\n        \t-->\n        \t");
      out.write("<td align=\"center\" nowrap>");
      out.write("<a href=\"javascript:addDowntime()\" title=\"Add Downtime Model\">Add Downtime");
      out.write("</a>");
      out.write("</td>\n    ");
      out.write("</tr>\n    ");
      out.write("<tr class=\"tableRowLight\">\n        ");
      out.write("<td class=\"tableText\" colspan=\"4\">");
      out.write(
          "<img src=\"/wt-portal/images/spacers/spacer.gif\" height=\"4\" width=\"10\" border=\"0\" alt=\"WebTelemetry\">");
      out.write("</td>\n    ");
      out.write("</tr>\n     ");
      out.write("<tr>\n        ");
      out.write("<td colspan=\"4\">");
      out.write("<br />\n        ");
      out.write("<a href=\"javascript:restoreDefaultDowntime()\">");
      out.write(
          "<img src=\"/wt-portal/images/buttons/btn_restore_defaults.gif\" border=\"0\" alt=\"Restore Defaults\">");
      out.write("</a>\n        \n        ");
      out.write("<!--");
      out.write(
          "<input type=\"submit\" name=\"button\" onclick=\"return restoreDefaultDowntime()\" value=\"Restore Defaults\" title=\"Restore Downtime Model Defaults\">-->");
      out.write("<br />\n        ");
      out.write("</td>\n    ");
      out.write("</tr>\n");
      out.write("</table>\n");
      out.write("</form>\n");
      out.write("<!-- BEGIN FRAMING TABLE:close tags-->\n\t\t");
      out.write("</td>\n\t");
      out.write("</tr>\n");
      out.write("</table>\n");
      out.write("<!-- END FRAMING TABLE:close tags-->\n");
      out.write("<p>\n");
      JspRuntimeLibrary.include(
          request, response, "/includes/footer.jsp" + "?" + "location=" + "admin", out, false);
      out.write("\n\n  ");
      out.write("</body>\n");
      out.write("</html>\n");
    } catch (Throwable t) {
      out = _jspx_out;
      if (out != null && out.getBufferSize() != 0) out.clearBuffer();
      if (pageContext != null) pageContext.handlePageException(t);
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
    }
  }