2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 // Contributors: Kitching Simon <Simon.Kitching@orange.ch>
20 package jalview.javascript.log4j;
23 <font color="#AA4444">Refrain from using this class directly, use
24 the {@link Level} class instead</font>.
26 @author Ceki Gülcü */
27 public class Priority {
30 transient String levelStr;
31 transient int syslogEquivalent;
33 public final static int OFF_INT = Integer.MAX_VALUE;
34 public final static int FATAL_INT = 50000;
35 public final static int ERROR_INT = 40000;
36 public final static int WARN_INT = 30000;
37 public final static int INFO_INT = 20000;
38 public final static int DEBUG_INT = 10000;
39 //public final static int FINE_INT = DEBUG_INT;
40 public final static int ALL_INT = Integer.MIN_VALUE;
42 // too twisted for J2S -- Level class initializer initializes Priority, which
44 // new Level before Priority is indicated to be a superclass of Level.
46 * @deprecated Use {@link Level#FATAL} instead.
49 final static public Priority FATAL = null;// new Level(FATAL_INT, "FATAL", 0);
52 * @deprecated Use {@link Level#ERROR} instead.
55 final static public Priority ERROR = null;// new Level(ERROR_INT, "ERROR", 3);
58 * @deprecated Use {@link Level#WARN} instead.
61 final static public Priority WARN = null;// new Level(WARN_INT, "WARN", 4);
64 * @deprecated Use {@link Level#INFO} instead.
67 final static public Priority INFO = null;// new Level(INFO_INT, "INFO", 6);
70 * @deprecated Use {@link Level#DEBUG} instead.
73 final static public Priority DEBUG = null;// new Level(DEBUG_INT, "DEBUG", 7);
76 * Default constructor for deserialization.
78 protected Priority() {
85 Instantiate a level object.
88 Priority(int level, String levelStr, int syslogEquivalent) {
90 this.levelStr = levelStr;
91 this.syslogEquivalent = syslogEquivalent;
95 Two priorities are equal if their level fields are equal.
100 boolean equals(Object o) {
101 if(o instanceof Priority) {
102 Priority r = (Priority) o;
103 return (this.level == r.level);
110 Return the syslog equivalent of this priority as an integer.
114 int getSyslogEquivalent() {
115 return syslogEquivalent;
121 Returns <code>true</code> if this level has a higher or equal
122 level than the level passed as argument, <code>false</code>
125 <p>You should think twice before overriding the default
126 implementation of <code>isGreaterOrEqual</code> method.
130 boolean isGreaterOrEqual(Priority r) {
131 return level >= r.level;
135 // Return all possible priorities as an array of Level objects in
138 // @deprecated This method will be removed with no replacement.
142 // Priority[] getAllPossiblePriorities() {
143 // return new Priority[] {Priority.FATAL, Priority.ERROR, Level.WARN,
144 // Priority.INFO, Priority.DEBUG};
149 Returns the string representation of this priority.
159 Returns the integer representation of this level.
168 // * @deprecated Please use the {@link Level#toLevel(String)} method instead.
172 // Priority toPriority(String sArg) {
173 // return Level.toLevel(sArg);
177 // * @deprecated Please use the {@link Level#toLevel(int)} method instead.
181 // Priority toPriority(int val) {
182 // return toPriority(val, Priority.DEBUG);
186 // * @deprecated Please use the {@link Level#toLevel(int, Level)} method
191 // Priority toPriority(int val, Priority defaultPriority) {
192 // return Level.toLevel(val, (Level) defaultPriority);
196 // * @deprecated Please use the {@link Level#toLevel(String, Level)} method
201 // Priority toPriority(String sArg, Priority defaultPriority) {
202 // return Level.toLevel(sArg, (Level) defaultPriority);