Package hudson.plugins.analysis.util

Examples of hudson.plugins.analysis.util.ContextHashCode


                    inputStream = new FileInputStream(file);
                    Collection<DuplicateCode> result = parser.parse(inputStream, moduleName);
                    createLinkNames(result);
                    Set<FileAnnotation> warnings = Sets.newHashSet();
                    warnings.addAll(result);
                    ContextHashCode hashCode = new ContextHashCode();
                    for (FileAnnotation duplication : warnings) {
                        String fullPath = getFullPath(duplication);
                        long value = hashCode.create(fullPath,
                                duplication.getPrimaryLineNumber(), defaultEncoding);
                        duplication.setContextHashCode(value * 31 + (((DuplicateCode)duplication).getNumberOfLines()));
                    }

                    return warnings;
View Full Code Here


        this.defaultEncoding = defaultEncoding;
    }

    @Override
    public ParserResult invoke(final File workspace, final VirtualChannel channel) throws IOException {
        ContextHashCode contextHashCode = new ContextHashCode();
        for (FileAnnotation annotation : result.getAnnotations()) {
            try {
                annotation.setContextHashCode(contextHashCode.create(
                        annotation.getFileName(), annotation.getPrimaryLineNumber(), defaultEncoding));
            }
            catch (IOException exception) {
                // ignore and continue
            }
View Full Code Here

     *            the line of the warning
     * @return a has code of the source code
     * @throws IOException if the contents of the file could not be read
     */
    protected int createContextHashCode(final String fileName, final int line) throws IOException {
        return new ContextHashCode().create(fileName, line, defaultEncoding);
    }
View Full Code Here

TOP

Related Classes of hudson.plugins.analysis.util.ContextHashCode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.