Package elki.database.ids
Class EmptyDBIDs
- java.lang.Object
-
- elki.database.ids.EmptyDBIDs
-
- All Implemented Interfaces:
ArrayDBIDs,ArrayStaticDBIDs,DBIDs,SetDBIDs,StaticDBIDs
public class EmptyDBIDs extends java.lang.Object implements ArrayStaticDBIDs, SetDBIDs
Empty DBID collection.- Since:
- 0.4.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classEmptyDBIDs.EmptyDBIDIteratorIterator for empty DBIDs-
-
Field Summary
Fields Modifier and Type Field Description static EmptyDBIDs.EmptyDBIDIteratorEMPTY_ITERATOREmpty DBID iterator.
-
Constructor Summary
Constructors Modifier Constructor Description protectedEmptyDBIDs()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DBIDVarassignVar(int index, 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.voidforEach(java.util.function.Consumer<? super DBIDRef> action)Execute a function for each ID.DBIDget(int i)Get the i'th entry (starting at 0)booleanisEmpty()Test for an empty DBID collection.DBIDArrayMIteriter()Iterableintsize()Size of the DBID "collection".ArrayDBIDsslice(int begin, int end)Slice a subarray (as view, not copy!)
-
-
-
Field Detail
-
EMPTY_ITERATOR
public static final EmptyDBIDs.EmptyDBIDIterator EMPTY_ITERATOR
Empty DBID iterator.
-
-
Method Detail
-
contains
public boolean contains(DBIDRef o)
Description copied from interface:DBIDsTest whether an ID is contained.
-
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.
-
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 index, DBIDVar var)
Description copied from interface:ArrayDBIDsAssign a DBID variable the value of positionindex.- Specified by:
assignVarin interfaceArrayDBIDs- Parameters:
index- Positionvar- Variable to assign the value to.
-
iter
public DBIDArrayMIter iter()
Description copied from interface:ArrayDBIDsIterable- Specified by:
iterin interfaceArrayDBIDs- Specified by:
iterin interfaceDBIDs- Returns:
- Iterator
-
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
-
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.
-
-