Record Class ShortBasedSymbolOccurrence
- Record Components:
symbol- Символ, к которому происходит обращение.uri- URI файла, в котором расположено обращение.typedStartLine- Строка начала обращения, у определения — её побитовое дополнение.startCharacterShort- Столбец начала обращения.endLineShort- Строка конца обращения.endCharacterShort- Столбец конца обращения.
- All Implemented Interfaces:
SymbolOccurrence, Comparable<SymbolOccurrence>
SymbolOccurrence с координатами диапазона в short.
Четыре short вместо четырёх int экономят 8 байт на экземпляр (40 → 32 байта
при сжатых указателях), что заметно на миллионах вхождений reference-индекса. Подходит для
файлов, где строки и столбцы укладываются в short (<= Short.MAX_VALUE);
выбор реализации делает фабрика SymbolOccurrence.of(OccurrenceType, Symbol, URI, Range).
Тип обращения отдельным полем не хранится, а закодирован знаком строки начала: у определения
в typedStartLine лежит побитовое дополнение строки, у ссылки — сама строка. Координаты
неотрицательные, поэтому знак свободен. С компактными заголовками объектов это убирает
последнюю ссылку сверх 16 байт полей, и вхождение занимает 24 байта вместо 32; с обычными
заголовками размер прежний.
Компоненты хранятся как short, но аксессоры startLine() и прочие расширяют их
до int по контракту SymbolOccurrence.
-
Field Summary
Fields inherited from interface SymbolOccurrence
COMPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionShortBasedSymbolOccurrence(OccurrenceType occurrenceType, Symbol symbol, URI uri, short startLine, short startCharacter, short endLine, short endCharacter) Создать обращение по типу и координатам, укладывающимся вshort.ShortBasedSymbolOccurrence(Symbol symbol, URI uri, short typedStartLine, short startCharacterShort, short endLineShort, short endCharacterShort) Creates an instance of aShortBasedSymbolOccurrencerecord class. -
Method Summary
Modifier and TypeMethodDescriptionintshortReturns the value of theendCharacterShortrecord component.intendLine()shortReturns the value of theendLineShortrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intshortReturns the value of thestartCharacterShortrecord component.intsymbol()Returns the value of thesymbolrecord component.final StringtoString()Returns a string representation of this record class.shortReturns the value of thetypedStartLinerecord component.uri()Returns the value of theurirecord component.Methods inherited from interface SymbolOccurrence
compareTo, range, startPosition
-
Constructor Details
-
ShortBasedSymbolOccurrence
public ShortBasedSymbolOccurrence(OccurrenceType occurrenceType, Symbol symbol, URI uri, short startLine, short startCharacter, short endLine, short endCharacter) Создать обращение по типу и координатам, укладывающимся вshort.- Parameters:
occurrenceType- Тип обращения к символу.symbol- Символ, к которому происходит обращение.uri- URI файла.startLine- Строка начала обращения.startCharacter- Столбец начала обращения.endLine- Строка конца обращения.endCharacter- Столбец конца обращения.
-
ShortBasedSymbolOccurrence
public ShortBasedSymbolOccurrence(Symbol symbol, URI uri, short typedStartLine, short startCharacterShort, short endLineShort, short endCharacterShort) Creates an instance of aShortBasedSymbolOccurrencerecord class.- Parameters:
symbol- the value for thesymbolrecord componenturi- the value for theurirecord componenttypedStartLine- the value for thetypedStartLinerecord componentstartCharacterShort- the value for thestartCharacterShortrecord componentendLineShort- the value for theendLineShortrecord componentendCharacterShort- the value for theendCharacterShortrecord component
-
-
Method Details
-
occurrenceType
- Specified by:
occurrenceTypein interfaceSymbolOccurrence- Returns:
- Тип обращения к символу.
-
startLine
public int startLine()- Specified by:
startLinein interfaceSymbolOccurrence- Returns:
- Строка начала обращения.
-
startCharacter
public int startCharacter()- Specified by:
startCharacterin interfaceSymbolOccurrence- Returns:
- Столбец начала обращения.
-
endLine
public int endLine()- Specified by:
endLinein interfaceSymbolOccurrence- Returns:
- Строка конца обращения.
-
endCharacter
public int endCharacter()- Specified by:
endCharacterin interfaceSymbolOccurrence- Returns:
- Столбец конца обращения.
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
symbol
Returns the value of thesymbolrecord component.- Specified by:
symbolin interfaceSymbolOccurrence- Returns:
- the value of the
symbolrecord component
-
uri
Returns the value of theurirecord component.- Specified by:
uriin interfaceSymbolOccurrence- Returns:
- the value of the
urirecord component
-
typedStartLine
public short typedStartLine()Returns the value of thetypedStartLinerecord component.- Returns:
- the value of the
typedStartLinerecord component
-
startCharacterShort
public short startCharacterShort()Returns the value of thestartCharacterShortrecord component.- Returns:
- the value of the
startCharacterShortrecord component
-
endLineShort
public short endLineShort()Returns the value of theendLineShortrecord component.- Returns:
- the value of the
endLineShortrecord component
-
endCharacterShort
public short endCharacterShort()Returns the value of theendCharacterShortrecord component.- Returns:
- the value of the
endCharacterShortrecord component
-