Record Class SourceMetadata

java.lang.Object
java.lang.Record
cs1302.tracer.model.SourceMetadata
Record Components:
sources - Source paths mapped to the exact contents supplied to the compiler.
entryFile - The selected entry point's source path.

public record SourceMetadata(Map<String,String> sources, String entryFile) extends Record
Source text and entry point shared by both trace formats.
  • Constructor Details

    • SourceMetadata

      public SourceMetadata(Map<String,String> sources, String entryFile)
      Creates an instance of a SourceMetadata record class.
      Parameters:
      sources - the value for the sources record component
      entryFile - the value for the entryFile record component
  • Method Details

    • from

      public static SourceMetadata from(String code)
      Splits the original input using the compiler's source parser.
      Parameters:
      code - Original single-file source or delimited source stream.
      Returns:
      Source metadata independent of which files appear in the trace.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • sources

      public Map<String,String> sources()
      Returns the value of the sources record component.
      Returns:
      the value of the sources record component
    • entryFile

      public String entryFile()
      Returns the value of the entryFile record component.
      Returns:
      the value of the entryFile record component