Class CompoundSourcePositionImpl
java.lang.Object
spoon.support.reflect.cu.position.SourcePositionImpl
spoon.support.reflect.cu.position.CompoundSourcePositionImpl
- All Implemented Interfaces:
Serializable,CompoundSourcePosition,SourcePosition
- Direct Known Subclasses:
DeclarationSourcePositionImpl
public class CompoundSourcePositionImpl
extends SourcePositionImpl
implements CompoundSourcePosition
This class represents the position of a named Java program element in a source
file.
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from interface spoon.reflect.cu.SourcePosition
NOPOSITION -
Constructor Summary
ConstructorsConstructorDescriptionCompoundSourcePositionImpl(CompilationUnit compilationUnit, int nameStart, int nameEnd, int declarationSourceStart, int declarationSourceEnd, int[] lineSeparatorPositions) -
Method Summary
Modifier and TypeMethodDescriptionintreturns the end of everything incl.intreturns the start of everything incl.intGets the end column in the source file (1 indexed).intGets the end line in the source file (1 indexed).intreturns the end of name (int bar = 0 ➡ pos('r'))intreturns the start of name (int foo = 0 ➡ pos('f'))Helper for debugging purposes.intGets the index at which the position ends in the source file.intGets the index at which the position starts in the source file.Methods inherited from class spoon.support.reflect.cu.position.SourcePositionImpl
checkArgsAreAscending, equals, getColumn, getCompilationUnit, getFile, getFragment, getLine, hashCode, isValidPosition, searchColumnNumber, searchLineNumber, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface spoon.reflect.cu.SourcePosition
getColumn, getCompilationUnit, getFile, getLine, isValidPosition, toString
-
Constructor Details
-
CompoundSourcePositionImpl
public CompoundSourcePositionImpl(CompilationUnit compilationUnit, int nameStart, int nameEnd, int declarationSourceStart, int declarationSourceEnd, int[] lineSeparatorPositions)
-
-
Method Details
-
getDeclarationEnd
public int getDeclarationEnd()Description copied from interface:CompoundSourcePositionreturns the end of everything incl. type, name and default value- Specified by:
getDeclarationEndin interfaceCompoundSourcePosition
-
getDeclarationStart
public int getDeclarationStart()Description copied from interface:CompoundSourcePositionreturns the start of everything incl. type, name and default value- Specified by:
getDeclarationStartin interfaceCompoundSourcePosition
-
getSourceEnd
public int getSourceEnd()Description copied from interface:SourcePositionGets the index at which the position ends in the source file. Heavily used for the sniper mode.- Specified by:
getSourceEndin interfaceSourcePosition- Overrides:
getSourceEndin classSourcePositionImpl
-
getSourceStart
public int getSourceStart()Description copied from interface:SourcePositionGets the index at which the position starts in the source file.- Specified by:
getSourceStartin interfaceSourcePosition- Overrides:
getSourceStartin classSourcePositionImpl
-
getNameStart
public int getNameStart()Description copied from interface:CompoundSourcePositionreturns the start of name (int foo = 0 ➡ pos('f'))- Specified by:
getNameStartin interfaceCompoundSourcePosition
-
getNameEnd
public int getNameEnd()Description copied from interface:CompoundSourcePositionreturns the end of name (int bar = 0 ➡ pos('r'))- Specified by:
getNameEndin interfaceCompoundSourcePosition
-
getEndLine
public int getEndLine()Description copied from interface:SourcePositionGets the end line in the source file (1 indexed). Prefer usingSourcePosition.getSourceEnd()}.- Specified by:
getEndLinein interfaceSourcePosition- Overrides:
getEndLinein classSourcePositionImpl
-
getEndColumn
public int getEndColumn()Description copied from interface:SourcePositionGets the end column in the source file (1 indexed). This method is slow because it has to calculate the column number depending onEnvironment.getTabulationSize()andCtCompilationUnit.getOriginalSourceCode(). PreferSourcePosition.getSourceEnd().- Specified by:
getEndColumnin interfaceSourcePosition- Overrides:
getEndColumnin classSourcePositionImpl
-
getSourceDetails
Description copied from class:SourcePositionImplHelper for debugging purposes. Displays |startIndex; endIndex|sourceCode| of thisSourcePositionIf this instance isDeclarationSourcePositionorBodyHolderSourcePositionThen details about name, modifiers and body are included in resulting string too- Overrides:
getSourceDetailsin classSourcePositionImpl- Returns:
- details about source code of this
SourcePosition
-