Package org.sonar.duplications.block

Examples of org.sonar.duplications.block.FileBlocks


      bridge = new TokenizerBridge(mapping.getTokenizer(), fs.encoding().name(), getBlockSize(languageKey));
    }
    for (InputFile inputFile : sourceFiles) {
      LOG.debug("Populating index from {}", inputFile);
      String resourceEffectiveKey = ((DeprecatedDefaultInputFile) inputFile).key();
      FileBlocks fileBlocks = duplicationCache.byComponent(resourceEffectiveKey);
      if (fileBlocks != null) {
        index.insert(inputFile, fileBlocks.blocks());
      } else if (bridge != null) {
        List<Block> blocks2 = bridge.chunk(resourceEffectiveKey, inputFile.file());
        index.insert(inputFile, blocks2);
      }
    }
View Full Code Here


class FileBlocksValueCoder implements ValueCoder {

  @Override
  public void put(Value value, Object object, CoderContext context) {
    FileBlocks blocks = (FileBlocks) object;
    value.putUTF(blocks.resourceId());
    value.put(blocks.blocks().size());
    for (Block b : blocks.blocks()) {
      value.putByteArray(b.getBlockHash().getBytes());
      value.put(b.getIndexInFile());
      value.put(b.getStartLine());
      value.put(b.getEndLine());
      value.put(b.getStartUnit());
View Full Code Here

      int startUnit = value.getInt();
      int endUnit = value.getInt();
      b.setUnit(startUnit, endUnit);
      blocks.add(b.build());
    }
    return new FileBlocks(resourceId, blocks);
  }
View Full Code Here

    tokens.add(TokenEntry.getEOF());
    TokenEntry.clearImages();
    List<TokensLine> tokensLines = TokenizerBridge.convert(tokens);
    List<Block> blocks = blockChunker.chunk(((DefaultInputFile) inputFile).key(), tokensLines);

    cache.put(((DefaultInputFile) inputFile).key(), new FileBlocks(((DefaultInputFile) inputFile).key(), blocks));
    tokens.clear();
  }
View Full Code Here

TOP

Related Classes of org.sonar.duplications.block.FileBlocks

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.