1 /* 2 * This file is part of ELKI: 3 * Environment for Developing KDD-Applications Supported by Index-Structures 4 * 5 * Copyright (C) 2018 6 * ELKI Development Team 7 * 8 * This program is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU Affero General Public License as published by 10 * the Free Software Foundation, either version 3 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU Affero General Public License for more details. 17 * 18 * You should have received a copy of the GNU Affero General Public License 19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 20 */ 21 package de.lmu.ifi.dbs.elki.database.ids; 22 23 /** 24 * Some object referencing a {@link DBID}. Could be a {@link DBID}, a 25 * {@link DBIDIter}, for example. 26 * <p> 27 * Important note: <em>do not assume this reference to be stable</em>. Iterators 28 * are a good example how the DBIDRef may change. 29 * 30 * @author Erich Schubert 31 * @since 0.5.0 32 * 33 * @opt nodefillcolor LemonChiffon 34 * 35 * @navhas - references - DBID 36 */ 37 public interface DBIDRef { 38 /** 39 * <b>Internal only:</b> Get the internal index. 40 * <p> 41 * <b>NOT FOR PUBLIC USE - ELKI Optimization engine only.</b> 42 * 43 * @return Internal index 44 */ internalGetIndex()45 int internalGetIndex(); 46 47 /** 48 * <b>WARNING:</b> Hash codes of this interface <b>might not be stable</b> 49 * (e.g. for iterators). 50 * <p> 51 * Use {@link DBIDUtil#deref} to get an object with a stable hash code! 52 * 53 * @return current hash code (<b>may change!</b>) 54 * @deprecated Do not use this hash code. Some implementations will not offer 55 * stable hash codes! 56 */ 57 @Override 58 @Deprecated hashCode()59 int hashCode(); 60 61 /** 62 * <b>WARNING:</b> calling equality on a reference may be an indicator of 63 * incorrect usage, as it is not clear whether the programmer meant the 64 * references to be the same or the DBIDs. 65 * <p> 66 * Use {@link DBIDUtil#equal} or {@link DBIDUtil#compare}! 67 * 68 * @param obj Object to compare with 69 * @return True when they are the same object 70 * @deprecated Use {@link DBIDUtil#equal} instead. 71 */ 72 @Override 73 @Deprecated equals(Object obj)74 boolean equals(Object obj); 75 } 76