View Javadoc
1 // re/mind - Remote Reminder Software 2 // Copyright (C) 2002 Moritz Petersen 3 // 4 // This program is free software; you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation; either version 2 of the License, or 7 // (at your option) any later version. 8 // 9 // This program is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with this program; if not, write to the Free Software 16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 // 18 // $Id: Note.java,v 1.1 2002/09/29 19:33:23 powerpete Exp $ 19 package de.jface.remind.core; 20 21 /*** 22 * The <code>Note</code> represents one note, that can be 23 * posted. It contains a text ({@link NoteText}) and metadata 24 * ({@link NoteMetaData}). It is identified using it's metadata, so it 25 * can be identified, even if the text has changed. 26 * 27 * @author Moritz Petersen 28 * @version $Revision: 1.1 $ 29 */ 30 public class Note 31 { 32 /*** 33 * The NoteText of this note. 34 */ 35 private NoteText noteText; 36 37 /*** 38 * The metadata of this note. 39 */ 40 private final NoteMetaData noteMetaData; 41 42 public Note() 43 { 44 this(new NoteMetaData()); 45 } 46 47 /*** 48 * Creates a new Note with a new NoteMetaData. 49 */ 50 public Note(NoteMetaData noteMetaData) 51 { 52 this.noteMetaData = noteMetaData; 53 noteText = new NoteText(); 54 } 55 56 /*** 57 * Returns the text of the note. A newly created 58 * note contains an empty text. 59 * 60 * @return the text of the note. 61 */ 62 public NoteText getText() 63 { 64 return noteText; 65 } 66 67 /*** 68 * Sets the text of the note and replaces the old 69 * text. If <code>text</code> is <code>null</code>, 70 * then the text is not changed. 71 * 72 * @param text the text of the note. If it is 73 * <code>null</code>, then the existing text remains 74 * unchanged. 75 */ 76 public void setText(NoteText noteText) 77 { 78 this.noteText = noteText; 79 } 80 81 /*** 82 * Returns the metadata of the note. The metadata is not changeable. 83 * 84 * @return the metadata of the note. 85 */ 86 public NoteMetaData getMetaData() 87 { 88 return noteMetaData; 89 } 90 91 /*** 92 * Compares this instance with the given object. A note 93 * is equal to another note, if the NoteMetaData instances of 94 * bothe objects are equal. 95 * 96 * @param o The object to compare with. 97 * @return true, if both objects are equal, using the 98 * {@link NoteMetaData#equals(Object)} method. 99 */ 100 public boolean equals(Object o) 101 { 102 Note n = (Note) o; 103 104 return noteMetaData.equals(n.noteMetaData); 105 } 106 107 public String toString() 108 { 109 return new StringBuffer(getClass().getName()).append(" [noteText = ") 110 .append(noteText) 111 .append(", noteMetaData = ") 112 .append(noteMetaData) 113 .append("]").toString(); 114 } 115 }

This page was automatically generated by Maven