Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 70687 invoked from network); 24 May 2002 04:47:54 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 24 May 2002 04:47:54 -0000 Received: (qmail 5971 invoked by uid 97); 24 May 2002 04:47:58 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 5904 invoked by uid 97); 24 May 2002 04:47:57 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 5809 invoked by uid 97); 24 May 2002 04:47:57 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Date: 24 May 2002 04:47:42 -0000 Message-ID: <20020524044742.63284.qmail@icarus.apache.org> From: donaldp@apache.org To: jakarta-ant-myrmidon-cvs@apache.org Subject: cvs commit: jakarta-ant-myrmidon/api/src/java/org/apache/myrmidon/api/event LogLevel.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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 Peter Donald - * @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: For additional commands, e-mail: