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 import ch.uzh.ifi.attempto.base.TextContainer;
020 import ch.uzh.ifi.attempto.base.TextElement;
021 import ch.uzh.ifi.attempto.base.TextOperator;
022
023 /**
024 * This class represents a sentence for a monolingual AceWiki engine.
025 *
026 * @author Tobias Kuhn
027 */
028 public abstract class MonolingualSentence extends AbstractSentence {
029
030 /**
031 * Initializes a new sentence.
032 */
033 protected MonolingualSentence() {
034 }
035
036 /**
037 * Returns a list of text elements that represent the tokens of this sentence.
038 *
039 * @return A token list.
040 */
041 public abstract List<TextElement> getTextElements();
042
043 public final List<TextElement> getTextElements(String language) {
044 return getTextElements();
045 }
046
047 /**
048 * Returns a text container with the text of this sentence in the only available language.
049 *
050 * @return The text container.
051 */
052 protected abstract TextContainer getTextContainer();
053
054 protected final TextContainer getTextContainer(String language) {
055 return getTextContainer();
056 }
057
058 /**
059 * Returns the text of this sentence in the only available language.
060 *
061 * @return The sentence text.
062 */
063 public String getText() {
064 return getText("Default");
065 }
066
067 /**
068 * Returns a list of sentence details to be shown to the user.
069 *
070 * @return A list of sentence details.
071 */
072 public abstract List<SentenceDetail> getDetails();
073
074 public final List<SentenceDetail> getDetails(String language) {
075 return getDetails();
076 }
077
078 /**
079 * Returns the text operator for the given language.
080 *
081 * @return The text operator.
082 */
083 protected TextOperator getTextOperator() {
084 return getTextOperator("Default");
085 }
086
087 }