org.aspectbench.tm.runtime.internal
Class IndexTreeLeafSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet
          extended by org.aspectbench.tm.runtime.internal.IndexTreeLeafSet
All Implemented Interfaces:
java.lang.Iterable, java.util.Collection, java.util.Set, IndexTreeLeaf, WeakRefContainer

public class IndexTreeLeafSet
extends java.util.AbstractSet
implements IndexTreeLeaf

A class implementing the sets of ITDBindings stored at the leaves of an IndexTree. Comparison is by object identity, and only weak references are kept to objects. As this is part of an IndexTree data structure, the values will all be boxed in MaybeWeakRefs (the tm update code needs to control strength of references). Since these are canonical, a simple IdentityHashMap suffices as a delegate object.

Author:
Pavel Avgustinov

Constructor Summary
IndexTreeLeafSet(org.aspectbench.tm.runtime.internal.IndexTreeMap.IndexTreeLevelMap parent, java.lang.Object key)
          Construct a new IndexTreeLeafSet contained in the Map parent under the given key.
 
Method Summary
 boolean add(java.lang.Object key)
           
 void cleanup()
          Check whether this set is empty; if so, recurse up the IndexTree dropping empty branches.
 void clear()
           
 boolean contains(java.lang.Object key)
           
 java.util.Iterator iterator()
           
 boolean remove(java.lang.Object key)
           
 int size()
           
 void weakrefExpired(MyWeakRef ref)
           
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray
 

Constructor Detail

IndexTreeLeafSet

public IndexTreeLeafSet(org.aspectbench.tm.runtime.internal.IndexTreeMap.IndexTreeLevelMap parent,
                        java.lang.Object key)
Construct a new IndexTreeLeafSet contained in the Map parent under the given key.

Method Detail

add

public boolean add(java.lang.Object key)
Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.Set
Overrides:
add in class java.util.AbstractCollection

clear

public void clear()
Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.Set
Overrides:
clear in class java.util.AbstractCollection

contains

public boolean contains(java.lang.Object key)
Specified by:
contains in interface java.util.Collection
Specified by:
contains in interface java.util.Set
Overrides:
contains in class java.util.AbstractCollection

remove

public boolean remove(java.lang.Object key)
Specified by:
remove in interface java.util.Collection
Specified by:
remove in interface java.util.Set
Overrides:
remove in class java.util.AbstractCollection

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in interface java.util.Set
Specified by:
iterator in class java.util.AbstractCollection

size

public int size()
Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.Set
Specified by:
size in class java.util.AbstractCollection

cleanup

public void cleanup()
Description copied from interface: IndexTreeLeaf
Check whether this set is empty; if so, recurse up the IndexTree dropping empty branches.

Specified by:
cleanup in interface IndexTreeLeaf

weakrefExpired

public void weakrefExpired(MyWeakRef ref)
Specified by:
weakrefExpired in interface WeakRefContainer