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 voidaccept(INamedElementAccess.INamedElementAccessVisitor visitor)Internaljava.util.Set<java.lang.String>getAuthors(IScmPeriod period)floatgetAverageComplexityMetric()floatgetAverageNestingMetric()intgetChangeCount30()intgetChangeCount365()intgetChangeCount90()intgetChurn30()intgetChurn365()intgetChurn90()floatgetChurnRate30()floatgetChurnRate365()floatgetChurnRate90()intgetCodeCommentLinesMetric()intgetCommentLinesMetric()de.schlichtherle.truezip.file.TFilegetFile()intgetLinesOfCodeMetric()intgetMaxNestingMetric()java.lang.ObjectgetMetricLevel()Internal use onlyintgetNumberOfAuthors()java.lang.StringgetPath()java.util.List<ISourceLineAccess>getSourceLines()java.util.List<java.lang.String>getSourceLines(boolean withLineBreaks)Return raw content of source file.intgetTotalLinesMetric()booleanisModified()-
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:
getLinesOfCodeMetricin 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:
getTotalLinesMetricin 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:
getCommentLinesMetricin 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:
getCodeCommentLinesMetricin 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:
getMaxNestingMetricin interfaceISourceFileAccess
-
getAverageComplexityMetric
public float getAverageComplexityMetric()
- Specified by:
getAverageComplexityMetricin interfaceISourceFileAccess
-
getAverageNestingMetric
public float getAverageNestingMetric()
- Specified by:
getAverageNestingMetricin interfaceISourceFileAccess
-
getChangeCount30
public int getChangeCount30()
- Specified by:
getChangeCount30in interfaceISourceFileAccess
-
getChangeCount90
public int getChangeCount90()
- Specified by:
getChangeCount90in interfaceISourceFileAccess
-
getChangeCount365
public int getChangeCount365()
- Specified by:
getChangeCount365in interfaceISourceFileAccess
-
getChurn30
public int getChurn30()
- Specified by:
getChurn30in interfaceISourceFileAccess
-
getChurn90
public int getChurn90()
- Specified by:
getChurn90in interfaceISourceFileAccess
-
getChurn365
public int getChurn365()
- Specified by:
getChurn365in interfaceISourceFileAccess
-
getChurnRate30
public float getChurnRate30()
- Specified by:
getChurnRate30in interfaceISourceFileAccess
-
getChurnRate90
public float getChurnRate90()
- Specified by:
getChurnRate90in interfaceISourceFileAccess
-
getChurnRate365
public float getChurnRate365()
- Specified by:
getChurnRate365in interfaceISourceFileAccess
-
getNumberOfAuthors
public int getNumberOfAuthors()
- Specified by:
getNumberOfAuthorsin interfaceISourceFileAccess
-
getPath
public final java.lang.String getPath()
- Specified by:
getPathin 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:
getFilein 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:ElementAccessInternal use only- Overrides:
getMetricLevelin classElementAccess<com.hello2morrow.sonargraph.core.model.path.SourceFile>
-
getSourceLines
public final java.util.List<java.lang.String> getSourceLines(boolean withLineBreaks)
Description copied from interface:ISourceFileAccessReturn raw content of source file.- Specified by:
getSourceLinesin 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:
getSourceLinesin interfaceISourceFileAccess- Returns:
- the content of a source file, line by line.
TheISourceLineAccessallow 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:
isModifiedin interfaceISourceFileAccess
-
accept
public void accept(INamedElementAccess.INamedElementAccessVisitor visitor)
Internal- Specified by:
acceptin interfaceINamedElementAccess- Overrides:
acceptin 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:
getAuthorsin interfaceISourceFileAccess
-
-