Package elki.database.ids.integer
Class IntegerDBIDPair
- java.lang.Object
-
- elki.database.ids.integer.IntegerDBIDPair
-
- All Implemented Interfaces:
ArrayDBIDs
,DBIDPair
,DBIDs
,IntegerDBIDs
class IntegerDBIDPair extends java.lang.Object implements DBIDPair, IntegerDBIDs
DBID pair using two ints for storage.- Since:
- 0.4.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
IntegerDBIDPair.Itr
Iterator.private class
IntegerDBIDPair.Slice
Slice of an array.
-
Constructor Summary
Constructors Modifier Constructor Description protected
IntegerDBIDPair(int first, int second)
Initialize pair
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DBIDVar
assignVar(int index, 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.boolean
equals(java.lang.Object obj)
DBID
get(int i)
Deprecated.IntegerDBID
getFirst()
Deprecated.IntegerDBID
getSecond()
Deprecated.int
hashCode()
Canonical hash function, mixing the two hash values.boolean
isEmpty()
Test for an empty DBID collection.IntegerDBIDArrayIter
iter()
Iterableint
size()
Size of the DBID "collection".ArrayDBIDs
slice(int begin, int end)
Slice a subarray (as view, not copy!)java.lang.String
toString()
Canonical toString operator
-
-
-
Method Detail
-
toString
public java.lang.String toString()
Canonical toString operator- Overrides:
toString
in classjava.lang.Object
-
getFirst
@Deprecated public final IntegerDBID getFirst()
Deprecated.Description copied from interface:DBIDPair
Getter for first.
-
getSecond
@Deprecated public final IntegerDBID getSecond()
Deprecated.Description copied from interface:DBIDPair
Getter for second element in pair
-
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.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public final int hashCode()
Canonical hash function, mixing the two hash values.- Overrides:
hashCode
in classjava.lang.Object
-
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
-
contains
public boolean contains(DBIDRef o)
Description copied from interface:DBIDs
Test whether an ID is contained.
-
isEmpty
public boolean isEmpty()
Description copied from interface:DBIDs
Test for an empty DBID collection.
-
assignVar
public DBIDVar assignVar(int index, DBIDVar var)
Description copied from interface:ArrayDBIDs
Assign a DBID variable the value of positionindex
.- Specified by:
assignVar
in interfaceArrayDBIDs
- Parameters:
index
- Positionvar
- Variable to assign the value to.
-
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.
-
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
-
iter
public IntegerDBIDArrayIter iter()
Description copied from interface:ArrayDBIDs
Iterable- Specified by:
iter
in interfaceArrayDBIDs
- Specified by:
iter
in interfaceDBIDs
- Specified by:
iter
in interfaceIntegerDBIDs
- Returns:
- Iterator
-
-