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 /** 018 * This class represents a comment that is a part of an article. A comment must have 019 * an ontology element as owner. 020 */ 021 public class Comment extends AbstractStatement { 022 023 private final String text; 024 025 /** 026 * Creates a new comment. 027 * 028 * @param text The comment text. 029 */ 030 protected Comment(String text) { 031 this.text = text; 032 } 033 034 public String getText(String language) { 035 // Comments are not multilingual at this point 036 return text; 037 } 038 039 /** 040 * Returns the (language-independent) text of this comment. 041 * 042 * @return The comment text. 043 */ 044 public String getText() { 045 return text; 046 } 047 048 public String serialize() { 049 return text.replaceAll("~", "~t").replaceAll("\\n", "~n"); 050 } 051 052 }