org.openide.util.WeakSet.toArray()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(183)

本文整理了Java中org.openide.util.WeakSet.toArray()方法的一些代码示例,展示了WeakSet.toArray()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WeakSet.toArray()方法的具体详情如下:
包路径:org.openide.util.WeakSet
类名称:WeakSet
方法名:toArray

WeakSet.toArray介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-util

private void writeObject(ObjectOutputStream stream) throws IOException {
  stream.defaultWriteObject();
  stream.writeObject(toArray());
}

代码示例来源:origin: in.jlibs/org-openide-util

private void writeObject(ObjectOutputStream obtos)
throws IOException {
  obtos.defaultWriteObject();
  obtos.writeObject(toArray());
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

private void writeObject(ObjectOutputStream obtos) throws IOException {
  obtos.defaultWriteObject();
  obtos.writeObject(toArray());
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

private void writeObject(ObjectOutputStream obtos) throws IOException {
  obtos.defaultWriteObject();
  obtos.writeObject(toArray());
}

代码示例来源:origin: uk.gov.nationalarchives.thirdparty.netbeans/org-openide-util

private void writeObject(ObjectOutputStream stream) throws IOException {
  stream.defaultWriteObject();
  stream.writeObject(toArray());
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-vmd-model

private void fireActiveComponentsChanged (Collection<DesignComponent> activeComponents) {
  this.activeComponents = activeComponents;
  Listener[] Listeners;
  synchronized (listeners) {
    Listeners = listeners.toArray (new Listener[listeners.size ()]);
  }
  for (Listener listener : Listeners) {
    if (listener != null)
      listener.activeComponentsChanged (activeComponents);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-apt

@Override
  public final void dispose() {
    if (CndTraceFlags.TRACE_SLICE_DISTIBUTIONS) {
      Object[] arr = storage.toArray();
      System.out.println("Dispose macro cache "+arr.length + " " + getClass().getName()); // NOI18N
      Map<Class<?>, Integer> classes = new HashMap<Class<?>,Integer>();
      for(Object o : arr){
        if (o != null) {
          Integer i = classes.get(o.getClass());
          if (i != null) {
            i = Integer.valueOf(i.intValue() + 1);
          } else {
            i = Integer.valueOf(1);
          }
          classes.put(o.getClass(), i);
        }
      }
      for(Map.Entry<Class<?>,Integer> e:classes.entrySet()){
        System.out.println("   "+e.getValue()+" of "+e.getKey().getName()); // NOI18N
      }
    }
    if (storage.size() > 0) {
      storage.clear();
      storage.resize(initialCapacity);
    }
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-apt

@Override
  public final void dispose() {
    if (CndTraceFlags.TRACE_SLICE_DISTIBUTIONS) {
      Object[] arr = storage.toArray();
      System.out.println("Dispose macro cache "+arr.length + " " + getClass().getName()); // NOI18N
      Map<Class<?>, Integer> classes = new HashMap<Class<?>,Integer>();
      for(Object o : arr){
        if (o != null) {
          Integer i = classes.get(o.getClass());
          if (i != null) {
            i = Integer.valueOf(i.intValue() + 1);
          } else {
            i = Integer.valueOf(1);
          }
          classes.put(o.getClass(), i);
        }
      }
      for(Map.Entry<Class<?>,Integer> e:classes.entrySet()){
        System.out.println("   "+e.getValue()+" of "+e.getKey().getName()); // NOI18N
      }
    }
    if (storage.size() > 0) {
      storage.clear();
      storage.resize(initialCapacity);
    }
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-utils

@Override
  public final void dispose() {
    if (CndTraceFlags.TRACE_SLICE_DISTIBUTIONS){
      Object[] arr;
      synchronized (lock) {
        arr = storage.toArray();
      }
      System.out.println("Dispose cache "+name+" "+arr.length + " " + getClass().getName()); // NOI18N
      Map<Class, Integer> classes = new HashMap<Class,Integer>();
      for(Object o : arr){
        if (o != null) {
          Integer i = classes.get(o.getClass());
          if (i != null) {
            i = Integer.valueOf(i.intValue() + 1);
          } else {
            i = Integer.valueOf(1);
          }
          classes.put(o.getClass(), i);
        }
      }
      for(Map.Entry<Class,Integer> e:classes.entrySet()){
        System.out.println("   "+e.getValue()+" of "+e.getKey().getName()); // NOI18N
      }
    }
    if (storage.size() > 0) {
      storage.clear();
      storage.resize(initialCapacity);
    }
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-modelimpl

public final void dispose() {
    for (int i = 0; i < instances.length; i++) {
      if (instances[i].size() > 0) {
        if (CndTraceFlags.TRACE_SLICE_DISTIBUTIONS) {
          Object[] arr = instances[i].toArray();
          System.out.println("Key cache " + instances[i].size()); // NOI18N
          Map<Class, Integer> classes = new HashMap<>();
          for (Object o : arr) {
            if (o != null) {
              Integer num = classes.get(o.getClass());
              if (num != null) {
                num = new Integer(num.intValue() + 1);
              } else {
                num = new Integer(1);
              }
              classes.put(o.getClass(), num);
            }
          }
          for (Map.Entry<Class, Integer> e : classes.entrySet()) {
            System.out.println("   " + e.getValue() + " of " + e.getKey().getName()); // NOI18N
          }
        }
        instances[i].clear();
        instances[i].resize(initialCapacity);
      }
    }
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-modelimpl

private void dispose() {
  for (int i = 0; i < instances.length; i++) {
    if (instances[i].size() > 0) {
      if (CndTraceFlags.TRACE_SLICE_DISTIBUTIONS) {
        Object[] arr = instances[i].toArray();
        System.out.println("Dispose UID cache " + instances[i].size()); // NOI18N
        Map<Class, Integer> uidClasses = new HashMap<>();
        Map<Class, Integer> keyClasses = new HashMap<>();
        for (Object o : arr) {
          if (o != null) {
            incCounter( uidClasses, o);
            if (o instanceof KeyBasedUID<?>) {
              Key k = ((KeyBasedUID<?>)o).getKey();
              incCounter( keyClasses, k);
            }
          }
        }
        for (Map.Entry<Class, Integer> e : uidClasses.entrySet()) {
          System.out.println("   " + e.getValue() + " of " + e.getKey().getName()); // NOI18N
        }
        System.out.println("-----------"); // NOI18N
        for (Map.Entry<Class, Integer> e : keyClasses.entrySet()) {
          System.out.println("   " + e.getValue() + " of " + e.getKey().getName()); // NOI18N
        }
      }
      instances[i].clear();
      instances[i].resize(initialCapacity);
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Changes the node we delegate to if necessary.
 * @param n the node to delegate to
 */
public Lookup checkNode () {
  Lookup l = node.getOriginal ().getLookup();
  if (delegate == l) return l;
  
  Iterator toCheck = null;
  synchronized (this) {
    if (l != delegate) {
      this.delegate = l;
      if (results != null) {
        toCheck = Arrays.asList (results.toArray ()).iterator();
      }
    }
  }
  if (toCheck != null) {
    // update
    Iterator it = toCheck;
    while (it.hasNext()) {
      ProxyResult p = (ProxyResult)it.next ();
      if (p.updateLookup (l)) {
        p.resultChanged (null);
      }
    }
  }
  return delegate;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Changes the node we delegate to if necessary.
 * @param n the node to delegate to
 */
public Lookup checkNode () {
  Lookup l = node.getOriginal ().getLookup();
  if (delegate == l) return l;
  
  Iterator toCheck = null;
  synchronized (this) {
    if (l != delegate) {
      this.delegate = l;
      if (results != null) {
        toCheck = Arrays.asList (results.toArray ()).iterator();
      }
    }
  }
  if (toCheck != null) {
    // update
    Iterator it = toCheck;
    while (it.hasNext()) {
      ProxyResult p = (ProxyResult)it.next ();
      if (p.updateLookup (l)) {
        p.resultChanged (null);
      }
    }
  }
  return delegate;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-modelimpl

private void clearCache(int projectIndex) {
  for (int i = 0; i < instances.length; i++) {
    if (instances[i].size() > 0) {
      Object[] arr = instances[i].toArray();
      for (Object o : arr) {
        if (o instanceof CachedUID<?>) {
          CachedUID<?> cached = (CachedUID<?>) o;
          if (o instanceof KeyBasedUID<?>) {
            Key k = ((KeyBasedUID<?>)o).getKey();
            if (projectIndex == KeyUtilities.getProjectIndex(k)) {
              cached.clear();
            }
          }
        }
      }
    }
  }
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-vmd-io

private void fireActiveViewChanged (DataEditorView deactivatedView, DataEditorView activatedView) {
  Listener[] activeViewListeners;
  synchronized (listeners) {
    activeViewListeners = listeners.toArray (new Listener[listeners.size ()]);
  }
  for (Listener listener : activeViewListeners) {
    if (listener != null)
      listener.activeViewChanged (deactivatedView, activatedView);
  }
  DataObjectContext newContext = activatedView != null ? activatedView.getContext () : null;
  if (context != newContext) {
    if (context != null)
      context.removeDesignDocumentAwareness (awereness);
    context = newContext;
    if (context != null)
      context.addDesignDocumentAwareness (awereness);
    else
      awereness.setDesignDocument (null);
  }
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-vmd-model

private void fireActiveDocumentChanged (DesignDocument deactivatedDocument, final DesignDocument activatedDocument) {
  Listener[] Listeners;
  synchronized (listeners) {
    Listeners = listeners.toArray (new Listener[listeners.size ()]);
  }
  for (Listener listener : Listeners) {
    if (listener != null)
      listener.activeDocumentChanged (deactivatedDocument, activatedDocument);
  }
  if (deactivatedDocument != activatedDocument) {
    if (deactivatedDocument != null) {
      if (selectionListener == null)
        Debug.warning ("SelectionListener does not exist but it should"); // NOI18N
      else
        deactivatedDocument.getListenerManager ().removeDesignListener (selectionListener);
    }
    if (activatedDocument != null) {
      activatedDocument.getTransactionManager ().readAccess (new Runnable () {
        public void run () {
          activatedDocument.getListenerManager ().addDesignListener (selectionListener = new SelectionDesignListener (activatedDocument), FILTER_SELECTION);
          fireActiveComponentsChanged (activatedDocument.getSelectedComponents ());
        }
      });
    } else {
      fireActiveComponentsChanged (Collections.<DesignComponent>emptyList ());
    }
  }
}

相关文章