📄 priority.java
字号:
package cn.edu.nju.software.sd.cll; /** * Priority class * Father of the Level class * @author SuSE * */public class Priority { // <editor-fold defaultstate="collapsed" desc=" UML Marker "> // #[regen=yes,id=DCE.4539A8A4-A09F-3207-A807-2E3CB7F541E0] // </editor-fold> public final static int FATAL_INT = 50000; // <editor-fold defaultstate="collapsed" desc=" UML Marker "> // #[regen=yes,id=DCE.FDFE43E8-3F9F-688D-8764-6E0F1959E293] // </editor-fold> public final static int ERROR_INT = 40000; // <editor-fold defaultstate="collapsed" desc=" UML Marker "> // #[regen=yes,id=DCE.1109736D-4B01-4BE8-5B20-81FBD863AEDB] // </editor-fold> public final static int WARNING_INT = 30000; // <editor-fold defaultstate="collapsed" desc=" UML Marker "> // #[regen=yes,id=DCE.48D3F839-47AE-01E3-1EBD-E1301113829B] // </editor-fold> public final static int INFO_INT = 20000; // <editor-fold defaultstate="collapsed" desc=" UML Marker "> // #[regen=yes,id=DCE.2BCD485D-DB87-149E-24AF-CFB0D5FEFE02] // </editor-fold> public final static int DEBUG_INT = 10000; // <editor-fold defaultstate="collapsed" desc=" UML Marker "> // #[regen=yes,id=DCE.37B5B3B9-4E59-4465-0D24-700685172904] // </editor-fold> public final static int OFF_INT = Integer.MAX_VALUE; public final static int ALL_INT = Integer.MIN_VALUE; private int levelNo; private String levelStr; final static public Priority FATAL = new Level(FATAL_INT, "FATAL"); /** * @deprecated Use {@link Level#ERROR} instead. */ final static public Priority ERROR = new Level(ERROR_INT, "ERROR"); /** * @deprecated Use {@link Level#WARN} instead. */ public final static Priority WARNING = new Level(WARNING_INT, "WARN"); /** * @deprecated Use {@link Level#INFO} instead. */ final static public Priority INFO = new Level(INFO_INT, "INFO"); /** * @deprecated Use {@link Level#DEBUG} instead. */ final static public Priority DEBUG = new Level(DEBUG_INT, "DEBUG"); protected Priority() { levelNo = DEBUG_INT; levelStr = "DEBUG"; } /** Instantiate a level object. */ protected Priority(int levelNo, String levelStr ) { this.levelNo= levelNo; this.levelStr = levelStr; } // <editor-fold defaultstate="collapsed" desc=" UML Marker "> // #[regen=yes,id=DCE.6AD8C8E5-7187-C032-6C65-9CFAE3B98A19] // </editor-fold> /** * to compare the level of two priorities. */ public boolean isGreaterOrEqual(Priority r) { return levelNo >= r.levelNo; }/** * getAllPossiblePriorities function * (Not used here.) * @return */ public static Priority[] getAllPossiblePriorities() { return new Priority[] {Priority.FATAL, Priority.ERROR, Level.WARNING, Priority.INFO, Priority.DEBUG}; } /** * Whether the two priorities are of the same level. */ public boolean equals(Object o) { if(o instanceof Priority) { Priority r = (Priority) o; return (this.levelNo == r.levelNo); } else { return false; } } /** * toInt function * get the int value of Level * @return */ public final int toInt () { return levelNo; } /** * toString function * get the String value of Level; */ @Override final public String toString() { return levelStr; } /** * toPriority function * get the Level by String value * @param sArg * @return */ public Priority toPriority (String sArg) { return Level.toLevel(sArg); }/** * toPriority function * get the Level by int value * @param val * @return */ public Priority toPriority (int val) { return Level.toLevel(val); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -