1 2 package net.obsearch.ob; 3 import net.obsearch.exception.OBException; 4 import net.obsearch.OB; 5 6 /* 7 OBSearch: a distributed similarity search engine 8 This project is to similarity search what 'bit-torrent' is to downloads. 9 Copyright (C) 2007 Arnoldo Jose Muller Molina 10 11 This program is free software: you can redistribute it and/or modify 12 it under the terms of the GNU General Public License as published by 13 the Free Software Foundation, either version 3 of the License, or 14 (at your option) any later version. 15 16 This program is distributed in the hope that it will be useful, 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 GNU General Public License for more details. 20 21 You should have received a copy of the GNU General Public License 22 along with this program. If not, see <http://www.gnu.org/licenses/>. 23 */ 24 /** 25 * Any Object whose distance function returns bytes must implement this 26 * interface. WARNING: The equals method *must* be implemented. The equals does 27 * not have to be true when the distance returns 0. Note however that at search 28 * time, elements of distance 0 are treated in the same way. Equals is only used 29 * when the database is queried for the existence of an object. 30 * @author Arnoldo Jose Muller Molina 31 * @since 0.7 32 */ 33 34 35 public interface OBByte extends OB{ 36 37 /** 38 * Calculates the similarity of "this" and "object". The function must 39 * satisfy the triangular inequality and return a byte. 40 * @param object 41 * The object of type OBByte to be compared 42 * @param result 43 * The resulting distance 44 * @since 0.7 45 * @throws OBException 46 * User generated exception 47 */ 48 byte distance(OBByte object) throws OBException; 49 }