1 package org.codehaus.groovy.control.messages; 2 3 import java.io.PrintWriter ; 4 5 import org.codehaus.groovy.control.Janitor; 6 import org.codehaus.groovy.control.ProcessingUnit; 7 import org.codehaus.groovy.syntax.CSTNode; 8 9 10 11 18 19 public class WarningMessage extends LocatedMessage 20 { 21 24 public static final int NONE = 0; public static final int LIKELY_ERRORS = 1; public static final int POSSIBLE_ERRORS = 2; public static final int PARANOIA = 3; 29 30 33 34 public static boolean isRelevant( int actual, int limit ) 35 { 36 return actual <= limit; 37 } 38 39 40 41 45 46 public boolean isRelevant( int importance ) 47 { 48 return isRelevant( this.importance, importance ); 49 } 50 51 52 53 56 private int importance; 58 59 66 67 public WarningMessage( int importance, String message, CSTNode context ) 68 { 69 super( message, context ); 70 this.importance = importance; 71 } 72 73 74 75 83 84 public WarningMessage( int importance, String message, Object data, CSTNode context ) 85 { 86 super( message, data, context ); 87 this.importance = importance; 88 } 89 90 91 public void write( PrintWriter writer, ProcessingUnit owner, Janitor janitor ) 92 { 93 writer.print( "warning: " ); 94 super.write( writer, owner, janitor ); 95 } 96 97 98 99 } 100 101 102 103 | Popular Tags |