Class SourceFileAccess
- java.lang.Object
-
- com.hello2morrow.sonargraph.core.api.model.ElementAccess<com.hello2morrow.sonargraph.core.model.path.SourceFile>
-
- com.hello2morrow.sonargraph.core.api.model.SourceFileAccess
-
- All Implemented Interfaces:
IElementAccess
,INamedElementAccess
,ISourceFileAccess
- Direct Known Subclasses:
CppSourceFileAccess
,CSharpSourceFileAccess
,JavaSourceFileAccess
,PythonSourceFileAccess
public class SourceFileAccess extends ElementAccess<com.hello2morrow.sonargraph.core.model.path.SourceFile> implements ISourceFileAccess
An access object for source files.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.hello2morrow.sonargraph.core.api.model.ElementAccess
ElementAccess.IAccessFactory
-
Nested classes/interfaces inherited from interface com.hello2morrow.sonargraph.api.model.INamedElementAccess
INamedElementAccess.INamedElementAccessVisitor
-
Nested classes/interfaces inherited from interface com.hello2morrow.sonargraph.api.model.ISourceFileAccess
ISourceFileAccess.IVisitor
-
-
Constructor Summary
Constructors Constructor Description SourceFileAccess(com.hello2morrow.sonargraph.core.model.path.SourceFile element)
Internal use only
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(INamedElementAccess.INamedElementAccessVisitor visitor)
Internaljava.util.Set<java.lang.String>
getAuthors(IScmPeriod period)
float
getAverageComplexityMetric()
float
getAverageNestingMetric()
int
getChangeCount30()
int
getChangeCount365()
int
getChangeCount90()
int
getChurn30()
int
getChurn365()
int
getChurn90()
float
getChurnRate30()
float
getChurnRate365()
float
getChurnRate90()
int
getCodeCommentLinesMetric()
int
getCommentLinesMetric()
de.schlichtherle.truezip.file.TFile
getFile()
int
getLinesOfCodeMetric()
int
getMaxNestingMetric()
java.lang.Object
getMetricLevel()
Internal use onlyint
getNumberOfAuthors()
java.lang.String
getPath()
java.util.List<ISourceLineAccess>
getSourceLines()
java.util.List<java.lang.String>
getSourceLines(boolean withLineBreaks)
Return raw content of source file.int
getTotalLinesMetric()
boolean
isModified()
-
Methods inherited from class com.hello2morrow.sonargraph.core.api.model.ElementAccess
equals, getChildren, getElement, getFullyQualifiedName, getIncomingDependenciesRecursively, getIncomingDependenciesRecursively, getIssueCount, getName, getNameWithSignature, getOutgoingDependenciesRecursively, getOutgoingDependenciesRecursively, getOutgoingDependenciesRecursively, getParent, getParent, getReferencedElementsRecursively, getReferencedElementsRecursively, getReferencedElementsRecursively, getReferencingElementsRecursively, getReferencingElementsRecursively, getShortName, getShortNameWithSignature, hashCode, ignoreIssues, isExcluded, isExternal, setFactory, toString
-
Methods inherited from interface com.hello2morrow.sonargraph.api.model.IElementAccess
getName, getNameWithSignature, getShortName, getShortNameWithSignature, ignoreIssues, isExcluded, isExternal
-
Methods inherited from interface com.hello2morrow.sonargraph.api.model.INamedElementAccess
getChildren, getFullyQualifiedName, getIncomingDependenciesRecursively, getIncomingDependenciesRecursively, getIssueCount, getIssueCount, getOutgoingDependenciesRecursively, getOutgoingDependenciesRecursively, getOutgoingDependenciesRecursively, getParent, getParent, getReferencedElementsRecursively, getReferencedElementsRecursively, getReferencedElementsRecursively, getReferencingElementsRecursively, getReferencingElementsRecursively
-
-
-
-
Method Detail
-
getLinesOfCodeMetric
public final int getLinesOfCodeMetric()
- Specified by:
getLinesOfCodeMetric
in interfaceISourceFileAccess
- Returns:
- the lines of code metric for this source files (number of non-empty and non-comment lines).
-
getTotalLinesMetric
public final int getTotalLinesMetric()
- Specified by:
getTotalLinesMetric
in interfaceISourceFileAccess
- Returns:
- the number of total lines for this source files (number of non-empty and non-comment lines).
-
getCommentLinesMetric
public final int getCommentLinesMetric()
- Specified by:
getCommentLinesMetric
in interfaceISourceFileAccess
- Returns:
- the number of comment lines for this source files (number of non-empty and non-comment lines).
-
getCodeCommentLinesMetric
public final int getCodeCommentLinesMetric()
- Specified by:
getCodeCommentLinesMetric
in interfaceISourceFileAccess
- Returns:
- the number of comment lines excluding header comments for this source files (number of non-empty and non-comment lines).
-
getMaxNestingMetric
public int getMaxNestingMetric()
- Specified by:
getMaxNestingMetric
in interfaceISourceFileAccess
-
getAverageComplexityMetric
public float getAverageComplexityMetric()
- Specified by:
getAverageComplexityMetric
in interfaceISourceFileAccess
-
getAverageNestingMetric
public float getAverageNestingMetric()
- Specified by:
getAverageNestingMetric
in interfaceISourceFileAccess
-
getChangeCount30
public int getChangeCount30()
- Specified by:
getChangeCount30
in interfaceISourceFileAccess
-
getChangeCount90
public int getChangeCount90()
- Specified by:
getChangeCount90
in interfaceISourceFileAccess
-
getChangeCount365
public int getChangeCount365()
- Specified by:
getChangeCount365
in interfaceISourceFileAccess
-
getChurn30
public int getChurn30()
- Specified by:
getChurn30
in interfaceISourceFileAccess
-
getChurn90
public int getChurn90()
- Specified by:
getChurn90
in interfaceISourceFileAccess
-
getChurn365
public int getChurn365()
- Specified by:
getChurn365
in interfaceISourceFileAccess
-
getChurnRate30
public float getChurnRate30()
- Specified by:
getChurnRate30
in interfaceISourceFileAccess
-
getChurnRate90
public float getChurnRate90()
- Specified by:
getChurnRate90
in interfaceISourceFileAccess
-
getChurnRate365
public float getChurnRate365()
- Specified by:
getChurnRate365
in interfaceISourceFileAccess
-
getNumberOfAuthors
public int getNumberOfAuthors()
- Specified by:
getNumberOfAuthors
in interfaceISourceFileAccess
-
getPath
public final java.lang.String getPath()
- Specified by:
getPath
in interfaceISourceFileAccess
- Returns:
- the path of this source file or 'null' if there is no physical source file.
-
getFile
public final de.schlichtherle.truezip.file.TFile getFile()
- Specified by:
getFile
in interfaceISourceFileAccess
- Returns:
- the file object for this source file or 'null' if there is no physical source file.
-
getMetricLevel
public final java.lang.Object getMetricLevel()
Description copied from class:ElementAccess
Internal use only- Overrides:
getMetricLevel
in classElementAccess<com.hello2morrow.sonargraph.core.model.path.SourceFile>
-
getSourceLines
public final java.util.List<java.lang.String> getSourceLines(boolean withLineBreaks)
Description copied from interface:ISourceFileAccess
Return raw content of source file.- Specified by:
getSourceLines
in interfaceISourceFileAccess
- Parameters:
withLineBreaks
- If true lines will be terminated by line breaks, otherwise line breaks are stripped.- Returns:
- List of lines in this source file.
-
getSourceLines
public final java.util.List<ISourceLineAccess> getSourceLines()
- Specified by:
getSourceLines
in interfaceISourceFileAccess
- Returns:
- the content of a source file, line by line.
TheISourceLineAccess
allow the creation of context-aware issues, so that resolutions can be applied even if line is changed in the future.
-
isModified
public boolean isModified()
- Specified by:
isModified
in interfaceISourceFileAccess
-
accept
public void accept(INamedElementAccess.INamedElementAccessVisitor visitor)
Internal- Specified by:
accept
in interfaceINamedElementAccess
- Overrides:
accept
in classElementAccess<com.hello2morrow.sonargraph.core.model.path.SourceFile>
- Parameters:
visitor
- The visitor implementation
-
getAuthors
public java.util.Set<java.lang.String> getAuthors(IScmPeriod period)
- Specified by:
getAuthors
in interfaceISourceFileAccess
-
-