edu.rice.cs.drjava.model.compiler
Class CompilerError

java.lang.Object
  |
  +--edu.rice.cs.drjava.model.compiler.CompilerError
All Implemented Interfaces:
Comparable

public class CompilerError
extends Object
implements Comparable

A class to represent compiler errors. Having this class allows DrJava to make the errors as legible as possible.

Version:
$Id: CompilerError.java,v 1.11 2002/08/06 16:45:46 cmcgraw Exp $

Field Summary
private  File _file
           
private  boolean _isWarning
           
private  int _lineNumber
          zero-based line number.
private  String _message
           
private  int _startColumn
          zero-based column number.
 
Constructor Summary
CompilerError(File file, int lineNumber, int startColumn, String message, boolean isWarning)
          Constructor.
CompilerError(String message, boolean isWarning)
          Constructor for CompilerErrors without files.
 
Method Summary
private  int compareByPosition(CompilerError other)
          Compares this error with the given one, based first on line number, and then by column.
 int compareTo(Object o)
          Compares by file, then by line, then by column.
 File file()
          Gets the file.
 String fileName()
          Gets the full name of the file.
 boolean isWarning()
          Determines if the error is a warning.
 int lineNumber()
          Gets the line number of the error.
 String message()
          Gets the error message.
 int startColumn()
          Gets the column where the error begins.
 String toString()
          Gets a String representation of the error.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

_file

private File _file

_lineNumber

private int _lineNumber
zero-based line number.

_startColumn

private int _startColumn
zero-based column number.

_message

private String _message

_isWarning

private boolean _isWarning
Constructor Detail

CompilerError

public CompilerError(File file,
                     int lineNumber,
                     int startColumn,
                     String message,
                     boolean isWarning)
Constructor.
Parameters:
File - file the file where the error occurred
int - lineNumber the line number of the error
int - startColumn the starting column of the error
String - message the error message
boolean - isWarning true if the error is a warning

CompilerError

public CompilerError(String message,
                     boolean isWarning)
Constructor for CompilerErrors without files.
Parameters:
String - message the error message
boolean - isWarning true if the error is a warning
Method Detail

toString

public String toString()
Gets a String representation of the error.
Overrides:
toString in class Object
Returns:
the error as a String

file

public File file()
Gets the file.
Returns:
the file with errors.

fileName

public String fileName()
Gets the full name of the file.
Returns:
the file name.

lineNumber

public int lineNumber()
Gets the line number of the error.
Returns:
the line number

startColumn

public int startColumn()
Gets the column where the error begins.
Returns:
the starting column

message

public String message()
Gets the error message.
Returns:
the error message.

isWarning

public boolean isWarning()
Determines if the error is a warning.
Returns:
true if the error is a warning.

compareTo

public int compareTo(Object o)
Compares by file, then by line, then by column. Errors without files are considered equal, but less than any errors with files.
Specified by:
compareTo in interface Comparable

compareByPosition

private int compareByPosition(CompilerError other)
Compares this error with the given one, based first on line number, and then by column.