Exemplo n.º 1
1
 public void fireEvent(NCCPConnection.ConnectionEvent e) {
   ConnectionListener l;
   int max = listeners.size();
   for (int i = 0; i < max; ++i) {
     ExpCoordinator.print(
         new String(
             "NCCPConnection.fireEvent ("
                 + toString()
                 + ") event: "
                 + e.getType()
                 + " max:"
                 + max
                 + " i:"
                 + i),
         2);
     l = (ConnectionListener) (listeners.elementAt(i));
     switch (e.getType()) {
       case ConnectionEvent.CONNECTION_FAILED:
         l.connectionFailed(e);
         break;
       case ConnectionEvent.CONNECTION_CLOSED:
         l.connectionClosed(e);
         break;
       case ConnectionEvent.CONNECTION_OPENED:
         ExpCoordinator.printer.print(
             new String("Opened control connection (" + toString() + ")"));
         l.connectionOpened(e);
     }
   }
 }
Exemplo n.º 2
0
  /* Add a manifest file at current position in a stream
   */
  public void stream(OutputStream os, Vector extraFiles) throws IOException {

    /* the first header in the file should be the global one.
     * It should say "Manifest-Version: x.x"; barf if not
     */
    MessageHeader globals = (MessageHeader) entries.elementAt(0);
    if (globals.findValue("Manifest-Version") == null) {
      throw new IOException("Manifest file requires " + "Manifest-Version: 1.0 in 1st header");
    }

    PrintWriter ps = new PrintWriter(os);
    globals.print(ps);

    for (int i = 1; i < entries.size(); ++i) {
      MessageHeader mh = (MessageHeader) entries.elementAt(i);

      mh.print(ps);

      /* REMIND: could be adding files twice!!! */
      String name = mh.findValue("name");
      if (extraFiles != null && name != null) {
        extraFiles.addElement(name);
      }
    }
  }
 public boolean checkEvents(BundleEvent[] expevents) {
   boolean res = true;
   for (int i = 0; i < 20; i++) {
     try {
       Thread.sleep(100);
     } catch (InterruptedException ignore) {
     }
     if (events.size() == expevents.length) {
       break;
     }
   }
   if (events.size() == expevents.length) {
     for (int i = 0; i < events.size(); i++) {
       BundleEvent be = (BundleEvent) events.elementAt(i);
       if (!(be.getBundle().equals(expevents[i].getBundle())
           && be.getType() == expevents[i].getType())) {
         res = false;
       }
     }
   } else {
     res = false;
   }
   if (!res) {
     out.println("Real events");
     for (int i = 0; i < events.size(); i++) {
       BundleEvent be = (BundleEvent) events.elementAt(i);
       out.println("Event " + be.getBundle() + ", Type " + be.getType());
     }
     out.println("Expected events");
     for (int i = 0; i < expevents.length; i++) {
       out.println("Event " + expevents[i].getBundle() + ", Type " + expevents[i].getType());
     }
   }
   return res;
 }
Exemplo n.º 4
0
  /** Tail-recursive algorithm to generate all factory signatures */
  private static void makeFactoryNames(
      String prefix, Vector arguments, int startIndex, Vector results) {

    // if startIndex == arguments.size, then simply add the prefix to the results
    if (startIndex == arguments.size()) {
      if (s_allFactorySignatures.contains(prefix))
        throw new RuntimeException(
            "Constructor signature collision detected: Factory already registered with prefix "
                + prefix);

      results.add(prefix);
      assert (DebugMsg.debugMsg("ClassWriter", "makeFactoryNames:adding:" + prefix));
      s_allFactorySignatures.add(prefix);
      return;
    }

    // Otherwise, iterate over each element of arguments, and call recursively with adjusted input
    Vector currentAlternates = (Vector) arguments.elementAt(startIndex);
    for (int i = 0; i < currentAlternates.size(); i++) {
      makeFactoryNames(
          prefix + ":" + (String) currentAlternates.elementAt(i),
          arguments,
          startIndex + 1,
          results);
    }
  }
  // Returns boolean values: PASSED or FAILED
  private static boolean checkNames(
      Vector<String> expNames, Vector<String> retNames, String failMsg) {
    boolean status = PASSED;

    if (expNames.size() != retNames.size()) {
      status = FAILED;
    } else {
      boolean checked[] = new boolean[retNames.size()];
      for (int i = 0; i < expNames.size(); i++) {
        int j = 0;
        for (; j < retNames.size(); j++) {
          if (!checked[j] && expNames.elementAt(i).equals(retNames.elementAt(j))) {
            checked[j] = true;
            break;
          }
        }
        if (j >= retNames.size()) {
          status = FAILED;
          break;
        }
      }
    }
    if (!status) {
      printFailMsg(expNames, retNames, failMsg);
    }
    return status;
  }
