CorpusRanker.java revision 6859aead3af0680b2c9dc326244aa89835c2c852
1/* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.quicksearchbox; 18 19import com.android.quicksearchbox.util.Consumer; 20 21import android.database.DataSetObserver; 22 23import java.util.List; 24 25/** 26 * Orders corpora by importance. 27 */ 28public interface CorpusRanker { 29 30 /** 31 * Clears any currently cached ranking. 32 */ 33 void clear(); 34 35 /** 36 * Gets a an ordered list of corpora. 37 * 38 * @param consumer Consumer that will be given the list of ranked corpora. 39 * The consumer is called on an unspecified thread. 40 * The most important corpora come first in the list. Callers should not modify the 41 * list. 42 */ 43 void getRankedCorpora(Consumer<List<Corpus>> consumer); 44 45 /** 46 * Registers an observer that is called when the corpus list changes. 47 * 48 * @param observer gets notified when the corpus list changes. 49 */ 50 void registerDataSetObserver(DataSetObserver observer); 51 52 /** 53 * Unregisters an observer that has previously been registered with 54 * {@link #registerDataSetObserver(DataSetObserver)} 55 * 56 * @param observer the observer to unregister. 57 */ 58 void unregisterDataSetObserver(DataSetObserver observer); 59 60} 61