Corpora.java revision 883c1bf364e38c5b133afb55f8493a14b65f4dd4
1/* 2 * Copyright (C) 2009 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 android.content.ComponentName; 20 21import java.util.Collection; 22 23/** 24 * Maintains the set of available and enabled corpora. 25 */ 26public interface Corpora { 27 28 boolean isCorpusEnabled(Corpus corpus); 29 30 /** 31 * Checks if a corpus should be enabled by default. 32 */ 33 boolean isCorpusDefaultEnabled(Corpus corpus); 34 35 /** 36 * Gets all corpora, including the web corpus. 37 * 38 * @return Callers must not modify the returned collection. 39 */ 40 Collection<Corpus> getAllCorpora(); 41 42 Collection<Corpus> getEnabledCorpora(); 43 44 /** 45 * Gets a corpus by name. 46 * 47 * @return A corpus, or null. 48 */ 49 Corpus getCorpus(String name); 50 51 Source getSource(ComponentName name); 52 53 /** 54 * Gets the corpus that contains the given source. 55 */ 56 Corpus getCorpusForSource(Source source); 57 58 void close(); 59} 60