Package elki.database.ids.integer
Class FastutilIntOpenHashSetModifiableDBIDs
- java.lang.Object
-
- elki.database.ids.integer.FastutilIntOpenHashSetModifiableDBIDs
-
- All Implemented Interfaces:
DBIDs
,HashSetDBIDs
,HashSetModifiableDBIDs
,IntegerDBIDs
,ModifiableDBIDs
,SetDBIDs
class FastutilIntOpenHashSetModifiableDBIDs extends java.lang.Object implements HashSetModifiableDBIDs, IntegerDBIDs
Implementation using Fastutil IntSet.- Since:
- 0.5.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
FastutilIntOpenHashSetModifiableDBIDs.IntOpenHashSet
Customized table.protected static class
FastutilIntOpenHashSetModifiableDBIDs.Itr
Iterator over Fastutil hashs.
-
Field Summary
Fields Modifier and Type Field Description (package private) FastutilIntOpenHashSetModifiableDBIDs.IntOpenHashSet
store
The actual store.
-
Constructor Summary
Constructors Modifier Constructor Description protected
FastutilIntOpenHashSetModifiableDBIDs()
Constructor.protected
FastutilIntOpenHashSetModifiableDBIDs(int size)
Constructor.protected
FastutilIntOpenHashSetModifiableDBIDs(DBIDs existing)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(DBIDRef e)
Add a single DBID to the collection.boolean
addDBIDs(DBIDs ids)
Add DBIDs to collection.FastutilIntOpenHashSetModifiableDBIDs
clear()
Clear this collection.boolean
contains(DBIDRef o)
Test whether an ID is contained.boolean
isEmpty()
Test for an empty DBID collection.FastutilIntOpenHashSetModifiableDBIDs.Itr
iter()
Get a DBID iterator (a more efficient API).DBIDVar
pop(DBIDVar outvar)
Pop (get and remove) one DBID from the set, into a variable.boolean
remove(DBIDRef o)
Remove a single DBID from the collection.boolean
removeDBIDs(DBIDs ids)
Remove DBIDs from collection.boolean
retainAll(DBIDs set)
Retain all elements that also are in the second set.int
size()
Retrieve the collection / data size.java.lang.String
toString()
-
-
-
Field Detail
-
store
FastutilIntOpenHashSetModifiableDBIDs.IntOpenHashSet store
The actual store.
-
-
Constructor Detail
-
FastutilIntOpenHashSetModifiableDBIDs
protected FastutilIntOpenHashSetModifiableDBIDs(int size)
Constructor.- Parameters:
size
- Initial size
-
FastutilIntOpenHashSetModifiableDBIDs
protected FastutilIntOpenHashSetModifiableDBIDs()
Constructor.
-
FastutilIntOpenHashSetModifiableDBIDs
protected FastutilIntOpenHashSetModifiableDBIDs(DBIDs existing)
Constructor.- Parameters:
existing
- Existing IDs
-
-
Method Detail
-
iter
public FastutilIntOpenHashSetModifiableDBIDs.Itr iter()
Description copied from interface:DBIDs
Get a DBID iterator (a more efficient API).Example:
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { NumberVector vec = relation.get(iter); // iter is a temporary object reference }
- Specified by:
iter
in interfaceDBIDs
- Specified by:
iter
in interfaceHashSetModifiableDBIDs
- Specified by:
iter
in interfaceIntegerDBIDs
- Specified by:
iter
in interfaceModifiableDBIDs
- Returns:
- iterator
-
addDBIDs
public boolean addDBIDs(DBIDs ids)
Description copied from interface:ModifiableDBIDs
Add DBIDs to collection.- Specified by:
addDBIDs
in interfaceModifiableDBIDs
- Parameters:
ids
- IDs to add.- Returns:
true
if the collection changed.
-
removeDBIDs
public boolean removeDBIDs(DBIDs ids)
Description copied from interface:ModifiableDBIDs
Remove DBIDs from collection.- Specified by:
removeDBIDs
in interfaceModifiableDBIDs
- Parameters:
ids
- IDs to remove.- Returns:
true
if the collection changed.
-
add
public boolean add(DBIDRef e)
Description copied from interface:ModifiableDBIDs
Add a single DBID to the collection.- Specified by:
add
in interfaceModifiableDBIDs
- Parameters:
e
- ID to add- Returns:
true
if the collection changed.
-
remove
public boolean remove(DBIDRef o)
Description copied from interface:ModifiableDBIDs
Remove a single DBID from the collection.- Specified by:
remove
in interfaceModifiableDBIDs
- Parameters:
o
- ID to remove- Returns:
true
if the collection changed.
-
retainAll
public boolean retainAll(DBIDs set)
Description copied from interface:HashSetModifiableDBIDs
Retain all elements that also are in the second set.- Specified by:
retainAll
in interfaceHashSetModifiableDBIDs
- Parameters:
set
- second set- Returns:
- true when modified
-
size
public int size()
Description copied from interface:DBIDs
Retrieve the collection / data size.
-
isEmpty
public boolean isEmpty()
Description copied from interface:DBIDs
Test for an empty DBID collection.
-
clear
public FastutilIntOpenHashSetModifiableDBIDs clear()
Description copied from interface:ModifiableDBIDs
Clear this collection.- Specified by:
clear
in interfaceHashSetModifiableDBIDs
- Specified by:
clear
in interfaceModifiableDBIDs
-
contains
public boolean contains(DBIDRef o)
Description copied from interface:DBIDs
Test whether an ID is contained.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
pop
public DBIDVar pop(DBIDVar outvar)
Description copied from interface:ModifiableDBIDs
Pop (get and remove) one DBID from the set, into a variable.- Specified by:
pop
in interfaceModifiableDBIDs
- Parameters:
outvar
- Output variable- Returns:
- Always
outvar
, for inlining
-
-