java.lang.Object
dev.civl.abc.token.IF.SourceFile
- All Implemented Interfaces:
Comparable<SourceFile>
Information object for a source file processed by ABC. Wraps a
File
with a unique integer index that can be used to identify that file in this
ABC invocation, and possibly other information.-
Constructor Summary
ConstructorsConstructorDescriptionSourceFile(File file, int index) Constructs new indexer in which the nickname is just the name of the given file (without path).SourceFile(File file, int index, String nickname) Constructs newSourceFilewith given fields. -
Method Summary
Modifier and TypeMethodDescriptionintbooleangetFile()Returns theFilewrapped by this object.intgetIndex()Returns the index,the index of thisSourceFilein the ordered list of allSourceFiles managed by theFileIndexerthat is managing thisSourceFileConstructs a string of the form "f"+index, which can be used to distinguish this sourcefile from all sourcefiles controlled by an indexer.getName()Returns the filename (without the path prefix).Returns the "nickname" that has been associated to this file.getPath()Returns the complete path for the file, including the filename.inthashCode()toString()Constructs a human-readable string representation of this object, showing values of all fields.
-
Constructor Details
-
SourceFile
Constructs new indexer in which the nickname is just the name of the given file (without path).- Parameters:
file- theFileobject wrapped by thisSourceFileindex- the index of thisSourceFilein the ordered list of allSourceFiles managed by theFileIndexerthat is managing thisSourceFile
-
SourceFile
Constructs newSourceFilewith given fields.- Parameters:
file- theFileobject wrapped by thisSourceFileindex- the index of thisSourceFilein the ordered list of allSourceFiles managed by theFileIndexerthat is managing thisSourceFilenickname- a short name that will be used to identify this file, typically the filename (with no path) with a possible suffix such as "invalid input: '<'2>" to make the name unique
-
-
Method Details
-
getFile
Returns theFilewrapped by this object.- Returns:
- the file
-
getIndex
public int getIndex()Returns the index,the index of thisSourceFilein the ordered list of allSourceFiles managed by theFileIndexerthat is managing thisSourceFile- Returns:
- the index
-
getNickname
Returns the "nickname" that has been associated to this file. A short name that will be used to identify this file, typically the filename (with no path) with a possible suffix such as "invalid input: '<'2>" to make the name unique. -
toString
Constructs a human-readable string representation of this object, showing values of all fields. -
getIndexName
Constructs a string of the form "f"+index, which can be used to distinguish this sourcefile from all sourcefiles controlled by an indexer.- Returns:
- "f"+index
-
getName
Returns the filename (without the path prefix). This is the last element in the path sequence specifying the file.- Returns:
- the filename
-
getPath
Returns the complete path for the file, including the filename.- Returns:
- the complete path
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareToin interfaceComparable<SourceFile>
-