示例#1
1
 public void setModel(Vector columnas, Vector vector) {
   rows.removeAllElements();
   rows.addAll(vector);
   columnNames.removeAllElements();
   columnNames.addAll(columnas);
   fireTableStructureChanged(); // Actualiza La Tabla
 }
示例#2
0
 public void dbClearList() {
   dbItems.removeAllElements();
   dbItemsK.removeAllElements();
   dbItemsK2.removeAllElements();
   lm.clear();
   this.setModel(lm);
 }
 public void stop() {
   if (_serverSocket != null) {
     if (_serverAlive) {
       _serverAlive = false;
       if (_serverAcceptThread != null) _serverAcceptThread.interrupt();
       _serverAcceptThread = null;
       for (int i = _countAcceptedClients - 1; i >= 0; i--) {
         _vAcceptedClientReadThread.elementAt(i).interrupt();
         _vAcceptedClientPrintThread.elementAt(i).interrupt();
         try {
           addlog("try to eject client" + String.valueOf(i));
           _vAcceptedClientSocket.elementAt(i).close();
         } catch (Exception e) {
         }
       }
       _vAcceptedClientReadThread.removeAllElements();
       _vAcceptedClientPrintThread.removeAllElements();
       _vAcceptedClientSocket.removeAllElements();
       _vAcceptedClientID.removeAllElements();
       //
       try {
         addlog("try to close server");
         _serverSocket.close();
         addlog("close server success");
       } catch (Exception e) {
         addlog("close server failed");
       }
     }
     _serverSocket = null;
     _serverEventListener.onServerConnectionStatus(
         GameServerEventListener.ServerConnectionStatus.DISCONNECTED);
   }
 }
