Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package hudson.plugins.violations.model;
 
 import java.util.Set;
A class contains the violations for a particular file. The number of violations are limited.
public class FileModel extends AbstractFileModel {
        = new TreeMap<StringLimitType>();

    
Get a map of type to limit type.

Returns:
the map.
    public SortedMap<StringLimitTypegetLimitTypeMap() {
        return ;
    }

    
Add summary object for a type of violation.

Parameters:
type the type of violation.
number the number of violations of that type in this file.
suppressed the number of violations not shown for this file.
    public void addLimitType(String typeint numberint suppressed) {
        LimitType l = new LimitType();
        l.type = type;
        l.number = number;
        l.suppressed = suppressed;
        .put(typel);
    }

    
Add a violation to the file model.

Parameters:
v the violation to add.
    @Override
    public void addViolation(Violation v) {
        TreeSet<Violationset = getTypeMap().get(v.getType());
        if (set == null) {
            set = new TreeSet<Violation>();
            getTypeMap().put(v.getType(), set);
        }
        set.add(v);
        Set<ViolationlineSet = getLineViolationMap().get(v.getLine());
        if (lineSet == null) {
            lineSet = new TreeSet<Violation>();
            getLineViolationMap().put(v.getLine(), lineSet);
        }
        lineSet.add(v);
    }

    
A overview class for each type.
    public static class LimitType {
        private String type;
        private int    number;
        private int    suppressed;
        
Get the type,

Returns:
the type.
        public String getType() {
            return ;
        }

        
Get the number of violations.

Returns:
the number.
        public int getNumber() {
            return ;
        }

        
Get the number of suppressed violations.

Returns:
the number.
        public int getSuppressed() {
            return ;
        }
    }
New to GrepCode? Check out our FAQ X