<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FCollections_Data_Structure%2FWeak_List</id>
		<title>Java/Collections Data Structure/Weak List - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FCollections_Data_Structure%2FWeak_List"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Collections_Data_Structure/Weak_List&amp;action=history"/>
		<updated>2026-04-18T20:52:18Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/Collections_Data_Structure/Weak_List&amp;diff=9093&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Collections_Data_Structure/Weak_List&amp;diff=9093&amp;oldid=prev"/>
				<updated>2010-06-01T07:25:02Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 07:25, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/Collections_Data_Structure/Weak_List&amp;diff=9092&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/Collections_Data_Structure/Weak_List&amp;diff=9092&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:48Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== A bag of weakly referenced objects ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 1998 - 2005 Versant Corporation&lt;br /&gt;
 * All rights reserved. This program and the accompanying materials&lt;br /&gt;
 * are made available under the terms of the Eclipse Public License v1.0&lt;br /&gt;
 * which accompanies this distribution, and is available at&lt;br /&gt;
 * http://www.eclipse.org/legal/epl-v10.html&lt;br /&gt;
 *&lt;br /&gt;
 * Contributors:&lt;br /&gt;
 * Versant Corporation - initial API and implementation&lt;br /&gt;
 */&lt;br /&gt;
import java.util.HashSet;&lt;br /&gt;
import java.util.List;&lt;br /&gt;
import java.util.ArrayList;&lt;br /&gt;
import java.util.Iterator;&lt;br /&gt;
import java.lang.ref.ReferenceQueue;&lt;br /&gt;
import java.lang.ref.WeakReference;&lt;br /&gt;
import java.lang.ref.Reference;&lt;br /&gt;
/**&lt;br /&gt;
 * This maintains a bag of weakly referenced objects. The clean method&lt;br /&gt;
 * must be called from time to time to get rid of the objects that the&lt;br /&gt;
 * garbage collector wants to nuke. This class is not synchronized.&lt;br /&gt;
 */&lt;br /&gt;
