Package elki.database.ids.integer
Class IntegerDBIDVar
- java.lang.Object
-
- elki.database.ids.integer.IntegerDBIDVar
-
- All Implemented Interfaces:
ArrayDBIDs
,DBIDRef
,DBIDs
,DBIDVar
,IntegerDBIDs
,SetDBIDs
class IntegerDBIDVar extends java.lang.Object implements DBIDVar, IntegerDBIDs
Variable for storing a single DBID reference.- Since:
- 0.5.5
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
IntegerDBIDVar.Itr
Pseudo iterator for DBIDs interface.
-
Field Summary
Fields Modifier and Type Field Description (package private) int
id
The actual value.
-
Constructor Summary
Constructors Modifier Constructor Description protected
IntegerDBIDVar()
Constructor.protected
IntegerDBIDVar(DBIDRef val)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DBIDVar
assignVar(int i, DBIDVar var)
Assign a DBID variable the value of positionindex
.int
binarySearch(DBIDRef key)
Search for the position of the given key, assuming that the data set is sorted.boolean
contains(DBIDRef o)
Test whether an ID is contained.DBIDVar
from(DBIDDataStore store, DBIDRef ref)
Update variable from a data store.DBID
get(int i)
Deprecated.int
internalGetIndex()
Internal only: Get the internal index.protected void
internalSetIndex(int i)
Internal set to integer.boolean
isEmpty()
Test for an empty DBID collection.boolean
isSet()
Test if the variable is well-defined.IntegerDBIDVar.Itr
iter()
IterableDBIDVar
set(DBIDRef ref)
Assign a new value for the reference.int
size()
Size of the DBID "collection".ArrayDBIDs
slice(int begin, int end)
Slice a subarray (as view, not copy!)java.lang.String
toString()
void
unset()
Clear the contents.
-
-
-
Constructor Detail
-
IntegerDBIDVar
protected IntegerDBIDVar()
Constructor.
-
IntegerDBIDVar
protected IntegerDBIDVar(DBIDRef val)
Constructor.- Parameters:
val
-
-
-
Method Detail
-
internalGetIndex
public int internalGetIndex()
Description copied from interface:DBIDRef
Internal only: Get the internal index.NOT FOR PUBLIC USE - ELKI Optimization engine only.
- Specified by:
internalGetIndex
in interfaceDBIDRef
- Returns:
- Internal index
-
internalSetIndex
protected void internalSetIndex(int i)
Internal set to integer.- Parameters:
i
- integer value
-
set
public DBIDVar set(DBIDRef ref)
Description copied from interface:DBIDVar
Assign a new value for the reference.
-
get
@Deprecated public DBID get(int i)
Deprecated.Description copied from interface:ArrayDBIDs
Get the i'th entry (starting at 0)If possible, use an
DBIDArrayIter
viaArrayDBIDs.iter()
instead, or anDBIDVar
viaArrayDBIDs.assignVar(int, elki.database.ids.DBIDVar)
- Specified by:
get
in interfaceArrayDBIDs
- Parameters:
i
- Index- Returns:
- DBID of i'th entry.
-
size
public int size()
Description copied from interface:ArrayDBIDs
Size of the DBID "collection".- Specified by:
size
in interfaceArrayDBIDs
- Specified by:
size
in interfaceDBIDs
- Returns:
- size
-
isEmpty
public boolean isEmpty()
Description copied from interface:DBIDs
Test for an empty DBID collection.
-
unset
public void unset()
Description copied from interface:DBIDVar
Clear the contents.
-
isSet
public boolean isSet()
Description copied from interface:DBIDVar
Test if the variable is well-defined.
-
binarySearch
public int binarySearch(DBIDRef key)
Description copied from interface:ArrayDBIDs
Search for the position of the given key, assuming that the data set is sorted. For unsorted arrays, the result is undefined.For keys not found,
-(1+insertion position)
is returned, as for JavaCollections.binarySearch(java.util.List<? extends java.lang.Comparable<? super T>>, T)
- Specified by:
binarySearch
in interfaceArrayDBIDs
- Parameters:
key
- Key to search for- Returns:
- Offset of key
-
contains
public boolean contains(DBIDRef o)
Description copied from interface:DBIDs
Test whether an ID is contained.
-
assignVar
public DBIDVar assignVar(int i, DBIDVar var)
Description copied from interface:ArrayDBIDs
Assign a DBID variable the value of positionindex
.- Specified by:
assignVar
in interfaceArrayDBIDs
- Parameters:
i
- Positionvar
- Variable to assign the value to.
-
from
public DBIDVar from(DBIDDataStore store, DBIDRef ref)
Description copied from interface:DBIDVar
Update variable from a data store.
-
slice
public ArrayDBIDs slice(int begin, int end)
Description copied from interface:ArrayDBIDs
Slice a subarray (as view, not copy!)- Specified by:
slice
in interfaceArrayDBIDs
- Parameters:
begin
- Begin (inclusive)end
- End (exclusive)- Returns:
- Array slice.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
iter
public IntegerDBIDVar.Itr iter()
Description copied from interface:ArrayDBIDs
Iterable- Specified by:
iter
in interfaceArrayDBIDs
- Specified by:
iter
in interfaceDBIDs
- Specified by:
iter
in interfaceIntegerDBIDs
- Returns:
- Iterator
-
-