- java.lang.Object
-
- org.tentackle.model.SourceInfo
-
public class SourceInfo extends java.lang.ObjectInformation about the source.- Author:
- harald
-
-
Constructor Summary
Constructors Constructor Description SourceInfo(java.lang.String fileName)Creates a source info.SourceInfo(java.lang.String fileName, int lineNumber)Creates a source info.SourceInfo(java.lang.String fileName, int lineNumber, int position)Creates a source info.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SourceInfoadd(int lineOffset, int positionOffset)Returns a source info with offsets added.booleanequals(java.lang.Object obj)java.lang.StringgetFileName()Gets the filename.intgetLineNumber()Gets the line number.intgetPosition()Gets the character position within the line.java.lang.StringgetShortFileName()Gets the filename without leading directories.inthashCode()java.lang.StringtoString()
-
-
-
Constructor Detail
-
SourceInfo
public SourceInfo(java.lang.String fileName, int lineNumber, int position)Creates a source info.- Parameters:
fileName- the namelineNumber- the linenumber (starting at 1, 0 if unknown)position- the character position withing the line (starting at 1, 0 if unknown)
-
SourceInfo
public SourceInfo(java.lang.String fileName, int lineNumber)Creates a source info.- Parameters:
fileName- the namelineNumber- the linenumber (starting at 1)
-
SourceInfo
public SourceInfo(java.lang.String fileName)
Creates a source info.- Parameters:
fileName- the name
-
-
Method Detail
-
getFileName
public java.lang.String getFileName()
Gets the filename.- Returns:
- the filename
-
getShortFileName
public java.lang.String getShortFileName()
Gets the filename without leading directories.- Returns:
- the short filename
-
getLineNumber
public int getLineNumber()
Gets the line number.- Returns:
- the line number starting at 1
-
getPosition
public int getPosition()
Gets the character position within the line.- Returns:
- the position, starting at 1
-
add
public SourceInfo add(int lineOffset, int positionOffset)
Returns a source info with offsets added.- Parameters:
lineOffset- number of lines to addpositionOffset- number of character positions to add- Returns:
- the new info
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-