Module dev.civl.abc

Class SourceFile

java.lang.Object
dev.civl.abc.token.IF.SourceFile
All Implemented Interfaces:
Comparable<SourceFile>

public class SourceFile extends Object implements 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 Details

    • SourceFile

      public SourceFile(File file, int index)
      Constructs new indexer in which the nickname is just the name of the given file (without path).
      Parameters:
      file - the File object wrapped by this SourceFile
      index - the index of this SourceFile in the ordered list of all SourceFiles managed by the FileIndexer that is managing this SourceFile
    • SourceFile

      public SourceFile(File file, int index, String nickname)
      Constructs new SourceFile with given fields.
      Parameters:
      file - the File object wrapped by this SourceFile
      index - the index of this SourceFile in the ordered list of all SourceFiles managed by the FileIndexer that is managing this SourceFile
      nickname - 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

      public File getFile()
      Returns the File wrapped by this object.
      Returns:
      the file
    • getIndex

      public int getIndex()
      Returns the index,the index of this SourceFile in the ordered list of all SourceFiles managed by the FileIndexer that is managing this SourceFile
      Returns:
      the index
    • getNickname

      public String 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

      public String toString()
      Constructs a human-readable string representation of this object, showing values of all fields.
      Overrides:
      toString in class Object
      Returns:
      a human-readable string representation of this object, showing values of all fields.
    • getIndexName

      public String 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

      public String getName()
      Returns the filename (without the path prefix). This is the last element in the path sequence specifying the file.
      Returns:
      the filename
    • getPath

      public String getPath()
      Returns the complete path for the file, including the filename.
      Returns:
      the complete path
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(SourceFile o)
      Specified by:
      compareTo in interface Comparable<SourceFile>