jetbrains.buildServer.duplicator
Class DuplicateInfo

java.lang.Object
  extended by jetbrains.buildServer.duplicator.DuplicateInfo

public class DuplicateInfo
extends java.lang.Object

Concrete duplicate. Encapsulates duplicate metrics such as duplicate hash, duplicate cost (duplicate code complexity which is defined by the amount of statements, expressions, declarations and method calls) and duplicating code fragments

Since:
6.0

Nested Class Summary
static class DuplicateInfo.CharOffset
          Offsets calculated as absolute char offset within a file.
static class DuplicateInfo.DuplicateMetrics
          Duplicates metrics which encapsulate hash, cost and density
static class DuplicateInfo.Fragment
          Duplicating code fragment.
static class DuplicateInfo.FragmentOffset
           
static class DuplicateInfo.LineOffset
          Offsets calculated as line offset within a file.
static class DuplicateInfo.MetricsWithFiles
          Metrics with files storage.
static class DuplicateInfo.NormalizedLineEndOffset
          Fragment offset calculated for a file with normalized line ends (all line endings are \n).
 
Constructor Summary
DuplicateInfo(int hash, int cost, DuplicateInfo.Fragment[] fragments)
          Creates a duplicate with specified hash, cost and fragments.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 int getCost()
          Gets the current duplicates cost
 int getDensity()
          Gets the current duplicates density
 DuplicateInfo.Fragment[] getFragments()
          Gets the current duplicates code fragments
 int getHash()
          Gets the current duplicates hash
 DuplicateInfo.DuplicateMetrics getMetrics()
          Gets the current duplicates metrics which are hash, cost and density
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DuplicateInfo

public DuplicateInfo(int hash,
                     int cost,
                     DuplicateInfo.Fragment[] fragments)
Creates a duplicate with specified hash, cost and fragments. Hash is used for quick statistics calculation. Cost defines the complexity of the source code which is actually the amount of statements, expressions, declarations and method calls. Summarized costs of all these elements of the source code fragment yield the total complexity.

Parameters:
hash - duplicate hash
cost -
fragments -
Method Detail

getMetrics

public DuplicateInfo.DuplicateMetrics getMetrics()
Gets the current duplicates metrics which are hash, cost and density

Returns:
duplicate metrics

getFragments

public DuplicateInfo.Fragment[] getFragments()
Gets the current duplicates code fragments

Returns:
code fragments

getHash

public int getHash()
Gets the current duplicates hash

Returns:
hash

getCost

public int getCost()
Gets the current duplicates cost

Returns:
cost

getDensity

public int getDensity()
Gets the current duplicates density

Returns:
density

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object