org.sonar.duplications.block
Class Block

java.lang.Object
  extended by org.sonar.duplications.block.Block
All Implemented Interfaces:
CodeFragment

public final class Block
extends Object
implements CodeFragment

Represents part of source code between two lines. If two blocks have the same hash, then we assume that there is a duplication in a code, which they represent.


Nested Class Summary
static class Block.Builder
          Instances can be reused - it is safe to call Block.Builder.build() multiple times to build multiple blocks in series.
 
Method Summary
static Block.Builder builder()
           
 boolean equals(Object obj)
           
 ByteArray getBlockHash()
           
 int getEndLine()
          Number of line where fragment ends.
 int getEndUnit()
           
 String getHashHex()
           
 int getIndexInFile()
           
 String getResourceId()
           
 int getStartLine()
          Number of line where fragment starts.
 int getStartUnit()
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

builder

public static Block.Builder builder()
Since:
2.14

getHashHex

public String getHashHex()

getResourceId

public String getResourceId()

getBlockHash

public ByteArray getBlockHash()

getIndexInFile

public int getIndexInFile()

getStartLine

public int getStartLine()
Description copied from interface: CodeFragment
Number of line where fragment starts. Numbering starts from 1.

Specified by:
getStartLine in interface CodeFragment

getEndLine

public int getEndLine()
Description copied from interface: CodeFragment
Number of line where fragment ends. Numbering starts from 1.

Specified by:
getEndLine in interface CodeFragment

getStartUnit

@Beta
public int getStartUnit()
Since:
2.14

getEndUnit

@Beta
public int getEndUnit()
Since:
2.14

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009-2012 SonarSource. All Rights Reserved.