Exemplo n.º 6
0
  public Message(String message) {
    Vector indexes = new Vector();
    int pos1 = message.indexOf(NMC_STATUS);
    if (pos1 != -1) {
      indexes.addElement(new Index(NMC_STATUS, pos1));
    }

    int pos2 = message.indexOf(NMC_ERRTYPE);
    if (pos2 != -1) {
      indexes.addElement(new Index(NMC_ERRTYPE, pos2));
    }

    int pos3 = message.indexOf(NMC_ERRINFO);
    if (pos3 != -1) {
      indexes.addElement(new Index(NMC_ERRINFO, pos3));
    }

    int pos4 = message.indexOf(NMC_ERRDETAIL);
    if (pos4 != -1) {
      indexes.addElement(new Index(NMC_ERRDETAIL, pos4));
    }

    int pos5 = message.indexOf(NMC_DESCRIPTION);
    if (pos5 != -1) {
      indexes.addElement(new Index(NMC_DESCRIPTION, pos5));
    }

    int extraIndex =
        message.indexOf('\n', Math.max(Math.max(Math.max(pos1, pos2), Math.max(pos3, pos4)), pos5));
    if (extraIndex != -1) {
      NMC_Extra = message.substring(extraIndex + 1, message.length());

      /* temp solution until Yu-Jen can think up another header schema */
      NMC_Extra = KeyCertUtility.replace(NMC_Extra, "Content-type: text/html", "");
    }
    indexes.addElement(new Index(NMC_EXTRA, extraIndex + 1));

    int size = indexes.size();
    for (int i = 0; i < size - 1; i++) {
      Index beginIndex = (Index) (indexes.elementAt(i));
      Index endIndex = (Index) (indexes.elementAt(i + 1));
      if (beginIndex.getIndexValue().equals(NMC_STATUS)) {
        String val =
            message.substring(beginIndex.getPos() + NMC_STATUS.length(), endIndex.getPos());
        NMC_Status = Integer.parseInt(val.trim());
      } else if (beginIndex.getIndexValue().equals(NMC_DESCRIPTION)) {
        NMC_Description =
            message.substring(beginIndex.getPos() + NMC_DESCRIPTION.length(), endIndex.getPos());
      } else if (beginIndex.getIndexValue().equals(NMC_ERRTYPE)) {
        NMC_ErrType =
            message.substring(beginIndex.getPos() + NMC_ERRTYPE.length(), endIndex.getPos());
      } else if (beginIndex.getIndexValue().equals(NMC_ERRINFO)) {
        NMC_ErrInfo =
            message.substring(beginIndex.getPos() + NMC_ERRINFO.length(), endIndex.getPos());
      } else if (beginIndex.getIndexValue().equals(NMC_ERRDETAIL)) {
        NMC_ErrDetail =
            message.substring(beginIndex.getPos() + NMC_ERRDETAIL.length(), endIndex.getPos());
      }
    }
  }
Exemplo n.º 7
0
    public void actionPerformed(java.awt.event.ActionEvent arg0) {
      if (JTable1.getSelectedRowCount() != 1) {
        Utilities.errorMessage(resourceBundle.getString("Please select a view to delete"));
        return;
      }

      if (JOptionPane.showConfirmDialog(
              null,
              resourceBundle.getString("Are you sure you want to delete the selected view "),
              resourceBundle.getString("Warning!"),
              JOptionPane.YES_NO_OPTION,
              JOptionPane.WARNING_MESSAGE,
              null)
          == JOptionPane.NO_OPTION) return;

      Vector viewvec = model.getAllViews();
      for (int i = 0; i < viewvec.size(); i++) {
        String viewname = ((AuthViewWithOperations) viewvec.elementAt(i)).getAuthorizedViewName();
        if (JTable1.getValueAt(JTable1.getSelectedRow(), 0).toString().equals(viewname)) {
          AuthViewWithOperations avop = (AuthViewWithOperations) viewvec.elementAt(i);

          model.delViewOp(
              avop.getAuthorizedViewName(), avop.getViewProperties(), avop.getOperations());
        }
      }

      disableButtons();
    }
