1 23 24 package org.hammurapi.results.simple; 25 26 import java.io.Serializable ; 27 import java.util.Collection ; 28 import java.util.LinkedList ; 29 import java.util.List ; 30 31 import org.hammurapi.HammurapiException; 32 import org.hammurapi.Violation; 33 import org.hammurapi.Waiver; 34 import org.hammurapi.WaiverEntry; 35 import org.hammurapi.WaiverSet; 36 import org.hammurapi.results.DetailedResults; 37 38 43 public class SimpleDetailedResults extends SimpleNamedResults implements DetailedResults { 44 47 private static final long serialVersionUID = 4368844541348791240L; 48 private List violations=new LinkedList (); 49 private List waivedViolations=new LinkedList (); 50 private List incompleteMessages=new LinkedList (); 51 52 SimpleDetailedResults(String name, WaiverSet waiverSet) { 53 super(name, waiverSet); 54 } 55 56 public Waiver addViolation(final Violation violation) throws HammurapiException { 57 final Waiver waiver=super.addViolation(violation); 58 if (waiver==null) { 59 violations.add(violation); 60 } else { 61 waivedViolations.add(new WaiverEntry() { 62 65 private static final long serialVersionUID = -6057980823743605352L; 66 67 public Waiver getWaiver() { 68 return waiver; 69 } 70 71 public Violation getViolation() { 72 return violation; 73 } 74 }); 75 } 76 return waiver; 77 } 78 79 public Collection getViolations() { 80 return violations; 81 82 } 83 84 public int getViolationsNumber() { 85 return violations.size()+super.getViolationsNumber(); 86 } 87 88 public Collection getWaivedViolations() { 89 return waivedViolations; 90 } 91 92 } 93 | Popular Tags |