elki.database.ids.DBIDRef Maven / Gradle / Ivy
Show all versions of elki-core-dbids Show documentation
/*
* This file is part of ELKI:
* Environment for Developing KDD-Applications Supported by Index-Structures
*
* Copyright (C) 2022
* ELKI Development Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
package elki.database.ids;
/**
* Some object referencing a {@link DBID}. Could be a {@link DBID}, a
* {@link DBIDIter}, for example.
*
* Important note: do not assume this reference to be stable. Iterators
* are a good example how the DBIDRef may change.
*
* @author Erich Schubert
* @since 0.5.0
*
* @opt nodefillcolor LemonChiffon
*
* @navhas - references - DBID
*/
public interface DBIDRef {
/**
* Internal only: Get the internal index.
*
* NOT FOR PUBLIC USE - ELKI Optimization engine only.
*
* @return Internal index
*/
int internalGetIndex();
/**
* WARNING: Hash codes of this interface might not be stable
* (e.g., for iterators).
*
* Use {@link DBIDUtil#deref} to get an object with a stable hash code!
*
* @return current hash code (may change!)
* @deprecated Do not use this hash code. Some implementations will not offer
* stable hash codes!
*/
@Override
@Deprecated
int hashCode();
/**
* WARNING: calling equality on a reference may be an indicator of
* incorrect usage, as it is not clear whether the programmer meant the
* references to be the same or the DBIDs.
*
* Use {@link DBIDUtil#equal} or {@link DBIDUtil#compare}!
*
* @param obj Object to compare with
* @return True when they are the same object
* @deprecated Use {@link DBIDUtil#equal} instead.
*/
@Override
@Deprecated
boolean equals(Object obj);
}