Exemplo n.º 1
0
 public static int[] getLineMarkers(byte[] b) {
   java.util.Vector ls = new java.util.Vector(50000);
   ls.addElement(new Integer(0));
   for (int i = 0; i < b.length - 2; i++) {
     if (b[i] == '\n') {
       ls.addElement(new Integer(i + 1));
     }
   }
   int[] arr = new int[ls.size()];
   for (int i = 0; i < arr.length; i++) {
     arr[i] = ((Integer) ls.elementAt(i)).intValue();
   }
   ls.removeAllElements();
   ls = null;
   return arr;
 }
Exemplo n.º 2
0
 public ParseException generateParseException() {
   jj_expentries.removeAllElements();
   boolean[] la1tokens = new boolean[16];
   for (int i = 0; i < 16; i++) {
     la1tokens[i] = false;
   }
   if (jj_kind >= 0) {
     la1tokens[jj_kind] = true;
     jj_kind = -1;
   }
   for (int i = 0; i < 4; i++) {
     if (jj_la1[i] == jj_gen) {
       for (int j = 0; j < 32; j++) {
         if ((jj_la1_0[i] & (1 << j)) != 0) {
           la1tokens[j] = true;
         }
       }
     }
   }
   for (int i = 0; i < 16; i++) {
     if (la1tokens[i]) {
       jj_expentry = new int[1];
       jj_expentry[0] = i;
       jj_expentries.addElement(jj_expentry);
     }
   }
   int[][] exptokseq = new int[jj_expentries.size()][];
   for (int i = 0; i < jj_expentries.size(); i++) {
     exptokseq[i] = (int[]) jj_expentries.elementAt(i);
   }
   return new ParseException(token, exptokseq, tokenImage);
 }
Exemplo n.º 3
0
 private void jj_add_error_token(int kind, int pos) {
   if (pos >= 100) return;
   if (pos == jj_endpos + 1) {
     jj_lasttokens[jj_endpos++] = kind;
   } else if (jj_endpos != 0) {
     jj_expentry = new int[jj_endpos];
     for (int i = 0; i < jj_endpos; i++) {
       jj_expentry[i] = jj_lasttokens[i];
     }
     boolean exists = false;
     for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements(); ) {
       int[] oldentry = (int[]) (e.nextElement());
       if (oldentry.length == jj_expentry.length) {
         exists = true;
         for (int i = 0; i < jj_expentry.length; i++) {
           if (oldentry[i] != jj_expentry[i]) {
             exists = false;
             break;
           }
         }
         if (exists) break;
       }
     }
     if (!exists) jj_expentries.addElement(jj_expentry);
     if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
   }
 }
