001 // This file is part of AceWiki. 002 // Copyright 2008-2012, AceWiki developers. 003 // 004 // AceWiki is free software: you can redistribute it and/or modify it under the terms of the GNU 005 // Lesser General Public License as published by the Free Software Foundation, either version 3 of 006 // the License, or (at your option) any later version. 007 // 008 // AceWiki is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 009 // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 010 // Lesser General Public License for more details. 011 // 012 // You should have received a copy of the GNU Lesser General Public License along with AceWiki. If 013 // not, see http://www.gnu.org/licenses/. 014 015 package ch.uzh.ifi.attempto.acewiki.core; 016 017 import java.util.List; 018 019 /** 020 * This interface represents an index for the word forms of ontology elements. 021 * 022 * @author Tobias Kuhn 023 */ 024 public interface WordIndex { 025 026 /** 027 * This method is called by the ontology object when a new ontology element is added. 028 * 029 * @param element A new ontology element. 030 */ 031 public void elementAdded(OntologyElement element); 032 033 /** 034 * This method is called by the ontology object when an ontology element is removed. 035 * 036 * @param element The ontology element to be removed. 037 */ 038 public void elementRemoved(OntologyElement element); 039 040 /** 041 * This method is called just before the word forms of an ontology element are changed. 042 * 043 * @param element The ontology element to be changed. 044 */ 045 public void elementBeforeChange(OntologyElement element); 046 047 /** 048 * This method is called just after the word forms of an ontology element have been changed. 049 * 050 * @param element The changed ontology element. 051 */ 052 public void elementAfterChange(OntologyElement element); 053 054 /** 055 * This method should return the ontology element with the given word form, or null if there is 056 * no such element. 057 * 058 * @param word The word form. 059 * @return The ontology element or null. 060 */ 061 public OntologyElement getElement(String word); 062 063 /** 064 * This method should return a list of ontology elements that match the given search text. 065 * 066 * @param searchText The text to search for. 067 * @return The list of ontology elements. 068 */ 069 public List<OntologyElement> searchForElements(String searchText); 070 071 }