public final class WeakBag {&lt;br /&gt;
    private HashSet set = new HashSet();&lt;br /&gt;
    private ReferenceQueue refQueue = new ReferenceQueue();&lt;br /&gt;
    public WeakBag() {&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Add o to the bag and return the WeakReference that can be used to&lt;br /&gt;
     * remove it.&lt;br /&gt;
     */&lt;br /&gt;
    public WeakReference add(Object o) {&lt;br /&gt;
        WeakReference ans = new WeakReference(o, refQueue);&lt;br /&gt;
        set.add(ans);&lt;br /&gt;
        return ans;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Remove o from the bag.&lt;br /&gt;
     */&lt;br /&gt;
    public void remove(Reference o) {&lt;br /&gt;
        set.remove(o);&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Get the approximate number of objects in the bag.&lt;br /&gt;
     */&lt;br /&gt;
    public int size() {&lt;br /&gt;
        return set.size();&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Get all the objects still in the bag.&lt;br /&gt;
     */&lt;br /&gt;
    public List values() {&lt;br /&gt;
        ArrayList a = new ArrayList(set.size());&lt;br /&gt;
        for (Iterator i = set.iterator(); i.hasNext(); ) {&lt;br /&gt;
            WeakReference r = (WeakReference)i.next();&lt;br /&gt;
            Object o = r.get();&lt;br /&gt;
            if (o != null) a.add(o);&lt;br /&gt;
        }&lt;br /&gt;
        return a;&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Get rid of objects in the bag that the garbage collector wants to&lt;br /&gt;
     * nuke. This does not block.&lt;br /&gt;
     */&lt;br /&gt;
    public void clean() {&lt;br /&gt;
        for (;;) {&lt;br /&gt;
            Object r = refQueue.poll();&lt;br /&gt;
            if (r == null) return;&lt;br /&gt;
            set.remove(r);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Weak List from objectweb jac ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
//Revised from objectweb jac&lt;br /&gt;
import java.lang.ref.Reference;&lt;br /&gt;
import java.lang.ref.ReferenceQueue;&lt;br /&gt;
import java.lang.ref.WeakReference;&lt;br /&gt;
import java.util.AbstractList;&lt;br /&gt;
import java.util.ArrayList;&lt;br /&gt;
import java.util.List;&lt;br /&gt;
public class WeakList extends AbstractList {&lt;br /&gt;
    /**&lt;br /&gt;
     * Reference queue for cleared weak references&lt;br /&gt;
     */&lt;br /&gt;
    private final ReferenceQueue queue = new ReferenceQueue();&lt;br /&gt;
   &lt;br /&gt;
    private final List list=new ArrayList();&lt;br /&gt;
    public boolean add(Object o) {&lt;br /&gt;
        expungeStaleEntries();&lt;br /&gt;
        return list.add(new ListEntry(o,queue));&lt;br /&gt;
    }&lt;br /&gt;
    public Object get(int i) {&lt;br /&gt;
        expungeStaleEntries();&lt;br /&gt;
        return ((Reference)list.get(i)).get();&lt;br /&gt;
    }&lt;br /&gt;
    public int size() {&lt;br /&gt;
        //new Exception().printStackTrace();&lt;br /&gt;
        expungeStaleEntries();&lt;br /&gt;
        return list.size();&lt;br /&gt;
    }&lt;br /&gt;
    public Object remove(int index) {&lt;br /&gt;
        return ((ListEntry)list.remove(index)).get();&lt;br /&gt;
    }&lt;br /&gt;
    /**&lt;br /&gt;
     * Expunge stale entries from the list.&lt;br /&gt;
     */&lt;br /&gt;
    private void expungeStaleEntries() {&lt;br /&gt;
        Object r;&lt;br /&gt;
        while ( (r = queue.poll()) != null) {&lt;br /&gt;
            ListEntry e = (ListEntry)r;&lt;br /&gt;
            int i=list.indexOf(r);&lt;br /&gt;
            if(i!=-1) {&lt;br /&gt;
                list.remove(i);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    private static class ListEntry extends WeakReference {&lt;br /&gt;
        String objectString;&lt;br /&gt;
        public ListEntry(Object o,ReferenceQueue queue) {&lt;br /&gt;
            super(o,queue);&lt;br /&gt;
            objectString=o.toString();&lt;br /&gt;
        }&lt;br /&gt;
        public boolean equals(Object o) {&lt;br /&gt;
            if(o==null) {&lt;br /&gt;
                return false;&lt;br /&gt;
            } else {&lt;br /&gt;
                if((o instanceof ListEntry)) {&lt;br /&gt;
                    return o.hashCode()==this.hashCode();&lt;br /&gt;
                } else {&lt;br /&gt;
                    if(this.get()==null) return false;&lt;br /&gt;
                    return this.get().equals(o);&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        public String toString() {&lt;br /&gt;
            if(this.get()==null) {&lt;br /&gt;
                return &amp;quot;&amp;quot;entry &amp;quot;+objectString+&amp;quot; &amp;lt;GARBAGED&amp;gt;&amp;quot;&amp;quot;;&lt;br /&gt;
            } else {&lt;br /&gt;
                return &amp;quot;&amp;quot;entry &amp;quot;+this.get()+&amp;quot;&amp;quot;&amp;quot;;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
      &lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== WeakReference list uses java.lang.ref.WeakReferences to store its contents. ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
/**&lt;br /&gt;
 * &lt;br /&gt;
 * JFreeReport : a free Java reporting library&lt;br /&gt;
 * &lt;br /&gt;
 *&lt;br /&gt;
 * Project Info:  http://reporting.pentaho.org/&lt;br /&gt;
 *&lt;br /&gt;
 * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.&lt;br /&gt;
 *&lt;br /&gt;
 * This library is free software; you can redistribute it and/or modify it under the terms&lt;br /&gt;
 * of the GNU Lesser General Public License as published by the Free Software Foundation;&lt;br /&gt;
 * either version 2.1 of the License, or (at your option) any later version.&lt;br /&gt;
 *&lt;br /&gt;
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;&lt;br /&gt;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.&lt;br /&gt;
 * See the GNU Lesser General Public License for more details.&lt;br /&gt;
 *&lt;br /&gt;
 * You should have received a copy of the GNU Lesser General Public License along with this&lt;br /&gt;
 * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,&lt;br /&gt;
 * Boston, MA 02111-1307, USA.&lt;br /&gt;
 *&lt;br /&gt;
 * [Java is a trademark or registered trademark of Sun Microsystems, Inc.&lt;br /&gt;
 * in the United States and other countries.]&lt;br /&gt;
 *&lt;br /&gt;
 * ------------&lt;br /&gt;
 * WeakReferenceList.java&lt;br /&gt;
 * ------------&lt;br /&gt;
 * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.ObjectInputStream;&lt;br /&gt;
import java.io.Serializable;&lt;br /&gt;
import java.lang.ref.Reference;&lt;br /&gt;
import java.lang.ref.WeakReference;&lt;br /&gt;
/**&lt;br /&gt;
 * The WeakReference list uses &amp;lt;code&amp;gt;java.lang.ref.WeakReference&amp;lt;/code&amp;gt;s to store its contents. In contrast to the&lt;br /&gt;
 * WeakHashtable, this list knows how to restore missing content, so that garbage collected elements can be restored&lt;br /&gt;
 * when they are accessed.&lt;br /&gt;
 * &amp;lt;p/&amp;gt;&lt;br /&gt;
 * By default this list can contain 25 elements, where the first element is stored using a strong reference, which is&lt;br /&gt;
 * not garbage collected.&lt;br /&gt;
 * &amp;lt;p/&amp;gt;&lt;br /&gt;
 * Restoring the elements is not implemented, concrete implementations will have to override the&lt;br /&gt;
 * &amp;lt;code&amp;gt;restoreChild(int)&amp;lt;/code&amp;gt; method. The &amp;lt;code&amp;gt;getMaxChildCount&amp;lt;/code&amp;gt; method defines the maxmimum number of&lt;br /&gt;
 * children in the list. When more than &amp;lt;code&amp;gt;maxChildCount&amp;lt;/code&amp;gt; elements are contained in this list, add will always&lt;br /&gt;
 * return false to indicate that adding the element failed.&lt;br /&gt;
 * &amp;lt;p/&amp;gt;&lt;br /&gt;
 * To customize the list, override createReference to create a different kind of reference.&lt;br /&gt;
 * &amp;lt;p/&amp;gt;&lt;br /&gt;
 * This list is able to add or replace elements, but inserting or removing of elements is not possible.&lt;br /&gt;
 *&lt;br /&gt;
 * @author Thomas Morgner&lt;br /&gt;
 */&lt;br /&gt;
public abstract class WeakReferenceList implements Serializable, Cloneable&lt;br /&gt;
{&lt;br /&gt;
  /**&lt;br /&gt;
   * The master element.&lt;br /&gt;
   */&lt;br /&gt;
  private Object master;&lt;br /&gt;
  /**&lt;br /&gt;
   * Storage for the references.&lt;br /&gt;
   */&lt;br /&gt;
  private transient Reference[] childs;&lt;br /&gt;
  /**&lt;br /&gt;
   * The current number of elements.&lt;br /&gt;
   */&lt;br /&gt;
  private int size;&lt;br /&gt;
  /**&lt;br /&gt;
   * The maximum number of elements.&lt;br /&gt;
   */&lt;br /&gt;
  private final int maxChilds;&lt;br /&gt;
  /**&lt;br /&gt;
   * Creates a new weak reference list. The storage of the list is limited to getMaxChildCount() elements.&lt;br /&gt;
   *&lt;br /&gt;
   * @param maxChildCount the maximum number of elements.&lt;br /&gt;
   */&lt;br /&gt;
  protected WeakReferenceList(final int maxChildCount)&lt;br /&gt;
  {&lt;br /&gt;
    this.maxChilds = maxChildCount;&lt;br /&gt;
    this.childs = new Reference[maxChildCount - 1];&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the maximum number of children in this list.&lt;br /&gt;
   *&lt;br /&gt;
   * @return the maximum number of elements in this list.&lt;br /&gt;
   */&lt;br /&gt;
  protected final int getMaxChildCount()&lt;br /&gt;
  {&lt;br /&gt;
    return maxChilds;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the master element of this list. The master element is the element stored by a strong reference and cannot&lt;br /&gt;
   * be garbage collected.&lt;br /&gt;
   *&lt;br /&gt;
   * @return the master element&lt;br /&gt;
   */&lt;br /&gt;
  protected Object getMaster()&lt;br /&gt;
  {&lt;br /&gt;
    return master;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Attempts to restore the child stored on the given index.&lt;br /&gt;
   *&lt;br /&gt;
   * @param index the index.&lt;br /&gt;
   * @return null if the child could not be restored or the restored child.&lt;br /&gt;
   */&lt;br /&gt;
  protected abstract Object restoreChild(int index);&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the child stored at the given index. If the child has been garbage collected, it gets restored using the&lt;br /&gt;
   * restoreChild function.&lt;br /&gt;
   *&lt;br /&gt;
   * @param index the index.&lt;br /&gt;
   * @return the object.&lt;br /&gt;
   */&lt;br /&gt;
  public Object get(final int index)&lt;br /&gt;
  {&lt;br /&gt;
    if (isMaster(index))&lt;br /&gt;
    {&lt;br /&gt;
      return master;&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
      final Reference ref = childs[getChildPos(index)];&lt;br /&gt;
      if (ref == null)&lt;br /&gt;
      {&lt;br /&gt;
        throw new IllegalStateException(&amp;quot;State: &amp;quot; + index);&lt;br /&gt;
      }&lt;br /&gt;
      Object ob = ref.get();&lt;br /&gt;
      if (ob == null)&lt;br /&gt;
      {&lt;br /&gt;
        ob = restoreChild(index);&lt;br /&gt;
        childs[getChildPos(index)] = createReference(ob);&lt;br /&gt;
      }&lt;br /&gt;
      return ob;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Replaces the child stored at the given index with the new child which can be null.&lt;br /&gt;
   *&lt;br /&gt;
   * @param report the object.&lt;br /&gt;
   * @param index  the index.&lt;br /&gt;
   */&lt;br /&gt;
  public void set(final Object report, final int index)&lt;br /&gt;
  {&lt;br /&gt;
    if (isMaster(index))&lt;br /&gt;
    {&lt;br /&gt;
      master = report;&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
      childs[getChildPos(index)] = createReference(report);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Creates a new reference for the given object.&lt;br /&gt;
   *&lt;br /&gt;
   * @param o the object.&lt;br /&gt;
   * @return a WeakReference for the object o without any ReferenceQueue attached.&lt;br /&gt;
   */&lt;br /&gt;
  private Reference createReference(final Object o)&lt;br /&gt;
  {&lt;br /&gt;
    return new WeakReference(o);&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Adds the element to the list. If the maximum size of the list is exceeded, this function returns false to indicate&lt;br /&gt;
   * that adding failed.&lt;br /&gt;
   *&lt;br /&gt;
   * @param rs the object.&lt;br /&gt;
   * @return true, if the object was successfully added to the list, false otherwise&lt;br /&gt;
   */&lt;br /&gt;
  public boolean add(final Object rs)&lt;br /&gt;
  {&lt;br /&gt;
    if (size == 0)&lt;br /&gt;
    {&lt;br /&gt;
      master = rs;&lt;br /&gt;
      size = 1;&lt;br /&gt;
      return true;&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
      if (size &amp;lt; getMaxChildCount())&lt;br /&gt;
      {&lt;br /&gt;
        childs[size - 1] = createReference(rs);&lt;br /&gt;
        size++;&lt;br /&gt;
        return true;&lt;br /&gt;
      }&lt;br /&gt;
      else&lt;br /&gt;
      {&lt;br /&gt;
        // was not able to add this to this list, maximum number of entries reached.&lt;br /&gt;
        return false;&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns true, if the given index denotes a master index of this list.&lt;br /&gt;
   *&lt;br /&gt;
   * @param index the index.&lt;br /&gt;
   * @return true if the index is a master index.&lt;br /&gt;
   */&lt;br /&gt;
  protected boolean isMaster(final int index)&lt;br /&gt;
  {&lt;br /&gt;
    return index % getMaxChildCount() == 0;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the internal storage position for the child.&lt;br /&gt;
   *&lt;br /&gt;
   * @param index the index.&lt;br /&gt;
   * @return the internal storage index.&lt;br /&gt;
   */&lt;br /&gt;
  protected int getChildPos(final int index)&lt;br /&gt;
  {&lt;br /&gt;
    return index % getMaxChildCount() - 1;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Returns the size of the list.&lt;br /&gt;
   *&lt;br /&gt;
   * @return the size.&lt;br /&gt;
   */&lt;br /&gt;
  public int getSize()&lt;br /&gt;
  {&lt;br /&gt;
    return size;&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Serialisation support. The transient child elements were not saved.&lt;br /&gt;
   *&lt;br /&gt;
   * @param in the input stream.&lt;br /&gt;
   * @throws IOException            if there is an I/O error.&lt;br /&gt;
   * @throws ClassNotFoundException if a serialized class is not defined on this system.&lt;br /&gt;
   */&lt;br /&gt;
  private void readObject(final ObjectInputStream in)&lt;br /&gt;
      throws IOException, ClassNotFoundException&lt;br /&gt;
  {&lt;br /&gt;
    in.defaultReadObject();&lt;br /&gt;
    childs = new Reference[getMaxChildCount() - 1];&lt;br /&gt;
    for (int i = 0; i &amp;lt; childs.length; i++)&lt;br /&gt;
    {&lt;br /&gt;
      childs[i] = createReference(null);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  /**&lt;br /&gt;
   * Creates and returns a copy of this object.  The precise meaning of &amp;quot;copy&amp;quot; may depend on the class of the object.&lt;br /&gt;
   * The general intent is that, for any object &amp;lt;tt&amp;gt;x&amp;lt;/tt&amp;gt;, the expression: &amp;lt;blockquote&amp;gt;&lt;br /&gt;
   * &amp;lt;pre&amp;gt;&lt;br /&gt;
   * x.clone() != x&amp;lt;/pre&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
   * will be true, and that the expression: &amp;lt;blockquote&amp;gt;&lt;br /&gt;
   * &amp;lt;pre&amp;gt;&lt;br /&gt;
   * x.clone().getClass() == x.getClass()&amp;lt;/pre&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
   * will be &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt;, but these are not absolute requirements. While it is typically the case that: &amp;lt;blockquote&amp;gt;&lt;br /&gt;
   * &amp;lt;pre&amp;gt;&lt;br /&gt;
   * x.clone().equals(x)&amp;lt;/pre&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
   * will be &amp;lt;tt&amp;gt;true&amp;lt;/tt&amp;gt;, this is not an absolute requirement.&lt;br /&gt;
   * &amp;lt;p/&amp;gt;&lt;br /&gt;
   * By convention, the returned object should be obtained by calling &amp;lt;tt&amp;gt;super.clone&amp;lt;/tt&amp;gt;.  If a class and all of its&lt;br /&gt;
   * superclasses (except &amp;lt;tt&amp;gt;Object&amp;lt;/tt&amp;gt;) obey this convention, it will be the case that &amp;lt;tt&amp;gt;x.clone().getClass() ==&lt;br /&gt;
   * x.getClass()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
   * &amp;lt;p/&amp;gt;&lt;br /&gt;
   * By convention, the object returned by this method should be independent of this object (which is being cloned).  To&lt;br /&gt;
   * achieve this independence, it may be necessary to modify one or more fields of the object returned by&lt;br /&gt;
   * &amp;lt;tt&amp;gt;super.clone&amp;lt;/tt&amp;gt; before returning it.  Typically, this means copying any mutable objects that comprise the&lt;br /&gt;
   * internal &amp;quot;deep structure&amp;quot; of the object being cloned and replacing the references to these objects with references&lt;br /&gt;
   * to the copies.  If a class contains only primitive fields or references to immutable objects, then it is usually&lt;br /&gt;
   * the case that no fields in the object returned by &amp;lt;tt&amp;gt;super.clone&amp;lt;/tt&amp;gt; need to be modified.&lt;br /&gt;
   * &amp;lt;p/&amp;gt;&lt;br /&gt;
   * The method &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; for class &amp;lt;tt&amp;gt;Object&amp;lt;/tt&amp;gt; performs a specific cloning operation. First, if the class of&lt;br /&gt;
   * this object does not implement the interface &amp;lt;tt&amp;gt;Cloneable&amp;lt;/tt&amp;gt;, then a &amp;lt;tt&amp;gt;CloneNotSupportedException&amp;lt;/tt&amp;gt; is&lt;br /&gt;
   * thrown. Note that all arrays are considered to implement the interface &amp;lt;tt&amp;gt;Cloneable&amp;lt;/tt&amp;gt;. Otherwise, this method&lt;br /&gt;
   * creates a new instance of the class of this object and initializes all its fields with exactly the contents of the&lt;br /&gt;
   * corresponding fields of this object, as if by assignment; the contents of the fields are not themselves cloned.&lt;br /&gt;
   * Thus, this method performs a &amp;quot;shallow copy&amp;quot; of this object, not a &amp;quot;deep copy&amp;quot; operation.&lt;br /&gt;
   * &amp;lt;p/&amp;gt;&lt;br /&gt;
   * The class &amp;lt;tt&amp;gt;Object&amp;lt;/tt&amp;gt; does not itself implement the interface &amp;lt;tt&amp;gt;Cloneable&amp;lt;/tt&amp;gt;, so calling the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt;&lt;br /&gt;
   * method on an object whose class is &amp;lt;tt&amp;gt;Object&amp;lt;/tt&amp;gt; will result in throwing an exception at run time.&lt;br /&gt;
   *&lt;br /&gt;
   * @return a clone of this instance.&lt;br /&gt;
   * @throws CloneNotSupportedException if the object&amp;quot;s class does not support the &amp;lt;code&amp;gt;Cloneable&amp;lt;/code&amp;gt; interface.&lt;br /&gt;
   *                                    Subclasses that override the &amp;lt;code&amp;gt;clone&amp;lt;/code&amp;gt; method can also throw this&lt;br /&gt;
   *                                    exception to indicate that an instance cannot be cloned.&lt;br /&gt;
   * @see Cloneable&lt;br /&gt;
   */&lt;br /&gt;
  protected Object clone()&lt;br /&gt;
      throws CloneNotSupportedException&lt;br /&gt;
  {&lt;br /&gt;
    final WeakReferenceList list = (WeakReferenceList) super.clone();&lt;br /&gt;
    list.childs = (Reference[]) childs.clone();&lt;br /&gt;
    return list;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>