示例#4
0
  /** @throws java.lang.Exception */
  @Before
  public void setUp() throws Exception {
    Vector<Parameter> v = new Vector<Parameter>();

    // missing one required attribute
    v.add(new Parameter(SMLConstants.PROTOCOL_NAME_ATTRIBUTE_NODE, "MyProtocol"));
    v.add(new Parameter(SMLConstants.PROTOCOL_TYPE_ATTRIBUTE_NODE, "MyProtocolType"));
    v.add(new Parameter("shoudNOT", "goTHROUGH"));
    p1 = new Parameters(v);

    v.removeAllElements();
    // missing two required attributes
    v.add(new Parameter(SMLConstants.PROTOCOL_NAME_ATTRIBUTE_NODE, "MyProtocol"));
    v.add(new Parameter("shoudNOT", "goTHROUGH"));
    p2 = new Parameters(v);

    v.removeAllElements();
    // should be ok
    v.add(new Parameter(SMLConstants.PROTOCOL_NAME_ATTRIBUTE_NODE, "MyProtocol"));
    v.add(new Parameter(SMLConstants.PROTOCOL_TYPE_ATTRIBUTE_NODE, "MyProtocolType"));
    v.add(new Parameter(SMLConstants.SENSOR_ADDRESS_ATTRIBUTE_NODE, "MySensorAddress"));
    p3 = new Parameters(v);

    try {
      d1 = XMLhelper.createDocument(sml1);
      d2 = XMLhelper.createDocument(sml2);
      d3 = XMLhelper.createDocument(sml3);
      d4 = XMLhelper.createDocument(sml4);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
示例#5
0
  public void getMinimum_GValue() {

    Coordinate tmpCoordinate = null;
    int backtmpG = tmpList.elementAt(0).getGValue();
    for (Coordinate b : tmpList) {
      if (b.getGValue() <= backtmpG) {
        backtmpG = b.getGValue();
        backTmpList.add(b);
        tmpCoordinate = b;
      }
    }
    if (backTmpList.size() > 1) {
      int tmpHValue = backTmpList.elementAt(0).getHValue();
      for (Coordinate b : backTmpList) {
        if (b.getHValue() > tmpHValue) {
          tmpCoordinate = b;
          tmpHValue = b.getHValue();
        }
      }
    }

    closeList.remove(current);
    way.add(0, tmpCoordinate);
    current = tmpCoordinate;
    for (Coordinate b : tmpList) if (closeList.contains(b)) closeList.remove(b);
    tmpList.removeAllElements();
    backTmpList.removeAllElements();
  }
示例#6
0
文件: List.java 项目: Baschdl578/SWT
  public void removePictures() {
    entrys.removeAll();
    v_file.removeAllElements();
    v_names.removeAllElements();

    entrys.getSelectedValues();
  }
示例#7
0
  public void reset() {
    events.removeAllElements();
    clocks.removeAllElements();

    events = new Vector<Event>();
    clocks = new Vector<Clock>();
    simTime = new SimTime();
  }
示例#8
0
  public void getWayHuman() {

    way.add(coordinates[x_end][y_end]);
    while (!(current.getX() == x_start && current.getY() == y_start)) {
      if ((current.getX() + 1) < x_Size
          && closeList.contains(coordinates[current.getX() + 1][current.getY()])) {
        tmpList.add(coordinates[current.getX() + 1][current.getY()]);
      }
      if ((current.getX() - 1) > -1
          && closeList.contains(coordinates[current.getX() - 1][current.getY()])) {
        tmpList.add(coordinates[current.getX() - 1][current.getY()]);
      }
      if ((current.getY() + 1) < y_Size
          && closeList.contains(coordinates[current.getX()][current.getY() + 1])) {
        tmpList.add(coordinates[current.getX()][current.getY() + 1]);
      }
      if ((current.getY() - 1) > -1
          && closeList.contains(coordinates[current.getX()][current.getY() - 1])) {
        tmpList.add(coordinates[current.getX()][current.getY() - 1]);
      }
      if ((current.getX() + 1) < x_Size
          && (current.getY() + 1) < y_Size
          && closeList.contains(coordinates[current.getX() + 1][current.getY() + 1])
          && !(map[current.getX()][current.getY() + 1] == 0
              && map[current.getX() + 1][current.getY()] == 0)) {
        tmpList.add(coordinates[current.getX() + 1][current.getY() + 1]);
      }
      if ((current.getX() + 1) < x_Size
          && (current.getY() - 1) > -1
          && closeList.contains(coordinates[current.getX() + 1][current.getY() - 1])
          && !(map[current.getX()][current.getY() - 1] == 0
              && map[current.getX() + 1][current.getY()] == 0)) {
        tmpList.add(coordinates[current.getX() + 1][current.getY() - 1]);
      }
      if ((current.getX() - 1) > -1
          && (current.getY() + 1) < y_Size
          && closeList.contains(coordinates[current.getX() - 1][current.getY() + 1])
          && !(map[current.getX()][current.getY() + 1] == 0
              && map[current.getX() - 1][current.getY()] == 0)) {
        tmpList.add(coordinates[current.getX() - 1][current.getY() + 1]);
      }
      if ((current.getX() - 1) > -1
          && (current.getY() - 1) > -1
          && closeList.contains(coordinates[current.getX() - 1][current.getY() - 1])
          && !(map[current.getX()][current.getY() - 1] == 0
              && map[current.getX() - 1][current.getY()] == 0)) {
        tmpList.add(coordinates[current.getX() - 1][current.getY() - 1]);
      }
      if (!tmpList.isEmpty()) getMinimum_GValue();
    }

    openList.removeAllElements();
    closeList.removeAllElements();
    tmpList.removeAllElements();
    backTmpList.removeAllElements();
  }
示例#9
0
 public void reset() {
   boxes.removeAllElements();
   names.removeAllElements();
   prices.removeAllElements();
   holder.removeAll();
   holder.add(ok);
   holder.add(new JLabel());
   holder.add(new JLabel("unit"));
   holder.add(new JLabel("worth"));
 }
示例#10
0
文件: List.java 项目: Baschdl578/SWT
 public void setPictures(File[] e) {
   entrys.removeAll();
   v_file.removeAllElements();
   v_names.removeAllElements();
   for (int i = 0; i < e.length; i++) {
     File entry = e[i];
     v_file.add(entry);
     v_names.add(entry.getName());
   }
   entrys.setListData(v_file);
 }
示例#11
0
 public void clear() {
   dim = null;
   rows = 0;
   cols = 0;
   numberWidth = 1;
   timeList.removeAllElements();
   stateList.removeAllElements();
   currentTime = null;
   currentState = null;
   this.setTimes(null);
   this.show2DOnly = true;
 }
示例#12
0
 public void setInput(int x_start, int y_start, int x_end, int y_end) {
   way.removeAllElements();
   this.x_start = x_start;
   this.y_start = y_start;
   this.x_end = x_end;
   this.y_end = y_end;
   openList.removeAllElements();
   closeList.removeAllElements();
   init();
   if (flag) {
     findPathHuman();
   } else findPathShip();
 }
 /** Remove all messages from the table (but leave "most recent") */
 public void clearAll() {
   int last_row = data.size() - 1;
   if (last_row > 0) {
     data.removeAllElements();
     SOAPMonitorData soap = new SOAPMonitorData(null, null, null);
     data.addElement(soap);
     if (filter_data != null) {
       filter_data.removeAllElements();
       filter_data.addElement(soap);
     }
     fireTableDataChanged();
   }
 }
示例#14
0
  /**
   * Updates the vector that contains the KEKs needed by the client for OFT algorithm. It also
   * updates the value of the index of the first of the new stored keys.
   *
   * @param LKH_version an int value specifying the LKH algorithm that is used.
   * @param Keys the new KEKs to be stored.
   * @param flag flag which indicates the operation to realize.
   * @param StoredBlindKEKs the stored blind keys in the client.
   */
  public void storeKeysOFT(int LKH_version, Vector Keys, int flag, Vector StoredBlindKEKs) {
    if (StoredKEKs.size() == 0) {
      this.LKH_version = LKH_version;
      StoredKEKs.addElement(Keys.get(0));
      return;
    } else if (this.LKH_version != LKH_version) {
      System.out.println("Incorrect LKH version");
      return;
    }

    switch (flag) {
      case 0:
        for (int i = 0; i < Keys.size(); i++) StoredBlindKEKs.add(((KEK) Keys.get(i)));
        break;

      case 1:
        for (int i = 0; i < StoredKEKs.size(); i++)
          if (((KEK) (StoredKEKs.get(i))).LKH_ID == ((KEK) Keys.get(0)).LKH_ID) newKEKindex = i;
        KEK aux = (KEK) StoredKEKs.get(0);
        StoredKEKs.removeAllElements();
        StoredKEKs.add(aux);
        for (int i = 0; i < StoredBlindKEKs.size(); i++) {
          if (((KEK) StoredBlindKEKs.get(i)).LKH_ID == ((KEK) Keys.get(0)).LKH_ID) {
            StoredBlindKEKs.set(i, Keys.get(0));
            newKEKindex = i;
          }
        }
        break;

      case 2:
        newKEKindex = -1;
        StoredKEKs.removeAllElements();
        StoredKEKs.add(Keys.get(0));
        StoredBlindKEKs.remove(0);
        break;

      case 3:
        newKEKindex = -1;
        StoredKEKs.removeAllElements();
        StoredKEKs.add(Keys.get(0));
        StoredBlindKEKs.add(0, Keys.get(1));
        break;
      case 4:
        newKEKindex = -1;
        StoredKEKs.removeAllElements();
        StoredKEKs.add(Keys.get(0));
        break;
    }
    KeyOFT.recalculateOFT(StoredKEKs, StoredBlindKEKs);
  }
示例#15
0
 /** @param valueArray */
 public void setValue(java.lang.String[] valueArray) {
   // -- copy array
   _valueList.removeAllElements();
   for (int i = 0; i < valueArray.length; i++) {
     _valueList.addElement(valueArray[i]);
   }
 } // -- void setValue(java.lang.String)
示例#16
0
  public void stopVisualizing() {

    synchronized (startStopSynchObject) {
      if (!currentlyRunning || currentlyStopping) {
        return;
      }
      currentlyStopping = true;

      if (currentlyStarting) {
        System.err.println(
            "Got through all of the stopping conditions, we're going to stop... but its currently starting....ahhh");
      }
    }

    // tell them all to die
    for (RenderObject thisRunner : theRenderObjects) {
      thisRunner.kill();
    }

    // wait for them all to be done
    for (Thread thisThread : theThreads) {
      try {
        thisThread.join();
      } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    theThreads.removeAllElements();

    synchronized (startStopSynchObject) {
      currentlyStopping = false;
      currentlyRunning = false;
    }
  }
 /**
  * remove the game from the list
  *
  * @param gaName the name of the game
  */
 public synchronized void deleteGame(String gaName) {
   Vector members = (Vector) gameMembers.get(gaName);
   if (members != null) {
     members.removeAllElements();
   }
   super.deleteGame(gaName);
 }
示例#18
0
 /**
  * Temporary release objects. The memory is not actually released and instances are retained for
  * reuse.
  */
 public static void release() {
   if (verbose) {
     if (Log.isLoggable(Log.TRACE)) {
       Log.trace(TAG_LOG, "Releasing all objects in the pool");
     }
   }
   // Move all the used objects into the empty ones
   synchronized (emptyPool) {
     Enumeration keys = usedPool.keys();
     while (keys.hasMoreElements()) {
       Class klass = (Class) keys.nextElement();
       Vector u = (Vector) usedPool.get(klass);
       Vector e = (Vector) emptyPool.get(klass);
       for (int i = 0; i < u.size(); ++i) {
         Object o = u.elementAt(i);
         if (e == null) {
           e = new Vector();
           emptyPool.put(klass, e);
         }
         e.addElement(o);
       }
       u.removeAllElements();
     }
     // Dump stats
     dumpStats();
   }
 }
示例#19
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);
 }
示例#20
0
  /**
   * End this page, by clearing up all timers, outbound calls, the inbound call, and the RTP forker.
   *
   * <p>synchronized so multiple calls are serialized. Only the first should be needed.
   */
  public synchronized void end() {
    // Remove all timers associated with me
    Timers.removeTimer(this);

    // Hangup on all outbound calls.
    for (Leg outbound : outbounds) {
      try {
        outbound.destroyLeg();
      } catch (Exception e) {
        LOG.error("PageGroup::end outbound", e);
      }
    }
    outbounds.removeAllElements();

    // Stop the RTP processing.
    rtpFork.stop();
    rtpFork.removeAllDestinations();

    // Hangup on the inbound call
    if (inbound != null) {
      try {
        inbound.destroyLeg();
      } catch (Exception e) {

        LOG.error("PageGroup::end inbound", e);
      }
      inbound = null;
    }
    busy = false;
  }
  protected void uninstallListeners() {
    if (mouseListener != null) {
      tabScroller.tabPanel.removeMouseListener(mouseListener);
      mouseListener = null;
    }

    if (motionListener != null) {
      tabScroller.tabPanel.removeMouseMotionListener(motionListener);
      motionListener = null;
    }

    if (focusListener != null) {
      tabPane.removeFocusListener(focusListener);
      focusListener = null;
    }

    // PENDING(api): See comment for ContainerHandler
    if (containerListener != null) {
      tabPane.removeContainerListener(containerListener);
      containerListener = null;
      if (htmlViews != null) {
        htmlViews.removeAllElements();
        htmlViews = null;
      }
    }
    if (tabChangeListener != null) {
      tabPane.removeChangeListener(tabChangeListener);
      tabChangeListener = null;
    }
    if (propertyChangeListener != null) {
      tabPane.removePropertyChangeListener(propertyChangeListener);
      propertyChangeListener = null;
    }
  }
示例#22
0
  public void readRS() {
    RecordStore rs = null;
    try {
      rs = RecordStore.openRecordStore("score", true);
      byte[] byteA = new byte[100];

      list.removeAllElements();
      // System.out.println("size of list before reading out of rs: "+ list.size());
      for (int i = 1; i < 6; i++) {
        byteA = rs.getRecord(i);
        // System.out.println((char) byteA[0]);
        // System.out.println("1");
        ByteArrayInputStream bytes = new ByteArrayInputStream(byteA);
        // System.out.println("2");
        DataInputStream dataIn = new DataInputStream(bytes);
        // System.out.println("3");
        try {
          list.addElement(
              new ScoreItem(
                  dataIn.readUTF(), dataIn.readInt(), dataIn.readInt(), dataIn.readLong()));
        } catch (IOException exp) {
        }
      }
      // System.out.println("size of list after reading out of rs: "+ list.size());
      rs.closeRecordStore();
    } catch (RecordStoreException exp) {
      System.out.println("fehler: " + exp.toString());
      exp.printStackTrace();
    }
  }
  /**
   * Removes a ProfileActivator object from the vector of ProfileActivator objects whose activate
   * method will be called if the CMM needs to be activated.
   */
  public static void activateProfiles() {

    int i, n;

    deferring = false;
    if (aVector == null) {
      return;
    }
    n = aVector.size();
    for (ProfileActivator pa : aVector) {
      try {
        pa.activate();
      } catch (ProfileDataException e) {
        /*
         * Ignore profile activation error for now:
         * such exception is pssible due to absence
         * or corruption of standard color profile.
         * As for now we expect all profiles should
         * be shiped with jre and presence of this
         * exception is indication of some configuration
         * problem in jre installation.
         *
         * NB: we still are greedy loading deferred profiles
         * and load them all if any of them is needed.
         * Therefore broken profile (if any) might be never used.
         * If there will be attempt to use broken profile then
         * it will result in CMMException.
         */
      }
    }
    aVector.removeAllElements();
    aVector = null;
    return;
  }
  /**
   * Compute which element should be quizzed next from the given set of elements UID, according to
   * the statistics of each elements.
   *
   * @param elementsUID Set of elementsUID from which to found the next element.
   * @return String Element Unique ID
   */
  public String getNextElement(Vector<String> elementsUID) {
    String currentElementUID = null;
    float bestScore = Float.NEGATIVE_INFINITY;
    float currentScore = bestScore;
    Vector<String> bestsUIDs = new Vector<String>();

    Iterator<String> itElements = elementsUID.iterator();
    while (itElements.hasNext()) {
      currentElementUID = itElements.next();

      if (!statistics.containsKey(currentElementUID)) {
        KanjiNoSensei.log(
            Level.WARNING,
            Messages.getString("LearningProfile.LearningProfile.WarningNeverSeenElement")
                + " : \""
                + currentElementUID
                + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        return currentElementUID;
      }

      currentScore = statistics.get(currentElementUID).getNeedScore();
      if (currentScore > bestScore) {
        bestsUIDs.removeAllElements();
        bestsUIDs.add(currentElementUID);
        bestScore = currentScore;
      } else if (currentScore == bestScore) {
        bestsUIDs.add(currentElementUID);
      }
    }

    return bestsUIDs.get(random.nextInt(bestsUIDs.size()));
  }
  /*
   * Turns the vector into an Array of ICompletionProposal objects
   */
  protected ICompletionProposal[] turnProposalVectorIntoAdaptedArray(WordPartDetector word) {
    ICompletionProposal[] result = new ICompletionProposal[proposalList.size()];

    int index = 0;

    for (Iterator i = proposalList.iterator(); i.hasNext(); ) {
      String keyWord = (String) i.next();

      IContextInformation info = new ContextInformation(keyWord, getContentInfoString(keyWord));
      // Creates a new completion proposal.
      result[index] =
          new CompletionProposal(
              keyWord, // replacementString
              word.getOffset(),
              // replacementOffset the offset of the text to be replaced
              word.getString().length(),
              // replacementLength the length of the text to be replaced
              keyWord.length(),
              // cursorPosition the position of the cursor following the insert relative to
              // replacementOffset
              null, // image to display
              keyWord, // displayString the string to be displayed for the proposal
              info,
              // contntentInformation the context information associated with this proposal
              getContentInfoString(keyWord));
      index++;
    }
    // System.out.println("result : " + result.length);
    proposalList.removeAllElements();
    return result;
  }
示例#26
0
 /**
  * Parses an expression. Returns a object of type Node, does not catch errors. Does not set the
  * topNode variable of the JEP instance. This method should generally be used with the {@link
  * #evaluate evaluate} method rather than getValueAsObject.
  *
  * @param expression represented as a string.
  * @return The top node of a tree representing the parsed expression.
  * @throws ParseException
  * @since 2.3.0 alpha
  * @since 2.3.0 beta - will raise exception if errorList non empty
  */
 public Node parse(String expression) throws ParseException {
   java.io.StringReader sr = new java.io.StringReader(expression);
   errorList.removeAllElements();
   Node node = parser.parseStream(sr, this);
   if (this.hasError()) throw new ParseException(getErrorInfo());
   return node;
 }
示例#27
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));
     }
   }
 }