Exemplo n.º 8
0
    public void actionPerformed(java.awt.event.ActionEvent arg0) {

      if (JTable1.getSelectedRowCount() != 1) {

        Utilities.errorMessage(resourceBundle.getString("Please select a view to edit"));
        return;
      }

      views = new ViewsWizard(ViewConfig.this, applet);
      views.setSecurityModel(model);
      Point p = JLabel1.getLocationOnScreen();
      views.setLocation(p);
      views.init();

      views.setState(false);
      Vector viewvec = model.getAllViews();
      for (int i = 0; i < viewvec.size(); i++) {
        String viewname = ((AuthViewWithOperations) viewvec.elementAt(i)).getAuthorizedViewName();
        if (JTable1.getValueAt(JTable1.getSelectedRow(), 0).toString().equals(viewname)) {
          views.setValues((AuthViewWithOperations) viewvec.elementAt(i));
        }
      }

      disableButtons();
      views.setVisible(true);
    }
  public void doGet(HttpServletRequest req, HttpServletResponse res)
      throws IOException, ServletException {
    res.setContentType("text/html");
    try {
      PrintWriter pw = res.getWriter();
      pw.println("<html><head><TITLE>Web-Enabled Automated Manufacturing System</TITLE></head>");
      pw.println(
          "<body><br><br><br><form name=modifyuser method=post action='http://peers:8080/servlet/showUser')");
      v = U.allUsers();
      pw.println("<table align='center' border=0> <tr><td>");
      pw.println(
          "Select User Name To Modify</td><td><SELECT id=select1 name=uid style='HEIGHT: 22px; LEFT: 74px; TOP: 222px; WIDTH: 155px'>");
      pw.println("<OPTION selected value=''></OPTION>");
      for (i = 0; i < v.size(); i++)
        pw.println(
            "<OPTION value="
                + (String) v.elementAt(i)
                + ">"
                + (String) v.elementAt(i)
                + "</OPTION>");
      pw.println(
          "</SELECT></td></tr><tr><td></td><td><input type='submit' name='submit' value='Submit'></td></tr></table></form></body></html>");
      pw.flush();
      pw.close();

    } catch (Exception e) {
    }
  }
Exemplo n.º 10
0
 public PDBChain findChain(String id) {
   for (int i = 0; i < chains.size(); i++) {
     // System.out.println("ID = " + id + " " +((PDBChain)chains.elementAt(i)).id);
     if (((PDBChain) chains.elementAt(i)).id.equals(id)) {
       return (PDBChain) chains.elementAt(i);
     }
   }
   return null;
 }
 /** Get the data for a row */
 public SOAPMonitorData getData(int row) {
   SOAPMonitorData soap = null;
   if (filter_data == null) {
     soap = (SOAPMonitorData) data.elementAt(row);
   } else {
     soap = (SOAPMonitorData) filter_data.elementAt(row);
   }
   return soap;
 }
Exemplo n.º 12
0
 private void setProcedureCount(String name, int count, Vector list) {
   for (int i = 0; i < list.size(); i++)
     if (((KeyValue) list.elementAt(i)).key.compareTo(name) == 0) {
       ((KeyValue) list.elementAt(i)).intValue = count;
       return;
     }
   list.addElement(new KeyValue(name, count));
   return;
 } // end of PrologCompiler.setProcedureCount(String, int, Vector)
