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 classIntegerDBIDVar.ItrPseudo iterator for DBIDs interface.
-
Field Summary
Fields Modifier and Type Field Description (package private) intidThe actual value.
-
Constructor Summary
Constructors Modifier Constructor Description protectedIntegerDBIDVar()Constructor.protectedIntegerDBIDVar(DBIDRef val)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DBIDVarassignVar(int i, DBIDVar var)Assign a DBID variable the value of positionindex.intbinarySearch(DBIDRef key)Search for the position of the given key, assuming that the data set is sorted.booleancontains(DBIDRef o)Test whether an ID is contained.DBIDVarfrom(DBIDDataStore store, DBIDRef ref)Update variable from a data store.DBIDget(int i)Deprecated.intinternalGetIndex()Internal only: Get the internal index.protected voidinternalSetIndex(int i)Internal set to integer.booleanisEmpty()Test for an empty DBID collection.booleanisSet()Test if the variable is well-defined.IntegerDBIDVar.Itriter()IterableDBIDVarset(DBIDRef ref)Assign a new value for the reference.intsize()Size of the DBID "collection".ArrayDBIDsslice(int begin, int end)Slice a subarray (as view, not copy!)java.lang.StringtoString()voidunset()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:DBIDRefInternal only: Get the internal index.NOT FOR PUBLIC USE - ELKI Optimization engine only.
- Specified by:
internalGetIndexin 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:DBIDVarAssign a new value for the reference.
-
get
@Deprecated public DBID get(int i)
Deprecated.Description copied from interface:ArrayDBIDsGet the i'th entry (starting at 0)If possible, use an
DBIDArrayIterviaArrayDBIDs.iter()instead, or anDBIDVarviaArrayDBIDs.assignVar(int, elki.database.ids.DBIDVar)- Specified by:
getin interfaceArrayDBIDs- Parameters:
i- Index- Returns:
- DBID of i'th entry.
-
size
public int size()
Description copied from interface:ArrayDBIDsSize of the DBID "collection".- Specified by:
sizein interfaceArrayDBIDs- Specified by:
sizein interfaceDBIDs- Returns:
- size
-
isEmpty
public boolean isEmpty()
Description copied from interface:DBIDsTest for an empty DBID collection.
-
unset
public void unset()
Description copied from interface:DBIDVarClear the contents.
-
isSet
public boolean isSet()
Description copied from interface:DBIDVarTest if the variable is well-defined.
-
binarySearch
public int binarySearch(DBIDRef key)
Description copied from interface:ArrayDBIDsSearch 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:
binarySearchin interfaceArrayDBIDs- Parameters:
key- Key to search for- Returns:
- Offset of key
-
contains
public boolean contains(DBIDRef o)
Description copied from interface:DBIDsTest whether an ID is contained.
-
assignVar
public DBIDVar assignVar(int i, DBIDVar var)
Description copied from interface:ArrayDBIDsAssign a DBID variable the value of positionindex.- Specified by:
assignVarin interfaceArrayDBIDs- Parameters:
i- Positionvar- Variable to assign the value to.
-
from
public DBIDVar from(DBIDDataStore store, DBIDRef ref)
Description copied from interface:DBIDVarUpdate variable from a data store.
-
slice
public ArrayDBIDs slice(int begin, int end)
Description copied from interface:ArrayDBIDsSlice a subarray (as view, not copy!)- Specified by:
slicein interfaceArrayDBIDs- Parameters:
begin- Begin (inclusive)end- End (exclusive)- Returns:
- Array slice.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
iter
public IntegerDBIDVar.Itr iter()
Description copied from interface:ArrayDBIDsIterable- Specified by:
iterin interfaceArrayDBIDs- Specified by:
iterin interfaceDBIDs- Specified by:
iterin interfaceIntegerDBIDs- Returns:
- Iterator
-
-