public final class DBIDUtil extends Object
Modifier and Type | Field and Description |
---|---|
static EmptyDBIDs |
EMPTYDBIDS
Final, global copy of empty DBIDs.
|
Modifier | Constructor and Description |
---|---|
private |
DBIDUtil()
Static - no public constructor.
|
Modifier and Type | Method and Description |
---|---|
static void |
deallocateDBIDRange(DBIDRange range)
Deallocate a static DBID range.
|
static void |
deallocateSingleDBID(DBID id)
Return a single DBID for reuse.
|
static ModifiableDBIDs |
difference(DBIDs ids1,
DBIDs ids2)
Returns the difference of the two specified collection of IDs.
|
static ArrayDBIDs |
ensureArray(DBIDs ids)
Ensure that the given DBIDs are array-indexable.
|
static ModifiableDBIDs |
ensureModifiable(DBIDs ids)
Ensure modifiable
|
static SetDBIDs |
ensureSet(DBIDs ids)
Ensure that the given DBIDs support fast "contains" operations.
|
static DBID |
generateSingleDBID()
Generate a single DBID
|
static DBIDRange |
generateStaticDBIDRange(int size)
Generate a static DBID range.
|
ByteBufferSerializer<DBID> |
getDBIDSerializer()
Get a serializer for DBIDs
|
ByteBufferSerializer<DBID> |
getDBIDSerializerStatic()
Get a serializer for DBIDs with static size
|
static DBID |
importInteger(int id)
Import an Integer DBID.
|
static ModifiableDBIDs |
intersection(DBIDs first,
DBIDs second)
Compute the set intersection of two sets.
|
static StaticDBIDs |
makeUnmodifiable(DBIDs existing)
Wrap an existing DBIDs collection to be unmodifiable.
|
static ArrayModifiableDBIDs |
newArray()
Make a new (modifiable) array of DBIDs.
|
static ArrayModifiableDBIDs |
newArray(DBIDs existing)
Make a new (modifiable) array of DBIDs.
|
static ArrayModifiableDBIDs |
newArray(int size)
Make a new (modifiable) array of DBIDs.
|
static HashSetModifiableDBIDs |
newHashSet()
Make a new (modifiable) hash set of DBIDs.
|
static HashSetModifiableDBIDs |
newHashSet(DBIDs existing)
Make a new (modifiable) hash set of DBIDs.
|
static HashSetModifiableDBIDs |
newHashSet(int size)
Make a new (modifiable) hash set of DBIDs.
|
static DBIDPair |
newPair(DBID id1,
DBID id2)
Make a DBID pair.
|
static TreeSetModifiableDBIDs |
newTreeSet()
Make a new (modifiable) tree set of DBIDs.
|
static TreeSetModifiableDBIDs |
newTreeSet(DBIDs existing)
Make a new (modifiable) tree set of DBIDs.
|
static TreeSetModifiableDBIDs |
newTreeSet(int size)
Make a new (modifiable) tree set of DBIDs.
|
static ModifiableDBIDs |
randomSample(DBIDs source,
int k,
long seed)
Produce a random sample of the given DBIDs
|
static ModifiableDBIDs |
union(DBIDs ids1,
DBIDs ids2)
Returns the union of the two specified collection of IDs.
|
public static final EmptyDBIDs EMPTYDBIDS
public static DBID importInteger(int id)
id
- Integer IDpublic ByteBufferSerializer<DBID> getDBIDSerializer()
public ByteBufferSerializer<DBID> getDBIDSerializerStatic()
public static DBID generateSingleDBID()
public static void deallocateSingleDBID(DBID id)
id
- DBID to deallocatepublic static DBIDRange generateStaticDBIDRange(int size)
size
- Requested sizepublic static void deallocateDBIDRange(DBIDRange range)
range
- Range to deallocatepublic static ArrayModifiableDBIDs newArray()
public static HashSetModifiableDBIDs newHashSet()
public static TreeSetModifiableDBIDs newTreeSet()
public static ArrayModifiableDBIDs newArray(int size)
size
- Size hintpublic static HashSetModifiableDBIDs newHashSet(int size)
size
- Size hintpublic static TreeSetModifiableDBIDs newTreeSet(int size)
size
- Size hintpublic static ArrayModifiableDBIDs newArray(DBIDs existing)
existing
- Existing DBIDspublic static HashSetModifiableDBIDs newHashSet(DBIDs existing)
existing
- Existing DBIDspublic static TreeSetModifiableDBIDs newTreeSet(DBIDs existing)
existing
- Existing DBIDspublic static ModifiableDBIDs intersection(DBIDs first, DBIDs second)
first
- First setsecond
- Second setpublic static ModifiableDBIDs union(DBIDs ids1, DBIDs ids2)
ids1
- the first collectionids2
- the second collectionpublic static ModifiableDBIDs difference(DBIDs ids1, DBIDs ids2)
ids1
- the first collectionids2
- the second collectionpublic static StaticDBIDs makeUnmodifiable(DBIDs existing)
existing
- Existing collectionpublic static ArrayDBIDs ensureArray(DBIDs ids)
ids
- public static SetDBIDs ensureSet(DBIDs ids)
ids
- public static ModifiableDBIDs ensureModifiable(DBIDs ids)
ids
- public static DBIDPair newPair(DBID id1, DBID id2)
id1
- first IDid2
- second IDpublic static ModifiableDBIDs randomSample(DBIDs source, int k, long seed)
source
- Original DBIDsk
- k Parameterseed
- Random generator seed