View Javadoc

1   /*
2    wsmo4j - a WSMO API and Reference Implementation
3    Copyright (c) 2005, University of Innsbruck, Austria
4    This library is free software; you can redistribute it and/or modify it under
5    the terms of the GNU Lesser General Public License as published by the Free
6    Software Foundation; either version 2.1 of the License, or (at your option)
7    any later version.
8    This library is distributed in the hope that it will be useful, but WITHOUT
9    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10   FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11   details.
12   You should have received a copy of the GNU Lesser General Public License along
13   with this library; if not, write to the Free Software Foundation, Inc.,
14   59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15   */
16  package org.deri.wsmo4j.io.parser.rdf;
17  
18  /**
19   * This class gives structure to an abstract RDF Parser Message, 
20   * which can be either a warning or an error.
21   *
22   * <pre>
23   *  Created on Nov 14, 2006
24   *  Committed by $Author: nathaliest $
25   *  $Source$
26   * </pre>
27   *
28   * @author nathalie.steinmetz@deri.org
29   * @version $Revision: 1876 $ $Date: 2006-11-16 11:53:28 +0200 (Thu, 16 Nov 2006) $
30   */
31  public abstract class RDFParserMessage {
32  
33  	private String message;
34  	
35  	private int lineNo;
36      
37      private int colNo;
38  	
39      public RDFParserMessage(String message, int lineNo, int colNo) {
40          this.message = message;
41          this.lineNo = lineNo;
42          this.colNo = colNo;
43      }
44      
45      /**
46       * Gets the message associated with this parser message.
47       * 
48       * @return The parser message.
49       */
50      public String getMessage() {
51          return message;
52      }
53      
54      /**
55       * Gets the line number associated with this parser message.
56       * 
57       * @return A line number, or -1 if no line number is available or applicable.
58       */
59      public int getLine() {
60          return lineNo;
61      }
62      
63      /**
64       * Gets the column number associated with this parser message.
65       * 
66       * @return A column number, or -1 if no column number is available or applicable.
67       */
68      public int getColumn() {
69          return colNo;
70      }
71      
72  	/**
73       * @return A textual representation of an RDFParserWarning
74       * @see java.lang.Object#toString()
75       */
76      public String toString() {
77          if (lineNo != -1) {
78              return message + " - at line: " + lineNo + ", at column: " + colNo;
79          }
80          else {
81              return message;
82          }
83      }
84      
85  }
86  /*
87   * $Log$
88   * Revision 1.1  2006/11/16 09:53:28  nathaliest
89   * added RDFParserError
90   *
91   *
92   */