1 21 22 package net.percederberg.grammatica.parser; 23 24 import java.util.ArrayList ; 25 26 34 public class ParserLogException extends Exception { 35 36 39 private ArrayList errors = new ArrayList (); 40 41 44 public ParserLogException() { 45 } 46 47 52 public int getErrorCount() { 53 return errors.size(); 54 } 55 56 63 public ParseException getError(int index) { 64 return (ParseException) errors.get(index); 65 } 66 67 72 public void addError(ParseException e) { 73 errors.add(e); 74 } 75 76 83 public String getMessage() { 84 StringBuffer buffer = new StringBuffer (); 85 86 for (int i = 0; i < getErrorCount(); i++) { 87 if (i > 0) { 88 buffer.append("\n"); 89 } 90 buffer.append(getError(i).getMessage()); 91 } 92 return buffer.toString(); 93 } 94 } 95 | Popular Tags |