Exemplo n.º 13
0
  public void paint(Graphics g) {
    System.out.println("paint");
    Graphics2D g2d = (Graphics2D) g;

    Point1 p1, p2;

    n = paintInfo.size();

    if (toolFlag == 2) g2d.clearRect(0, 0, getSize().width - 100, getSize().height - 100); // 清除

    for (int i = 0; i < n - 1; i++) {
      p1 = (Point1) paintInfo.elementAt(i);
      p2 = (Point1) paintInfo.elementAt(i + 1);
      size = new BasicStroke(p1.boarder, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);

      g2d.setColor(p1.col);
      g2d.setStroke(size);

      if (p1.tool == p2.tool) {
        switch (p1.tool) {
          case 0: // 画笔
            Line2D line1 = new Line2D.Double(p1.x, p1.y, p2.x, p2.y);
            g2d.draw(line1);
            break;

          case 1: // 橡皮
            g.clearRect(p1.x, p1.y, p1.boarder, p1.boarder);
            break;

          case 3: // 画直线
            Line2D line2 = new Line2D.Double(p1.x, p1.y, p2.x, p2.y);
            g2d.draw(line2);
            break;

          case 4: // 画圆
            Ellipse2D ellipse =
                new Ellipse2D.Double(p1.x, p1.y, Math.abs(p2.x - p1.x), Math.abs(p2.y - p1.y));
            g2d.draw(ellipse);
            break;

          case 5: // 画矩形
            Rectangle2D rect =
                new Rectangle2D.Double(p1.x, p1.y, Math.abs(p2.x - p1.x), Math.abs(p2.y - p1.y));
            g2d.draw(rect);
            break;

          case 6: // 截断,跳过
            i = i + 1;
            break;

          default:
        } // end switch
      } // end if
    } // end for
  }
Exemplo n.º 14
0
  private void writeListErrors(
      FileWriter fileOut,
      Vector deviationMessages,
      Vector databaseValues,
      String ind,
      char delimeter,
      String variable,
      String value,
      String date,
      String ref,
      String comm) {

    try {

      if (errorList.size() > 0 || deviationMessages.size() > 0 || warningList.size() > 0) {
        fileOut.write("#--------------------------------------------------\n");
      }
      if (errorList.size() > 0) {
        for (int i = 0; i < errorList.size(); i++) {
          fileOut.write("#" + (String) errorList.get(i) + "\n");
        }
      }
      if (warningList.size() > 0) {
        for (int i = 0; i < warningList.size(); i++) {
          fileOut.write("#" + (String) warningList.get(i) + "\n");
        }
      }

      if (deviationMessages.size() > 0) {
        for (int i = 0; i < deviationMessages.size(); i++) {
          fileOut.write("#" + (String) deviationMessages.elementAt(i) + "\n");
        }
        // write old values
        fileOut.write("#" + databaseValues.elementAt(0) + "\n");
      }
      // if there are errors, the string is "Outcommented"
      if (errorList.size() > 0) {
        fileOut.write("#");
      }

      // write original string
      fileOut.write(
          ind + delimeter + variable + delimeter + value + delimeter + date + delimeter + ref
              + delimeter + comm + "\n");

      if (errorList.size() > 0 || deviationMessages.size() > 0 || warningList.size() > 0) {
        fileOut.write("#--------------------------------------------------\n");
      }

    } // try
    catch (Exception e) {
      e.printStackTrace(System.err);
    }
  }
Exemplo n.º 15
0
  /**
   * This Method returns the 2D Array which is the list of the Items for the selected WorkOrder of
   * the Customer.
   *
   * @param workorderId - WorkOrder Id Foreign Key of WRK_ORDR_DETS table
   * @return Object[][] - 2D Array which is List of the Items for the WorkOrder
   */
  public Object[][] getWorkOrderItems(long workorderId) throws RemoteException {

    WrkOrdrDets wrkordrdts_obj = new WrkOrdrDets(conn);

    RHCCBlgKeys blgkeys_obj = new RHCCBlgKeys(conn);

    Vector workorderdetList = wrkordrdts_obj.getProductList(workorderId);

    // Hashtable BSysList = (Hashtable) USFEnv.getBillSystems();
    BlgSys blgsys = new BlgSys();

    Hashtable BSysList = (Hashtable) blgsys.searchBlgSys();

    Enumeration BSys = BSysList.keys();

    // The 2-Dimensional array to hold the Items Billing System wise.
    Object[][] prodList = new Object[BSysList.size()][workorderdetList.size() + 1];

    // The Number of Billing Systems are assumed to be equal to the
    // Static Load Billing Systems Hashtable size. The Billing Systems will
    // be in order starting from 1 and incrementing by one.
    for (int i = 0; i < BSysList.size(); i++) {
      // Set the 2D array to store the Billing System as the first element
      // of each row.
      prodList[i][0] = String.valueOf(i + 1);
    }

    // Loop throught the WorkOrder Items List and place them in the appropriate
    // positions in the 2D array.
    for (int j = 0; j < workorderdetList.size(); j++) {
      // Determine the Billing System of the Product
      Vector tmpVector = new Vector();

      WrkOrdrDets workorderObj = (WrkOrdrDets) workorderdetList.elementAt(j);

      RHCCBlgKeys bkObj =
          blgkeys_obj.searchRHCCBlgKeys(((WrkOrdrDets) workorderdetList.elementAt(j)).getRBKID());
      int bsid = (new Long(bkObj.getBsId())).intValue();

      tmpVector.addElement(bkObj);
      tmpVector.addElement(workorderObj);

      // Based on the Billing System Id retreived place the Product Object
      // in the 2D array.
      int k = 1;
      while (prodList[bsid - 1][k] != null) {
        k = k + 1;
      }
      prodList[bsid - 1][k] = tmpVector;
    }

    // Return the 2D array
    return prodList;
  }
 /** Remove a message from the table */
 public void removeRow(int row) {
   SOAPMonitorData soap = null;
   if (filter_data == null) {
     soap = (SOAPMonitorData) data.elementAt(row);
     data.remove(soap);
   } else {
     soap = (SOAPMonitorData) filter_data.elementAt(row);
     filter_data.remove(soap);
     data.remove(soap);
   }
   fireTableRowsDeleted(row, row);
 }
