Package elki.database.ids.integer
Class ArrayStaticIntegerDBIDs
- java.lang.Object
-
- elki.database.ids.integer.ArrayStaticIntegerDBIDs
-
- All Implemented Interfaces:
ArrayDBIDs,ArrayStaticDBIDs,DBIDs,IntegerArrayDBIDs,IntegerArrayStaticDBIDs,IntegerDBIDs,StaticDBIDs
class ArrayStaticIntegerDBIDs extends java.lang.Object implements IntegerArrayStaticDBIDs
Static (no modifications allowed) set of Database Object IDs.- Since:
- 0.4.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classArrayStaticIntegerDBIDs.ItrDBID iterator in ELKI/C style.private classArrayStaticIntegerDBIDs.SliceSlice of an array.
-
Field Summary
Fields Modifier and Type Field Description protected int[]storeThe actual storage.
-
Constructor Summary
Constructors Modifier Constructor Description protectedArrayStaticIntegerDBIDs(int... ids)Constructor.
-
Method Summary
All Methods Instance Methods Concrete 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.DBIDget(int i)Get the i'th entry (starting at 0)ArrayStaticIntegerDBIDs.Itriter()Iterableintsize()Size of the DBID "collection".ArrayStaticIntegerDBIDs.Sliceslice(int begin, int end)Slice a subarray (as view, not copy!)
-
-
-
Method Detail
-
size
public int size()
Description copied from interface:ArrayDBIDsSize of the DBID "collection".- Specified by:
sizein interfaceArrayDBIDs- Specified by:
sizein interfaceDBIDs- Returns:
- size
-
contains
public boolean contains(DBIDRef o)
Description copied from interface:DBIDsTest whether an ID is contained.
-
get
public DBID get(int i)
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.
-
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.
-
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
-
iter
public ArrayStaticIntegerDBIDs.Itr iter()
Description copied from interface:ArrayDBIDsIterable- Specified by:
iterin interfaceArrayDBIDs- Specified by:
iterin interfaceDBIDs- Specified by:
iterin interfaceIntegerArrayDBIDs- Specified by:
iterin interfaceIntegerArrayStaticDBIDs- Specified by:
iterin interfaceIntegerDBIDs- Returns:
- Iterator
-
slice
public ArrayStaticIntegerDBIDs.Slice slice(int begin, int end)
Description copied from interface:ArrayDBIDsSlice a subarray (as view, not copy!)- Specified by:
slicein interfaceArrayDBIDs- Specified by:
slicein interfaceIntegerArrayDBIDs- Parameters:
begin- Begin (inclusive)end- End (exclusive)- Returns:
- Array slice.
-
-