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 NewCpdTokensaddToken(int startLine, int startLineOffset, int endLine, int endLineOffset, java.lang.String image)Shortcut to avoid callingInputFile.newRange(int, int, int, int)DefaultCpdTokensaddToken(TextRange range, java.lang.String image)Call this method to register a token in a range.protected voiddoSave()java.util.List<TokensLine>getTokenLines()InputFileinputFile()DefaultCpdTokensonFile(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:NewCpdTokensThe tokenized file.- Specified by:
onFilein 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:NewCpdTokensShortcut to avoid callingInputFile.newRange(int, int, int, int)- Specified by:
addTokenin interfaceNewCpdTokens
-
addToken
public DefaultCpdTokens addToken(TextRange range, java.lang.String image)
Description copied from interface:NewCpdTokensCall this method to register a token in a range. Tokens should be registered in order.- Specified by:
addTokenin 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:
doSavein classDefaultStorable
-
-