Record Class ShortBasedSymbolOccurrence

java.lang.Object
java.lang.Record
com.github._1c_syntax.bsl.languageserver.references.model.ShortBasedSymbolOccurrence
Record Components:
occurrenceType - Тип обращения к символу.
symbol - Символ, к которому происходит обращение.
uri - URI файла, в котором расположено обращение.
startLineShort - Строка начала обращения.
startCharacterShort - Столбец начала обращения.
endLineShort - Строка конца обращения.
endCharacterShort - Столбец конца обращения.
All Implemented Interfaces:
SymbolOccurrence, Comparable<SymbolOccurrence>

public record ShortBasedSymbolOccurrence(OccurrenceType occurrenceType, Symbol symbol, URI uri, short startLineShort, short startCharacterShort, short endLineShort, short endCharacterShort) extends Record implements SymbolOccurrence
Компактная реализация SymbolOccurrence с координатами диапазона в short.

Четыре short вместо четырёх int экономят 8 байт на экземпляр (40 → 32 байта при сжатых указателях), что заметно на миллионах вхождений reference-индекса. Подходит для файлов, где строки и столбцы укладываются в short (<= Short.MAX_VALUE); выбор реализации делает фабрика SymbolOccurrence.of(OccurrenceType, Symbol, URI, Range).

Компоненты хранятся как short, но аксессоры startLine() и прочие расширяют их до int по контракту SymbolOccurrence. Координаты неотрицательные, поэтому расширение беззнаковой семантики не требует.

  • Constructor Details

    • ShortBasedSymbolOccurrence

      public ShortBasedSymbolOccurrence(OccurrenceType occurrenceType, Symbol symbol, URI uri, short startLineShort, short startCharacterShort, short endLineShort, short endCharacterShort)
      Creates an instance of a ShortBasedSymbolOccurrence record class.
      Parameters:
      occurrenceType - the value for the occurrenceType record component
      symbol - the value for the symbol record component
      uri - the value for the uri record component
      startLineShort - the value for the startLineShort record component
      startCharacterShort - the value for the startCharacterShort record component
      endLineShort - the value for the endLineShort record component
      endCharacterShort - the value for the endCharacterShort record component
  • Method Details

    • startLine

      public int startLine()
      Specified by:
      startLine in interface SymbolOccurrence
      Returns:
      Строка начала обращения.
    • startCharacter

      public int startCharacter()
      Specified by:
      startCharacter in interface SymbolOccurrence
      Returns:
      Столбец начала обращения.
    • endLine

      public int endLine()
      Specified by:
      endLine in interface SymbolOccurrence
      Returns:
      Строка конца обращения.
    • endCharacter

      public int endCharacter()
      Specified by:
      endCharacter in interface SymbolOccurrence
      Returns:
      Столбец конца обращения.
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • occurrenceType

      public OccurrenceType occurrenceType()
      Returns the value of the occurrenceType record component.
      Specified by:
      occurrenceType in interface SymbolOccurrence
      Returns:
      the value of the occurrenceType record component
    • symbol

      public Symbol symbol()
      Returns the value of the symbol record component.
      Specified by:
      symbol in interface SymbolOccurrence
      Returns:
      the value of the symbol record component
    • uri

      public URI uri()
      Returns the value of the uri record component.
      Specified by:
      uri in interface SymbolOccurrence
      Returns:
      the value of the uri record component
    • startLineShort

      public short startLineShort()
      Returns the value of the startLineShort record component.
      Returns:
      the value of the startLineShort record component
    • startCharacterShort

      public short startCharacterShort()
      Returns the value of the startCharacterShort record component.
      Returns:
      the value of the startCharacterShort record component
    • endLineShort

      public short endLineShort()
      Returns the value of the endLineShort record component.
      Returns:
      the value of the endLineShort record component
    • endCharacterShort

      public short endCharacterShort()
      Returns the value of the endCharacterShort record component.
      Returns:
      the value of the endCharacterShort record component