Exemplo n.º 17
0
  /**
   * This method returns an array of all the tables referenced in the datastore.
   *
   * @param updateable True if the table list should only include updateable tables and false if it
   *     should include all.
   */
  public String[] getTableList(boolean updateable) {

    DSColumnDescriptor col = null;

    Vector tables = new Vector();
    Vector pkey = new Vector();

    for (int i = 0; i < _desc.getColumnCount(); i++) {
      col = _desc.getColumn(i);
      String tableName = col.getTable();
      if (tableName == null) tableName = _desc.getDefaultTable();

      if ((!updateable) || col.isUpdateable()) {
        boolean found = false;
        for (int j = 0; j < tables.size(); j++) {
          if ((tables.elementAt(j)).equals(tableName)) {
            if (col.isPrimaryKey()) pkey.setElementAt(new Boolean(true), j);
            found = true;
            break;
          }
        }
        if (!found && tableName != null) {
          tables.addElement(tableName);
          pkey.addElement(new Boolean(col.isPrimaryKey()));
        }
      }
    }

    if (updateable) {
      for (int i = pkey.size() - 1; i > -1; i--) {
        if (!((Boolean) pkey.elementAt(i)).booleanValue()) tables.removeElementAt(i);
      }
    } else {
      for (int i = 0; i < getAliasCount(); i++) {
        try {
          String table = getTable(i);
          boolean found = false;
          for (int j = 0; j < tables.size(); j++) {
            if ((tables.elementAt(j)).equals(table)) found = true;
          }
          if (!found && table != null) tables.addElement(table);
        } catch (Exception e) {
        }
      }
    }

    String retVal[] = new String[tables.size()];
    tables.copyInto(retVal);

    return retVal;
  }
  /** Append the string containing the SQL insert string for the given table. */
  protected SQLCall buildCallWithoutReturning(AbstractSession session) {
    SQLCall call = new SQLCall();
    call.returnNothing();

    Writer writer = new CharArrayWriter(200);
    try {
      writer.write("INSERT ");
      if (getHintString() != null) {
        writer.write(getHintString());
        writer.write(" ");
      }
      writer.write("INTO ");
      writer.write(getTable().getQualifiedNameDelimited(session.getPlatform()));
      writer.write(" (");

      Vector fieldsForTable = new Vector();
      for (Enumeration fieldsEnum = getModifyRow().keys(); fieldsEnum.hasMoreElements(); ) {
        DatabaseField field = (DatabaseField) fieldsEnum.nextElement();
        if (field.getTable().equals(getTable()) || (!field.hasTableName())) {
          fieldsForTable.addElement(field);
        }
      }

      if (fieldsForTable.isEmpty()) {
        throw QueryException.objectToInsertIsEmpty(getTable());
      }

      for (int i = 0; i < fieldsForTable.size(); i++) {
        writer.write(
            ((DatabaseField) fieldsForTable.elementAt(i)).getNameDelimited(session.getPlatform()));
        if ((i + 1) < fieldsForTable.size()) {
          writer.write(", ");
        }
      }
      writer.write(") VALUES (");

      for (int i = 0; i < fieldsForTable.size(); i++) {
        DatabaseField field = (DatabaseField) fieldsForTable.elementAt(i);
        call.appendModify(writer, field);
        if ((i + 1) < fieldsForTable.size()) {
          writer.write(", ");
        }
      }
      writer.write(")");

      call.setSQLString(writer.toString());
    } catch (IOException exception) {
      throw ValidationException.fileError(exception);
    }
    return call;
  }
