Class DefaultCpdTokens
- java.lang.Object
-
- org.sonar.api.batch.sensor.internal.DefaultStorable
-
- org.sonar.api.batch.sensor.cpd.internal.DefaultCpdTokens
-
- All Implemented Interfaces:
NewCpdTokens
public class DefaultCpdTokens extends DefaultStorable implements NewCpdTokens
-
-
Field Summary
-
Fields inherited from class org.sonar.api.batch.sensor.internal.DefaultStorable
storage
-
-
Constructor Summary
Constructors Constructor Description DefaultCpdTokens(SensorStorage storage)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NewCpdTokens
addToken(int startLine, int startLineOffset, int endLine, int endLineOffset, java.lang.String image)
Shortcut to avoid callingInputFile.newRange(int, int, int, int)
DefaultCpdTokens
addToken(TextRange range, java.lang.String image)
Call this method to register a token in a range.protected void
doSave()
java.util.List<TokensLine>
getTokenLines()
InputFile
inputFile()
DefaultCpdTokens
onFile(InputFile inputFile)
The tokenized file.-
Methods inherited from class org.sonar.api.batch.sensor.internal.DefaultStorable
save, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.sonar.api.batch.sensor.cpd.NewCpdTokens
save
-
-
-
-
Constructor Detail
-
DefaultCpdTokens
public DefaultCpdTokens(SensorStorage storage)
-
-
Method Detail
-
onFile
public DefaultCpdTokens onFile(InputFile inputFile)
Description copied from interface:NewCpdTokens
The tokenized file.- Specified by:
onFile
in interfaceNewCpdTokens
-
inputFile
public InputFile inputFile()
-
addToken
public NewCpdTokens addToken(int startLine, int startLineOffset, int endLine, int endLineOffset, java.lang.String image)
Description copied from interface:NewCpdTokens
Shortcut to avoid callingInputFile.newRange(int, int, int, int)
- Specified by:
addToken
in interfaceNewCpdTokens
-
addToken
public DefaultCpdTokens addToken(TextRange range, java.lang.String image)
Description copied from interface:NewCpdTokens
Call this method to register a token in a range. Tokens should be registered in order.- Specified by:
addToken
in interfaceNewCpdTokens
- Parameters:
range
- Token position. UseInputFile.newRange(int, int, int, int)
to get a valid range.image
- Text content of the token. Can be replaced by a constant placeholder for some tokens (like litterals).
-
getTokenLines
public java.util.List<TokensLine> getTokenLines()
-
doSave
protected void doSave()
- Specified by:
doSave
in classDefaultStorable
-
-