Пример #1
0
 public synchronized void removeClientData(ClientData cd) {
   try {
     clientList.remove(cd);
     clientList.trimToSize();
     sendList();
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
Пример #2
0
 public static List<Element> elementList(NodeList nodeList) {
   List<Node> nodes = nodeList(nodeList);
   ArrayList<Element> elements = new ArrayList<Element>(nodes.size());
   for (Node node : nodes) {
     if (node instanceof Element) {
       elements.add((Element) node);
     }
   }
   elements.trimToSize();
   return elements;
 }
Пример #3
0
  /** Seals a Tdb against further additions. */
  public void seal() {
    if (!isSealed) {
      isSealed = true;

      // convert map values to array lists to save space because
      // they will not be modified now that the Tdb is sealed.
      synchronized (pluginIdTdbAuIdsMap) {
        for (Map.Entry<String, Collection<TdbAu.Id>> entry : pluginIdTdbAuIdsMap.entrySet()) {
          ArrayList<TdbAu.Id> list = new ArrayList<TdbAu.Id>(entry.getValue());
          list.trimToSize();
          entry.setValue(list);
        }
      }
    }
  }
Пример #4
0
 /**
  * Get the linked titles for the specified link type.
  *
  * @param linkType the link type {@see TdbTitle} for description of link types
  * @param title the TdbTitle with links
  * @return a collection of linked titles for the specified type
  */
 public Collection<TdbTitle> getLinkedTdbTitlesForType(
     TdbTitle.LinkType linkType, TdbTitle title) {
   if (linkType == null) {
     throw new IllegalArgumentException("linkType cannot be null");
   }
   if (title == null) {
     throw new IllegalArgumentException("title cannot be null");
   }
   Collection<String> titleIds = title.getLinkedTdbTitleIdsForType(linkType);
   if (titleIds.isEmpty()) {
     return Collections.emptyList();
   }
   ArrayList<TdbTitle> titles = new ArrayList<TdbTitle>();
   for (String titleId : titleIds) {
     TdbTitle aTitle = getTdbTitleById(titleId);
     if (aTitle != null) {
       titles.add(aTitle);
     }
   }
   titles.trimToSize();
   return titles;
 }
Пример #5
0
 public void removethread(ServerThread st) {
   clientList.remove(st);
   clientList.trimToSize();
 }
Пример #6
0
 /**
  * Returns a collection of TdbTitles like (starts with) the specified title name across all
  * publishers.
  *
  * @param titleName the title name
  * @return a collection of TdbTitles that match the title name
  */
 public Collection<TdbTitle> getTdbTitlesLikeName(String titleName) {
   ArrayList<TdbTitle> titles = new ArrayList<TdbTitle>();
   getTdbTitlesLikeName(titleName, titles);
   titles.trimToSize();
   return titles;
 }