示例#28
0
 protected void layoutFooter(Page page) {
   ServletUtil.doLayoutFooter(
       page, (footnotes == null ? null : footnotes.iterator()), getLockssApp().getVersionInfo());
   if (footnotes != null) {
     footnotes.removeAllElements();
   }
 }
示例#29
0
  public void newsStart() {
    newsList.removeAllElements();

    // Only for testing purposes
    newsList.addElement(
        new newsItem("Recent Blackwood Logins", "", "", "", "", loginInfo, "Author: Isaac Stoll"));
  }
  /**
   * Updates Pathway Data.
   *
   * @param searchHit SearchHit Object.
   * @param pathwayTableModel Pathway Table Model.
   */
  private void updatePathwayData(
      ExtendedRecordType searchHit, PathwayTableModel pathwayTableModel) {
    List<PathwayType> pathwayList = searchHit.getPathwayList().getPathway();

    Vector dataVector = pathwayTableModel.getDataVector();
    dataVector.removeAllElements();

    if (pathwayList != null) {
      pathwayTableModel.setRowCount(pathwayList.size());
      pathwayTableModel.resetInternalIds(pathwayList.size());
      //  Only set the column count, if it is not already set.
      //  If we reset the column count, the user-modified column widths are lost.
      if (pathwayTableModel.getColumnCount() != 2) {
        pathwayTableModel.setColumnCount(2);
      }
      if (pathwayList.size() == 0) {
        pathwayTableModel.setRowCount(1);
        pathwayTableModel.setValueAt("No pathways found.", 0, 0);
      } else {
        for (int i = 0; i < pathwayList.size(); i++) {
          PathwayType pathway = pathwayList.get(i);
          pathwayTableModel.setValueAt(pathway.getName(), i, 0);
          pathwayTableModel.setValueAt(pathway.getDataSource().getName(), i, 1);
          pathwayTableModel.setInternalId(i, pathway.getPrimaryId());
        }
      }
    }
  }