org.hypergraphdb.atom
Class HGAtomSet
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<HGHandle>
org.hypergraphdb.atom.HGAtomSet
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<HGHandle>, java.util.Collection<HGHandle>, java.util.Set<HGHandle>
public final class HGAtomSet
- extends java.util.AbstractSet<HGHandle>
- implements java.util.Set<HGHandle>, java.lang.Cloneable, java.io.Serializable
A HGAtomSet represents a temporary construction of a set of atoms.
Each atom handle is stored in the set. The implementation provides:
- Very fast membership operation.
- Fast addition and removal of elements.
- Long term persistence of the set.
Normally, an instance of HGAtomSet is added to HyperGraph with
the MANAGED system flag. Thus,
as with all HyperGraph managed atoms, a HGAtomSet may be removed
from permanent storage at the discretion of the system, following the usage
frequency of this atom.
- Author:
- Borislav Iordanov
- See Also:
- Serialized Form
| Methods inherited from class java.util.AbstractSet |
removeAll |
| Methods inherited from class java.util.AbstractCollection |
addAll, contains, containsAll, remove, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray |
HGAtomSet
public HGAtomSet()
add
public boolean add(HGHandle h)
- Specified by:
add in interface java.util.Collection<HGHandle>- Specified by:
add in interface java.util.Set<HGHandle>- Overrides:
add in class java.util.AbstractCollection<HGHandle>
remove
public boolean remove(HGHandle h)
contains
public boolean contains(HGHandle h)
size
public int size()
- Specified by:
size in interface java.util.Collection<HGHandle>- Specified by:
size in interface java.util.Set<HGHandle>- Specified by:
size in class java.util.AbstractCollection<HGHandle>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface java.util.Collection<HGHandle>- Specified by:
isEmpty in interface java.util.Set<HGHandle>- Overrides:
isEmpty in class java.util.AbstractCollection<HGHandle>
clear
public void clear()
- Specified by:
clear in interface java.util.Collection<HGHandle>- Specified by:
clear in interface java.util.Set<HGHandle>- Overrides:
clear in class java.util.AbstractCollection<HGHandle>
clone
public java.lang.Object clone()
- Overrides:
clone in class java.lang.Object
iterator
public java.util.Iterator<HGHandle> iterator()
Return an Iterator over all atoms in this set. Contrary to many
iterator implementations, the remove of the returned iterator is
actually a defined operation and one can use the iterator to selectively remove
elements from the set.
- Specified by:
iterator in interface java.lang.Iterable<HGHandle>- Specified by:
iterator in interface java.util.Collection<HGHandle>- Specified by:
iterator in interface java.util.Set<HGHandle>- Specified by:
iterator in class java.util.AbstractCollection<HGHandle>
hashCode
public int hashCode()
- Specified by:
hashCode in interface java.util.Collection<HGHandle>- Specified by:
hashCode in interface java.util.Set<HGHandle>- Overrides:
hashCode in class java.util.AbstractSet<HGHandle>
equals
public boolean equals(java.lang.Object x)
- Specified by:
equals in interface java.util.Collection<HGHandle>- Specified by:
equals in interface java.util.Set<HGHandle>- Overrides:
equals in class java.util.AbstractSet<HGHandle>