You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by do...@apache.org on 2002/05/24 06:47:42 UTC
cvs commit: jakarta-ant-myrmidon/api/src/java/org/apache/myrmidon/api/event LogLevel.java
donaldp 02/05/23 21:47:42
Modified: api/src/java/org/apache/myrmidon/api/event LogLevel.java
Log:
Add isLessThan for comparing two LogLevels
Revision Changes Path
1.2 +27 -10 jakarta-ant-myrmidon/api/src/java/org/apache/myrmidon/api/event/LogLevel.java
Index: LogLevel.java
===================================================================
RCS file: /home/cvs/jakarta-ant-myrmidon/api/src/java/org/apache/myrmidon/api/event/LogLevel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LogLevel.java 24 May 2002 04:02:02 -0000 1.1
+++ LogLevel.java 24 May 2002 04:47:42 -0000 1.2
@@ -7,16 +7,16 @@
*/
package org.apache.myrmidon.api.event;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Set;
-import java.util.Collection;
/**
* Type safe Enum for Log Levels and utility method
* for using enum to write to logger.
*
* @author <a href="mailto:peter@apache.org">Peter Donald</a>
- * @version $Revision: 1.1 $ $Date: 2002/05/24 04:02:02 $
+ * @version $Revision: 1.2 $ $Date: 2002/05/24 04:47:42 $
*/
public final class LogLevel
{
@@ -24,16 +24,21 @@
private static final HashMap c_levels = new HashMap();
//standard enums for version of JVM
- public static final LogLevel ERROR = new LogLevel( "error" );
- public static final LogLevel WARN = new LogLevel( "warn" );
- public static final LogLevel INFO = new LogLevel( "info" );
- public static final LogLevel VERBOSE = new LogLevel( "verbose" );
- public static final LogLevel DEBUG = new LogLevel( "debug" );
+ public static final LogLevel ERROR = new LogLevel( "error", 4 );
+ public static final LogLevel WARN = new LogLevel( "warn", 3 );
+ public static final LogLevel INFO = new LogLevel( "info", 2 );
+ public static final LogLevel VERBOSE = new LogLevel( "verbose", 1 );
+ public static final LogLevel DEBUG = new LogLevel( "debug", 0 );
/**
* String name of LogLevel.
*/
- private final String m_name;
+ private final String m_name;
+
+ /**
+ * The value contained in enum.
+ */
+ private final int m_value;
/**
* Retrieve the log level for the specified name.
@@ -74,10 +79,11 @@
*
* @param name the name of Log Level
*/
- private LogLevel( final String name )
+ private LogLevel( final String name, final int value )
{
m_name = name;
- c_levels.put( name, this );
+ m_value = value;
+ c_levels.put( name, this );
}
/**
@@ -87,6 +93,17 @@
public final String getName()
{
return m_name;
+ }
+
+ /**
+ * Test if LogLevel is less than other LogLevel.
+ *
+ * @param other the other LogLevel
+ * @return true if less than
+ */
+ public final boolean isLessThan( final LogLevel other )
+ {
+ return m_value < other.m_value;
}
/**
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>