Class CCEmptyResult
java.lang.Object
com.ibm.debug.pdt.codecoverage.core.results.CCAbstractItem
com.ibm.debug.pdt.codecoverage.core.results.CCAbstractTreeItem
com.ibm.debug.pdt.codecoverage.core.results.CCEmptyResult
- All Implemented Interfaces:
ICCBase,ICCCompareSource,ICCConstants,ICCCoverageDataBasic,ICCPercentItem,ICCResult,ICCResultInfo,ICCStatementDataBasic,ICCTreeItem
Implementation of an empty result
This implementation will always be compatible with the latest version of this
API
In v10.1 use CCResultsFactory.getInstance.createEmptyResult() to construct
this class
- Since:
- 9.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.ibm.debug.pdt.codecoverage.core.results.ICCCompareSource
ICCCompareSource.MARKERTYPENested classes/interfaces inherited from interface com.ibm.debug.pdt.codecoverage.core.results.ICCConstants
ICCConstants.COVERAGE_LEVEL, ICCConstants.COVERAGE_VIEW -
Field Summary
Fields inherited from class com.ibm.debug.pdt.codecoverage.core.results.CCAbstractTreeItem
TEMP_UUID, UUID_ATTRFields inherited from class com.ibm.debug.pdt.codecoverage.core.results.CCAbstractItem
TEMPPROPFields inherited from interface com.ibm.debug.pdt.codecoverage.core.results.ICCConstants
DATE_FORMAT, LANG_A, LANG_ALP_ASM, LANG_B, LANG_C, LANG_CL_400, LANG_COBOL, LANG_COBOL_COPYBOOK, LANG_CPP, LANG_FORTRAN, LANG_GCJ, LANG_JAVA, LANG_JAVASCRIPT, LANG_OPM_RPG, LANG_PLI, LANG_PLX, LANG_PLX86, LANG_RPG, LANG_SYSTEM, LANG_UNKNOWN, LANG_UPC, LANG_X10, LANGUAGE_DISPLAY_NAMES, RESULT_ERROR, RESULT_OK, RESULT_WARNINGFields inherited from interface com.ibm.debug.pdt.codecoverage.core.results.ICCCoverageDataBasic
EMPTYTESTCASESFields inherited from interface com.ibm.debug.pdt.codecoverage.core.results.ICCResult
EXCLUDE_ZEROLINES -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a filter.voidClears any filters that have been added to the result.getAnnotatedSource(ICCSource compareTo, boolean deltaOnly) Given a result that contains the same source as the current result, compare the code coverage i.e.longReturns the completed time This represents the time that the processing was completedlongIf available this is the date/time that the result was created.longTotal elapsed time for all merged results This is calculated by adding the elapsed time of each testcase.getFile(int id) Returns the ICCFile with the matching ID or null.Given a file name return an already added file.ICCFile[]getFiles()Returns an array of files in the merged results.getImportInfo(boolean successful) Returns an array of import information as discovered by the registered importersgetInfo()Returns more detailed information about this result.Get an item by unique IDgetLevel()Return the coverage level.Return aICCModulethat matches the name.Returns an array ofICCModule.intReturns the number of executable lines in this artifactintReturns the number of executable statementsintReturns the number of files in the merged results.intReturn the number of flowpoints for this artifact and its childrenintReturn the number of flowpoints that were hit for this artifact and its childrenintReturns the number of hit linesintReturns the number of hit statementsReturns aICCPartthat matches the name.ICCPart[]getParts()Returns an array ofICCPart.intRetrieves the percentage from the specified itemintgetPercentCoverage(ICCTestcase testcase) Retrieves the coverage of a testcase.byteReturns a status value that represents an overall status.String[]getTags()Returns an array of tags included in the merged results This returns the value(s) of the tag attribute in the included resultsgetTestcase(int id) Get testcase by ID.getTestcase(String testName) Returns the testcase with the passed name.Returns an array of testcases referenced in the merged results.getTestcases(String fileName) Given a file name return the testcases that hit at least one executable line.getTestcases(String[] fileNames) Given 1 or more file names return a set of testcases (no duplicates) that hit at least 1 executable line.The following API is added for backwards compatibility.Returns the directory to use when unzippingICCFilecontents.booleanReturn true if artifact has statements.booleanReturn a simple boolean indicating if the results are valid.booleanisHit()Returns true if this artifact was hit Each artifact may have different interpretations of what it means to be hit (e.g could be the first line if a flowpoint)booleanisMerged()If this result was created from 2 or more input results then it is considered "merged".removeTestcase(int id) Remove a testcase from this result.voidsetAnnotatedMarker(ICCCompareSource.MARKERTYPE type, String marker) Allow the user to change the annotation shown for a HitLine.voidSet the name of this artifact In version 10.1 this became part of the APIvoidsetUnZipOptions(String unZipDir) When an unzip directory is set the API will use the directory to unzip and return a File whenICCFile.getFile()is called.booleanReturn true if this artifact supports a UUIDMethods inherited from class com.ibm.debug.pdt.codecoverage.core.results.CCAbstractTreeItem
addChild, addChildren, equals, getChild, getChildren, getChildren, getNumChildren, getParent, getQualifiedName, getResult, getUUID, hashCode, isRoot, refresh, setChildName, setParent, setUUIDMethods inherited from class com.ibm.debug.pdt.codecoverage.core.results.CCAbstractItem
addEncodedMessage, addMessage, addMessage, getDecodedMessages, getDecodedMessages, getID, getMessages, getName, getProperties, getProperty, getProperty, isMessage, isProperty, setProperty, updatePropertyMethods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.ibm.debug.pdt.codecoverage.core.results.ICCBase
addEncodedMessage, addMessage, addMessage, getDecodedMessages, getDecodedMessages, getID, getMessages, getName, getProperties, getProperty, getProperty, isMessage, isProperty, setProperty, updatePropertyMethods inherited from interface com.ibm.debug.pdt.codecoverage.core.results.ICCTreeItem
addChild, addChildren, getChild, getChildren, getNumChildren, getParent, getQualifiedName, getUUID, isRoot, refresh, setParent, setUUID
-
Method Details
-
getPercentCoverage
public int getPercentCoverage()Description copied from interface:ICCPercentItemRetrieves the percentage from the specified item- Specified by:
getPercentCoveragein interfaceICCPercentItem- Returns:
- the percent covered
-
getTags
Description copied from interface:ICCResultInfoReturns an array of tags included in the merged results This returns the value(s) of the tag attribute in the included results- Specified by:
getTagsin interfaceICCResultInfo- Returns:
- array of Strings
-
getElapsedTime
public long getElapsedTime()Description copied from interface:ICCResultInfoTotal elapsed time for all merged results This is calculated by adding the elapsed time of each testcase. It relies on the elapsed times being set in each testcase and older cc results may not be correct if some testcases don't have the value set. If the exact time is required then it is recommended that testcase be checked to determine it is has a valid (or non-zero) elapsed time- Specified by:
getElapsedTimein interfaceICCResultInfo- Returns:
- total elapsed time in milliseconds
-
getCompletedTime
public long getCompletedTime()Description copied from interface:ICCResultInfoReturns the completed time This represents the time that the processing was completed- Specified by:
getCompletedTimein interfaceICCResultInfo- Returns:
- completed time in milliseconds
-
getImportInfo
Description copied from interface:ICCResultInfoReturns an array of import information as discovered by the registered importers- Specified by:
getImportInfoin interfaceICCResultInfo- Parameters:
successful- if true then only successful imports returned. If false then failed imports are returned- Returns:
- zero or more import information objects
-
getInfo
Description copied from interface:ICCResultReturns more detailed information about this result.- Specified by:
getInfoin interfaceICCResult- Returns:
- information
ICCResultInfoabout the result or results included
-
getNumFiles
public int getNumFiles()Description copied from interface:ICCResultReturns the number of files in the merged results.- Specified by:
getNumFilesin interfaceICCResult- Returns:
- number of files or zero
-
getFiles
Description copied from interface:ICCResultReturns an array of files in the merged results. New in v9, the list will be sorted by file name. New in v10, the list is affected byICCResult.addFilter(byte, String...)withICCResult.EXCLUDE_ZEROLINESIfICCResult.EXCLUDE_ZEROLINESfilter is active then the returned list will NOT contain files with zero executable lines -
getFile
Description copied from interface:ICCResultGiven a file name return an already added file. -
getFile
Description copied from interface:ICCResultReturns the ICCFile with the matching ID or null. -
getTestcases
Description copied from interface:ICCResultReturns an array of testcases referenced in the merged results. The testcases may or may not have caused lines to be hit.- Specified by:
getTestcasesin interfaceICCCoverageDataBasic- Specified by:
getTestcasesin interfaceICCResult- Returns:
- array of
ICCTestcaseor empty array
-
getTestcases
Description copied from interface:ICCResultGiven a file name return the testcases that hit at least one executable line.- Specified by:
getTestcasesin interfaceICCResult- Parameters:
fileName- retrieve testcases for this file name- Returns:
- array of
ICCTestcaseor empty array
-
getTestcases
Description copied from interface:ICCResultGiven 1 or more file names return a set of testcases (no duplicates) that hit at least 1 executable line. This is a union of all testcases that affect at least 1 of the passed files.- Specified by:
getTestcasesin interfaceICCResult- Parameters:
fileNames- array of fileNames- Returns:
- array of
ICCTestcaseor empty array
-
getTestcase
Description copied from interface:ICCResultGet testcase by ID. Testcases are assigned a unique ID, this method returns a testcase given an ID.- Specified by:
getTestcasein interfaceICCResult- Parameters:
id- testcase id- Returns:
- testcase or null if not found
-
removeTestcase
Description copied from interface:ICCResultRemove a testcase from this result.- Specified by:
removeTestcasein interfaceICCResult- Parameters:
id- - testcase id- Returns:
- removed testcase
-
getStatus
public byte getStatus()Description copied from interface:ICCResultReturns a status value that represents an overall status. When merging results a single result can set this status to something other than OK. SeeICCConstants.- Specified by:
getStatusin interfaceICCResult- Returns:
ICCConstants
-
setName
Description copied from class:CCAbstractItemSet the name of this artifact In version 10.1 this became part of the API -
getLevel
Description copied from interface:ICCResultReturn the coverage level. If this is a merged result then the coverage level of the first result is returned. to get the coverage level of an individual result useICCTestcase.getLevel().- Specified by:
getLevelin interfaceICCResult- Returns:
ICCConstants.COVERAGE_LEVEL
-
getPercentCoverage
Description copied from interface:ICCResultRetrieves the coverage of a testcase.- Specified by:
getPercentCoveragein interfaceICCResult- Parameters:
testcase- the testcase to compute coverage.- Returns:
- the percent coverage for the testcase
-
isMerged
public boolean isMerged()Description copied from interface:ICCResultIf this result was created from 2 or more input results then it is considered "merged". -
isComplete
public boolean isComplete()Description copied from interface:ICCResultReturn a simple boolean indicating if the results are valid. During import if an error occurs that could affect the validity of the merged result then aCCResultExceptionwill be thrown and it will contain this result and any exceptions encountered during the import. Use theICCResultInfoto obtain a list of successful and unsuccessful import inputs.- Specified by:
isCompletein interfaceICCResult- Returns:
- true if all results were imported successfully, false if 1 or more results encountered errors that could affect the validity of the merged result
-
getModules
Description copied from interface:ICCResultReturns an array ofICCModule. New in v9, only modules that have executable lines will be returned. If all modules/parts are needed then use theICCResult.EXCLUDE_ZEROLINESfilter.- Specified by:
getModulesin interfaceICCResult- Returns:
- array of modules or an empty array
-
getModule
Description copied from interface:ICCResultReturn aICCModulethat matches the name. New in v9 the returned value is affected by theICCResult.EXCLUDE_ZEROLINESfilter. -
setUnZipOptions
Description copied from interface:ICCResultWhen an unzip directory is set the API will use the directory to unzip and return a File whenICCFile.getFile()is called.- Specified by:
setUnZipOptionsin interfaceICCResult- Parameters:
unZipDir- path to a working directory that will be used to unzip files
-
getUnZipDir
Description copied from interface:ICCResultReturns the directory to use when unzippingICCFilecontents.- Specified by:
getUnZipDirin interfaceICCResult- Returns:
- directory used to unzip
-
getParts
Description copied from interface:ICCResultReturns an array ofICCPart. This will traverse all modules and return a complete list of unique parts. New in v9 the list will be sorted by the part name. New in v9 the list is affected by theICCResult.EXCLUDE_ZEROLINESfilter. -
getPart
Description copied from interface:ICCResultReturns aICCPartthat matches the name. Returns the first part that matches the name. New in v9 the returned value is affected by theICCResult.EXCLUDE_ZEROLINESfilter. -
getTestcase
Description copied from interface:ICCResultReturns the testcase with the passed name. If there is > 1 testcase with the same name only the first instance will be returned.- Specified by:
getTestcasein interfaceICCResult- Parameters:
testName- name of the testcase- Returns:
- testcase or null if not found
-
isHit
public boolean isHit()Description copied from interface:ICCCoverageDataBasicReturns true if this artifact was hit Each artifact may have different interpretations of what it means to be hit (e.g could be the first line if a flowpoint)- Specified by:
isHitin interfaceICCCoverageDataBasic- Returns:
- true if hit
-
getNumHitLines
public int getNumHitLines()Description copied from interface:ICCCoverageDataBasicReturns the number of hit lines- Specified by:
getNumHitLinesin interfaceICCCoverageDataBasic- Returns:
- number of hit lines
-
getNumExecutableLines
public int getNumExecutableLines()Description copied from interface:ICCCoverageDataBasicReturns the number of executable lines in this artifact- Specified by:
getNumExecutableLinesin interfaceICCCoverageDataBasic- Returns:
- number of executable lines
-
getNumFlowPoints
public int getNumFlowPoints()Description copied from interface:ICCCoverageDataBasicReturn the number of flowpoints for this artifact and its children- Specified by:
getNumFlowPointsin interfaceICCCoverageDataBasic- Returns:
- number of flowpoints
-
getNumHitFlowPoints
public int getNumHitFlowPoints()Description copied from interface:ICCCoverageDataBasicReturn the number of flowpoints that were hit for this artifact and its children- Specified by:
getNumHitFlowPointsin interfaceICCCoverageDataBasic- Returns:
- number of hit flowpoints
-
getNumExecutableStatements
public int getNumExecutableStatements()Description copied from interface:ICCStatementDataBasicReturns the number of executable statements- Specified by:
getNumExecutableStatementsin interfaceICCStatementDataBasic- Returns:
- number of executable statements (hit or not)
-
getNumHitStatements
public int getNumHitStatements()Description copied from interface:ICCStatementDataBasicReturns the number of hit statements- Specified by:
getNumHitStatementsin interfaceICCStatementDataBasic- Returns:
- number of hit statements
-
hasStatements
public boolean hasStatements()Description copied from interface:ICCStatementDataBasicReturn true if artifact has statements. Returning false means that only lines are available- Specified by:
hasStatementsin interfaceICCStatementDataBasic- Returns:
- true if artifact has statements
-
getCreatedTime
public long getCreatedTime()Description copied from interface:ICCResultInfoIf available this is the date/time that the result was created. For results that contain 1 testcase this is the time the original data was collected For merged results this is the time the merged result was created. UseICCTestcase.getStartTime()to get a testcase capture time- Specified by:
getCreatedTimein interfaceICCResultInfo- Returns:
- creation time in milliseconds
-
addFilter
Description copied from interface:ICCResultAdds a filter. The filter type will document if the order it is added can affect the results. To clear filters useICCResult.clearFilters()Current list of filters:ICCResult.EXCLUDE_ZEROLINESThis will include all modules and parts that have zero executable lines. There are no additional parameters. New in v10, this filter also works on files with zero executable lines Filters act on the content of the result. This means that clearing the filters will return the results returned back to the default. Filters do not remove what is stored internally. -
clearFilters
public void clearFilters()Description copied from interface:ICCResultClears any filters that have been added to the result.- Specified by:
clearFiltersin interfaceICCResult
-
getAnnotatedSource
public InputStream getAnnotatedSource(ICCSource compareTo, boolean deltaOnly) throws IOException, CCAbstractException Description copied from interface:ICCCompareSourceGiven a result that contains the same source as the current result, compare the code coverage i.e. the previous result should call this method- Specified by:
getAnnotatedSourcein interfaceICCCompareSource- Parameters:
compareTo- the name of the source the user wants to examine. i.e. the current sourcedeltaOnly- if true will return the inputStream annotated only with the code coverage delta between the two sources. Will return all code coverage annotation otherwise.- Returns:
- input stream with markers indicating coverage of desired and current result, or null if source doesn't match.
- Throws:
IOException- thrown when given file is invalid and cannot be read or the stream (used in the implementation, not the return stream) cannot be written properly.CCAbstractException- thrown when deltaOnly is true and a file has been removed between the two results or both results have identical code coverage.
-
setAnnotatedMarker
Description copied from interface:ICCCompareSourceAllow the user to change the annotation shown for a HitLine. Guarantees that spacing will remain consistent regardless of what marking is used. NOTE: Recommend adding a space after the desired marker to easier distinguish between marking columns and the source code.- Specified by:
setAnnotatedMarkerin interfaceICCCompareSource- Parameters:
type- theICCCompareSource.MARKERTYPEof marker to be configured e.g. HITLINEMARKERmarker- the character or string used to visualize the HitLine.
-
getUniqueID
Description copied from interface:ICCTreeItemThe following API is added for backwards compatibility. When a UUID is not available in the result this call will be used to generate a temporary UUID (does not have to have a true UUID format) The returned value should- be the same for the same result.
- be unique from any other artifact in the result
- can be any string that uniquely represents this artifact
- Specified by:
getUniqueIDin interfaceICCTreeItem- Returns:
- globally unique string
-
supportsUUID
public boolean supportsUUID()Description copied from interface:ICCTreeItemReturn true if this artifact supports a UUID- Specified by:
supportsUUIDin interfaceICCTreeItem- Returns:
- true if UUID is supported
-
getItem
Description copied from interface:ICCResultGet an item by unique ID
-