Exemplo n.º 19
0
 private boolean checkSocket(Socket s) {
   int l = deny.size();
   byte address[] = s.getInetAddress().getAddress();
   for (int i = 0; i < l; i++) {
     AddressMatcher match = (AddressMatcher) deny.elementAt(i);
     if (match.matches(address)) return false;
   }
   l = accept.size();
   for (int i = 0; i < l; i++) {
     AddressMatcher match = (AddressMatcher) accept.elementAt(i);
     if (match.matches(address)) return true;
   }
   return false;
 }
Exemplo n.º 20
0
  protected Vector /* of TTPNode */ queryPNodes1(String query) throws IOException {
    write(query);
    Vector lines = readlines();
    Vector r = new Vector();
    for (Enumeration e = lines.elements(); e.hasMoreElements(); ) {
      Vector line = stringToVector((String) e.nextElement(), ":");

      TTLexEntry le = new TTLexEntry();
      le.citationForm = (String) line.elementAt(0);
      le.features = (String) line.elementAt(1);
      le.inflection = (String) line.elementAt(2);
      le.inflFeatures = (String) line.elementAt(3);

      TTLexEntryToObj leo = new TTLexEntryToObj();
      leo.lexentry = le;
      leo.objname = (String) line.elementAt(4);
      leo.features = (String) line.elementAt(5);

      TTPNode pn = new TTPNode();
      pn.feature = TT.featureGet(le.features, TT.FT_POS, TT.F_NULL);
      pn.leo = leo;
      pn.startpos = TT.longParse((String) line.elementAt(8), true);
      pn.endpos = TT.longParse((String) line.elementAt(9), true);

      r.addElement(pn);
    }
    return r;
  }
Exemplo n.º 21
0
 protected String convertFields(String fields, JClass currentClass)
     throws SchemaException, IOException {
   Vector tokens = Tokenizer.tokenize(fields, ",", "/");
   Debugger.trace(fields + " token-size=" + tokens.size(), Debugger.VERBOSE);
   String sOut;
   if (tokens == null || tokens.size() < 1)
     throw new SchemaException(
         "Invalid constraint specification ", currentClass.getSchemaFileName());
   else sOut = jToSql((String) tokens.elementAt(0), currentClass);
   for (int j = 1; j < tokens.size(); j++) {
     sOut += "," + jToSql((String) tokens.elementAt(j), currentClass);
   }
   return sOut;
 }
Exemplo n.º 22
0
 public static void main(String[] args) throws Exception {
   Scanner s = new Scanner(new FileReader("rk.txt"));
   Vector<String> list = new Vector<String>();
   while (s.hasNext()) {
     list.addElement(s.next().replaceAll(";", ","));
   }
   System.out.println(list.size());
   PrintWriter printer = new PrintWriter(new FileWriter("out.txt"));
   printer.print("char matrix[1200][50] = {");
   printer.print("\"" + list.elementAt(0) + "\"");
   for (int i = 1; i < list.size(); i++) printer.print(", \"" + list.elementAt(i) + "\"");
   printer.println("};");
   printer.close();
 }
 public boolean action(Event e, Object arg) {
   System.out.println(e + " " + arg);
   if (e.target == bf.tf) {
     System.out.println("new page");
     String url = bf.tf.getText();
     pages.addElement(url);
     String page = split(url);
     System.out.println("Server = " + server);
     System.out.println("Port = " + port);
     System.out.println("Page = " + page);
     connect(page);
     position++;
     bf.back.enable();
     return true;
   } else if (e.target == bf.back) {
     System.out.println("pos " + position + " " + pages.size());
     if (position > 0) {
       position--;
       String page = split((String) pages.elementAt(position));
       bf.tf.setText((String) pages.elementAt(position));
       connect(page);
       if (position == 0) {
         bf.back.disable();
       }
       bf.forward.enable();
     }
     return true;
   } else if (e.target == bf.forward) {
     if (position != pages.size() - 1) {
       position++;
       bf.tf.setText((String) pages.elementAt(position));
       String page = split((String) pages.elementAt(position));
       if (position == pages.size() - 1) {
         bf.forward.disable();
       }
       bf.back.enable();
       connect(page);
     }
     return true;
   } else if (e.target == bf.b) {
     System.out.println("Disposing of browser frame");
     bf.hide();
     bf.dispose();
     bf = null;
     return true;
   } else {
     return false;
   }
 }
