//============================================================================== // tribble/io/TextLine.java //------------------------------------------------------------------------------ package tribble.io; // System imports import java.lang.String; // Local imports import tribble.io.TextLineI; /******************************************************************************* * Generic numbered text line. * *

* This is a default implementation of the {@link TextLineI} interface. * * * @version $Revision: 1.2 $ $Date: 2003/09/06 19:14:45 $ * @since 2001-04-23 * @author * David R. Tribble * (david@tribble.com). *
* Copyright ©2001-2003 * by David R. Tribble, all rights reserved. *
* Permission is granted to freely use and distribute this source code * provided that the original copyright and authorship notices remain * intact. */ public class TextLine implements TextLineI { // Identification /** Revision information. */ static final String REV = "@(#)tribble/io/TextLine.java $Revision: 1.2 $ $Date: 2003/09/06 19:14:45 $\n"; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Public constructors /*************************************************************************** * Constructor. * * @param text * Textual content for this text line. * * @since 1.2, 2003-09-06 */ public TextLine(String text) { // Initialize m_text = text; } /*************************************************************************** * Constructor. * * @param text * Textual content for this text line. * * @param lineNo * Source line number of this text line. * * @since 1.2, 2003-09-06 */ public TextLine(String text, int lineNo) { // Initialize m_text = text; m_lineNo = lineNo; } /*************************************************************************** * Constructor. * * @param text * Textual content for this text line. * * @param lineNo * Source line number of this text line. * * @param fname * Source file name from whence this text line was read. * * @since 1.2, 2003-09-06 */ public TextLine(String text, int lineNo, String fname) { // Initialize m_text = text; m_lineNo = lineNo; m_fname = fname; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Public methods /*************************************************************************** * Retrieve the textual contents of this text line. * * @return * The contents of this text line. * * @since 1.1, 2001-04-23 */ public String getText() //implements tribble.io.TextLineI { return (m_text); } /*************************************************************************** * Retrieve the source line number of this text line. * * @return * The source line number of this text line. * * @since 1.1, 2001-04-23 */ public int getLineNo() //implements tribble.io.TextLineI { return (m_lineNo); } /*************************************************************************** * Retrieve the source filename of this token. * * @return * The source filename for this token. * * @since 1.1, 2001-04-23 */ public String getFileName() //implements tribble.io.TextLineI { return (m_fname); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Protected variables /** Textual content of this line. */ protected String m_text; /** Source line number. */ protected int m_lineNo; /** Source filename. */ protected String m_fname; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Protected constructors /*************************************************************************** * Default constructor. * * @since 1.2, 2003-09-06 */ protected TextLine() { // Do nothing } } // End TextLine.java