Exemplo n.º 4
0
 public java.util.Enumeration getApplets() {
   java.util.Vector applets = new java.util.Vector();
   applets.addElement(target);
   return applets.elements();
 }
  public static void processBrRequisitionFile(
      java.io.File filePortrait2Process,
      biz.systempartners.claims.ClaimsViewer claimsViewer,
      java.util.Vector invoiceVector,
      java.util.Vector filesVector) {

    biz.systempartners.claims.XMLClaimFile xmlClaimFile =
        new biz.systempartners.claims.XMLClaimFile();

    xmlClaimFile.processFile(filePortrait2Process);

    javax.swing.JTable tempInvoiceTable;

    java.util.Vector headerInvoiceVector = new java.util.Vector(1, 1);

    headerInvoiceVector.addElement("Invoice No.");

    //     claimsTable = new javax.swing.JTable(5,4);
    // claimsTable = claimsViewer.getInvoiceTable();
    claimsTable = xmlClaimFile.xmlClaim.getInvoiceTable();
    invoiceTable = claimsViewer.getInvoiceListTable();

    javax.swing.JPanel claimsViewerPanel = claimsViewer.getClaimsViewerPanel();

    javax.swing.JScrollPane jScrollPane11 = claimsViewer.getScrollPane();

    javax.swing.JScrollPane invoiceScrollPane = claimsViewer.getInvoiceListScrollPane();

    invoiceVector = claimsViewer.getInvoiceVector();

    java.util.Vector invoiceChildVector = new java.util.Vector(1, 1);
    javax.swing.JTextField patientNo = claimsViewer.getPatientNo();
    javax.swing.JTextField patientName = claimsViewer.getPatientName();
    javax.swing.JTextField schemeMemberNo = claimsViewer.getSchemeMemberNo();
    javax.swing.JTextField schemeName = claimsViewer.getSchemeName();
    javax.swing.JTextField schemePayer = claimsViewer.getSchemePayer();
    javax.swing.JTextField accountNo = claimsViewer.getAccountNo();
    javax.swing.JTextField invoiceNo = claimsViewer.getInvoiceNo();
    javax.swing.JTextField healthCareProvider = claimsViewer.getHealthCareProvider();

    jScrollPane11.setViewportView(claimsTable);
    if (claimsViewer.isShowing()) {
      claimsViewer.validate();
    } else {
      claimsViewer.setExtendedState(javax.swing.JFrame.MAXIMIZED_BOTH);
      claimsViewer.setVisible(true);
    }

    claimsViewer.invalidate();

    // try {

    //     try {

    //   java.io.FileInputStream requisFileIOStream = new
    // java.io.FileInputStream(filePortrait2Process);

    //   java.io.ObjectInputStream requisObjInStream = new
    // java.io.ObjectInputStream(requisFileIOStream);

    //                javax.swing.table.JTableHeader claimsTableHeader =
    // (javax.swing.table.JTableHeader)requisObjInStream.readObject();

    //  requisTable = (javax.swing.JTable)requisObjInStream.readObject();

    //  String invoiceNoString = (java.lang.String)requisObjInStream.readObject();
    String invoiceNoString = xmlClaimFile.xmlClaim.getInvoiceNumber();
    invoiceNo.setText(invoiceNoString);

    //  patientNo.setText((java.lang.String)requisObjInStream.readObject());
    patientNo.setText(xmlClaimFile.xmlClaim.getPatientNumber());
    System.out.println(
        "PATIENT NUMBER : "
            + xmlClaimFile.xmlClaim.getPatientNumber()
            + "   "
            + xmlClaimFile.xmlClaim.getPatientName()
            + "  "
            + xmlClaimFile.xmlClaim.getSchemeName());
    // patientName.setText((java.lang.String)requisObjInStream.readObject());
    patientName.setText(xmlClaimFile.xmlClaim.getPatientName());
    //   schemeMemberNo.setText((java.lang.String)requisObjInStream.readObject());
    schemeMemberNo.setText(xmlClaimFile.xmlClaim.getSchemeMemberNumber());
    //   schemeName.setText((java.lang.String)requisObjInStream.readObject());
    schemeName.setText(xmlClaimFile.xmlClaim.getSchemeName());
    //  schemePayer.setText((java.lang.String)requisObjInStream.readObject());
    schemePayer.setText(xmlClaimFile.xmlClaim.getSchemePayer());
    //  accountNo.setText((java.lang.String)requisObjInStream.readObject());
    accountNo.setText(xmlClaimFile.xmlClaim.getAccountNumber());
    healthCareProvider.setText(xmlClaimFile.xmlClaim.getHealthCareProvider());

    tempInvoiceTable = new javax.swing.JTable(invoiceVector, headerInvoiceVector);
    invoiceChildVector.add(invoiceNoString);
    invoiceChildVector.add(filePortrait2Process.getPath());
    if (filesVector == null) {
      filesVector = new java.util.Vector(1, 1);
    }

    filesVector.add(filePortrait2Process.getAbsolutePath());
    claimsViewer.filesVector = filesVector;
    if (invoiceVector == null) {
      invoiceVector = new java.util.Vector(1, 1);
    }
    invoiceVector.add(invoiceChildVector);
    /*
    invoiceNo.setText(invoiceNoString);
    invoiceChildVector.add(invoiceNoString);
    invoiceChildVector.add(filePortrait2Process.getPath());
    filesVector.add(filePortrait2Process.getAbsolutePath());
    //                System.out.println("Child Cector Size ="+invoiceChildVector.size());
    //                System.out.println("File saved in child vector ="+filePortrait2Process.getPath());
    invoiceVector.add(invoiceChildVector);
    //                            for (int j = 0; j < invoiceChildVector.capacity(); j++) {
    //                System.out.println("Child entry ["+invoiceChildVector.elementAt(j)+"]");
    //            }
    patientNo.setText((java.lang.String)requisObjInStream.readObject());

    patientName.setText((java.lang.String)requisObjInStream.readObject());

    schemeMemberNo.setText((java.lang.String)requisObjInStream.readObject());

    schemeName.setText((java.lang.String)requisObjInStream.readObject());

    schemePayer.setText((java.lang.String)requisObjInStream.readObject());

    accountNo.setText((java.lang.String)requisObjInStream.readObject());
    */
    tempInvoiceTable = new javax.swing.JTable(invoiceVector, headerInvoiceVector);

    System.out.println("Starting to populate tables ...");
    /**
     * for (int i = 0; i < requisTable.getModel().getRowCount(); i++) {
     *
     * <p>for (int j = 0; j < requisTable.getModel().getColumnCount(); j++){
     *
     * <p>if (requisTable.getValueAt(i,0) != null) {
     *
     * <p>claimsTable.setValueAt(requisTable.getValueAt(i,j), i, j);
     *
     * <p>System.out.println(requisTable.getValueAt(i,j)); } } }
     */
    for (int i = 0; i < tempInvoiceTable.getModel().getRowCount(); i++) {

      for (int j = 0; j < tempInvoiceTable.getModel().getColumnCount(); j++) {

        if (tempInvoiceTable.getValueAt(i, 0) != null) {

          invoiceTable.setValueAt(tempInvoiceTable.getValueAt(i, j), i, j);
          System.out.println("Invoices : " + tempInvoiceTable.getValueAt(i, j));
          System.out.println(tempInvoiceTable.getValueAt(i, j));
        }
      }
    }

    //        claimsTable.setModel(requisTable.getModel());

    gridBagConstraints = new java.awt.GridBagConstraints();

    gridBagConstraints.gridx = 0;

    gridBagConstraints.gridy = 0;

    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;

    gridBagConstraints.weightx = 1.0;

    gridBagConstraints.weighty = 100.0;

    claimsViewerPanel.removeAll();

    claimsViewerPanel.add(jScrollPane11, gridBagConstraints);

    invoiceScrollPane.setViewportView(invoiceTable);

    jScrollPane11.setViewportView(claimsTable);

    claimsViewerPanel.validate();

    for (int i = 0; i < invoiceVector.size(); i++) {

      java.util.Vector childVector = (java.util.Vector) invoiceVector.elementAt(i);

      for (int j = 0; j < childVector.size(); j++) {

        //               System.out.println("Child entry at ---- !!! ["+j+"] is
        // ["+childVector.elementAt(j)+"]");

        File file2SelectedInvoice;

        file2SelectedInvoice = new java.io.File(childVector.elementAt(j).toString());

        System.out.println("Selected File ---- !!!!! [" + file2SelectedInvoice.getPath() + "]");
      }

      //           for (int j = 0; j < childVector.size(); j++) {

      //            if  (childVector.elementAt(0).toString().equalsIgnoreCase(invoiceNo)) {

      //           }
      //        }

    }

    //   } catch(java.lang.ClassNotFoundException cnfExec) {

    //       javax.swing.JOptionPane.showMessageDialog(new java.awt.Frame(), cnfExec.getMessage());

    //    }

    // } catch(java.io.IOException ioExec) {

    //    javax.swing.JOptionPane.showMessageDialog(new java.awt.Frame(), ioExec.getMessage());

    //  }
  }
  /**
   * Method for reading in data file, in a given format. Namely:
   *
   * <pre>
   * 881003,0.0000,14.1944,13.9444,14.0832,2200050,0
   * 881004,0.0000,14.1668,14.0556,14.1668,1490850,0
   * ...
   * 990108,35.8125,36.7500,35.5625,35.8125,4381200,0
   * 990111,35.8125,35.8750,34.8750,35.1250,3920800,0
   * 990112,34.8750,34.8750,34.0000,34.0625,3577500,0
   * </pre>
   *
   * <p>Where the fields represent, one believes, the following:
   *
   * <ol>
   *   <li>The date in 'YYMMDD' format
   *   <li>Open
   *   <li>High
   *   <li>Low
   *   <li>Last
   *   <li>Volume
   *   <li>Open Interest
   * </ol>
   *
   * One will probably make use of the closing price, but this can be redefined via the class
   * variable <code>DATUMFIELD</code>. Note that since the read in data are then used to compute the
   * return, this would be a good place to trap for zero values in the data, which will cause all
   * sorts of problems.
   *
   * @param dirName the directory in which to search for the data file.
   * @param filename the data filename itself.
   * @exception DemoException thrown if there was a problem with the data file.
   */
  private void readRatesFile(String dirName, String filename) throws DemoException {
    java.io.File ratesFile = new File(filename);
    java.io.BufferedReader in;
    try {
      InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(filename);

      //    if( ! ratesFile.canRead() ) {
      //      throw new DemoException("Cannot read the file "+ratesFile.toString());
      //    }

      in = new BufferedReader(new InputStreamReader(inputStream));
    } catch (Exception fnfex) {
      throw new DemoException(fnfex.toString());
    }
    //
    // Proceed to read all the lines of data into a Vector object.
    int iLine = 0, initNlines = 100, nLines = 0;

    String aLine;
    java.util.Vector allLines = new Vector(initNlines);
    try {
      while ((aLine = in.readLine()) != null) {
        iLine++;
        //
        // Note, I'm not entirely sure whether the object passed in is copied
        // by value, or just its reference.
        allLines.addElement(aLine);
      }
    } catch (IOException ioex) {
      throw new DemoException("Problem reading data from the file " + ioex.toString());
    }
    nLines = iLine;
    //
    // Now create an array to store the rates data.
    this.pathValue = new double[nLines];
    this.pathDate = new int[nLines];
    nAcceptedPathValue = 0;
    iLine = 0;
    for (java.util.Enumeration enum1 = allLines.elements(); enum1.hasMoreElements(); ) {
      aLine = (String) enum1.nextElement();
      String[] field = Utilities.splitString(",", aLine);
      int aDate = Integer.parseInt("19" + field[0]);
      //
      // static double Double.parseDouble() method is a feature of JDK1.2!
      double aPathValue = Double.valueOf(field[DATUMFIELD]).doubleValue();
      if ((aDate <= MINIMUMDATE) || (Math.abs(aPathValue) < EPSILON)) {
        dbgPrintln("Skipped erroneous data in " + filename + " indexed by date=" + field[0] + ".");
      } else {
        pathDate[iLine] = aDate;
        pathValue[iLine] = aPathValue;
        iLine++;
      }
    }
    //
    // Record the actual number of accepted data points.
    nAcceptedPathValue = iLine;
    //
    // Now to fill in the structures from the 'PathId' class.
    set_name(ratesFile.getName());
    set_startDate(pathDate[0]);
    set_endDate(pathDate[nAcceptedPathValue - 1]);
    set_dTime((double) (1.0 / 365.0));
  }