Exemplo n.º 24
0
 void tagV(String name, Vector attrs) {
   String s[] = new String[attrs.size()];
   for (int i = 0; i < attrs.size(); i++) {
     s[i] = (String) attrs.elementAt(i);
   }
   startTagPrim(name, s, true);
 }
Exemplo n.º 25
0
 public void setConnected(boolean b, boolean process_pending) {
   if (b && state != ConnectionEvent.CONNECTION_OPENED) {
     if (host.length() > 0)
       ExpCoordinator.print(
           "NCCPConnection open connection to ipaddress " + host + " port " + port);
     state = ConnectionEvent.CONNECTION_OPENED;
     // connected = true;
     fireEvent(new ConnectionEvent(this, state));
     ExpCoordinator.printer.print("NCCPConnection.setConnected " + b + " event fired", 8);
     if (process_pending) {
       int max = pendingMessages.size();
       ExpCoordinator.printer.print(new String("   pendingMessages " + max + " elements"), 8);
       for (int i = 0; i < max; ++i) {
         sendMessage((NCCP.Message) pendingMessages.elementAt(i));
       }
       pendingMessages.removeAllElements();
     }
   } else {
     if (!b
         && (state != ConnectionEvent.CONNECTION_CLOSED
             || state != ConnectionEvent.CONNECTION_FAILED)) {
       if (host.length() > 0)
         ExpCoordinator.print(
             new String(
                 "NCCPConnection.setConnected -- Closed control socket for " + host + "." + port));
       state = ConnectionEvent.CONNECTION_CLOSED;
       fireEvent(new ConnectionEvent(this, state));
     }
   }
 }
Exemplo n.º 26
0
 float printCPT(int startVertex) {
   CPP bestGraph = null, g;
   float bestCost = 0, cost;
   int i = 0;
   do {
     g = new CPP(N + 1);
     for (int j = 0; j < arcs.size(); j++) {
       Arc it = (Arc) arcs.elementAt(j);
       g.addArc(it.lab, it.u, it.v, it.cost);
     }
     cost = g.basicCost;
     g.findUnbalanced(); // initialise g.neg on original graph
     g.addArc("Virtual start", N, startVertex, cost);
     g.addArc(
         "Virtual end",
         // graph is Eulerian if neg.length=0
         g.neg.length == 0 ? startVertex : g.neg[i],
         N,
         cost);
     g.solve();
     if (bestGraph == null || bestCost > g.cost()) {
       bestCost = g.cost();
       bestGraph = g;
     }
   } while (++i < g.neg.length);
   System.out.println("Open CPT from " + startVertex + "(ignore virtual arcs)");
   bestGraph.printCPT(N);
   return cost + bestGraph.phi();
 }
Exemplo n.º 27
0
 // ----------------------------------------------------------------------
 // for "SrvTypeRqst"
 // get the list of service types for specified scope & naming authority
 // ----------------------------------------------------------------------
 public synchronized String getServiceTypeList(String na, String scope) {
   Vector typelist = new Vector(5);
   Iterator values = table.values().iterator();
   while (values.hasNext()) {
     Entry e = (Entry) values.next();
     if (!e.getDeleted()
         && // nor deleted
         scope.equalsIgnoreCase(e.getScope())
         && // match scope
         (na.equals("*")
             || // NA wildcard
             na.equalsIgnoreCase(e.getNA()))
         && // match NA
         !typelist.contains(e.getType())) {
       typelist.addElement(e.getType());
     }
   }
   StringBuffer tl = new StringBuffer();
   for (int i = 0; i < typelist.size(); i++) {
     String s = (String) typelist.elementAt(i);
     if (tl.length() > 0) tl.append(",");
     tl.append(s);
   }
   return tl.toString();
 }
Exemplo n.º 28
0
  public Properties internalToProperties() {
    Properties props = new Properties();

    StringBuffer st = new StringBuffer();
    st.append(" ");
    for (int i = 0; i < visibleViewIds.size(); i++) {
      st.append(" " + Constants.cpNames[((Integer) visibleViewIds.elementAt(i)).intValue()]);
    }
    // System.out.println(" visibleViewIds: " + st.toString());

    props.setProperty("ndedit.visibleViewIds", st.toString());

    props.setProperty("ndedit.cutPanelSizeW", (new Integer(cutPanelSize.width).toString()));
    props.setProperty("ndedit.cutPanelSizeH", (new Integer(cutPanelSize.height).toString()));
    props.setProperty("ndedit.cutPanelWMin", (new Integer(cutPanelMinSize.width).toString()));
    props.setProperty("ndedit.cutPanelHMin", (new Integer(cutPanelMinSize.height).toString()));
    props.setProperty("ndedit.cutPanelWMax", (new Integer(cutPanelMaxSize.width).toString()));
    props.setProperty("ndedit.cutPanelHMax", (new Integer(cutPanelMaxSize.height).toString()));
    props.setProperty("ndedit.lonReference", (new Double(lonReference).toString()));
    props.setProperty("ndedit.geoDisplayFormat", (new Integer(geoDisplayFormat).toString()));
    props.setProperty("ndedit.timeDisplayFormat", (new Integer(timeDisplayFormat).toString()));
    props.setProperty("ndedit.timeAxisMode", (new Integer(timeAxisMode).toString()));
    props.setProperty("ndedit.timeAxisReference", (new Double(timeAxisReference).toString()));
    String dpa = new Boolean(displayPanelAxes).toString();
    props.setProperty("ndedit.displayPanelAxes", dpa);
    dpa = new Boolean(independentHandles).toString();
    props.setProperty("ndedit.independentHandles", dpa);
    return props;
  }
Exemplo n.º 29
0
  public String toString() {

    StringBuffer st = new StringBuffer();

    st.append(" Cut Panels: ");
    for (int i = 0; i < visibleViewIds.size(); i++) {
      st.append(" " + Constants.cpNames[((Integer) visibleViewIds.elementAt(i)).intValue()]);
    }
    st.append(" \nCutPanelSize: ");
    st.append(cutPanelSize);
    st.append(" \nlonReference: ");
    st.append(lonReference);
    st.append(" \ngeoDisplayFormat: ");
    st.append(geoDisplayFormat);
    st.append(" \nuseCenterWidthOrMinMax: ");
    st.append(useCenterWidthOrMinMax);
    st.append(" \ntimeDisplayFormat: ");
    st.append(timeDisplayFormat);
    st.append(" \ntimeAxisMode:  ");
    st.append(timeAxisMode);
    st.append(" \ntimeAxisReference:  ");
    st.append(timeAxisReference);
    st.append(" \ntimeSinceUnits:  ");
    st.append(timeSinceUnits);
    st.append(" \ndisplayPanelAxes:  ");
    st.append(displayPanelAxes);
    st.append(" \nindependentHandles:  ");
    st.append(independentHandles);
    return st.toString();
  }
Exemplo n.º 30
0
 public void writeMap(Cluster cluster, float yBar) {
   Set<Submission> subSet = new HashSet<Submission>(cluster.size());
   String documents = "";
   for (int i = 0; i < cluster.size(); i++) {
     Submission sub = submissions.elementAt(cluster.getSubmissionAt(i));
     documents += sub.name + " ";
     subSet.add(sub);
   }
   documents = documents.trim();
   String theme =
       ThemeGenerator.generateThemes(subSet, this.program.get_themewords(), false, this.program);
   mapString +=
       "<area shape=\"rect\" coords=\""
           + (cluster.x - 2)
           + ","
           + (yBar)
           + ","
           + (cluster.x + 2)
           + ","
           + (cluster.y + 2)
           + "\" onMouseover=\"set('"
           + cluster.size()
           + "','"
           + trimStringToLength(String.valueOf(cluster.getSimilarity()), 6)
           + "','"
           + trimStringToLength(documents, 50)
           + "','"
           + theme
           + "')\" ";
   //		if (cluster.size() == 1)
   //			mapString += "href=\"submission"+cluster.getSubmissionAt(0)+".html\">\n";
   //		else
   mapString += "nohref>\n";
 }