view.java

来自「java案例开发一书的源代码」· Java 代码 · 共 54 行

JAVA
54
字号
/* * View.java * * Created on 2003年11月6日, 上午9:38 */package romulus;/** * * @author  Romulus * @version 1.0 */public class View {        /** The String ident of the views.*/    private static String Str_View[] = {"Unknown", "Teacher", "Master", "Student"};        /** Get the string ident use int.*/    public static String getView(int ident){        //1 is Teacher        //2 is Master        //3 is Student        //0 and others are Unknown        if(ident < 0 || ident >3){            return Str_View[0];        }        else{            return Str_View[ident];        }    }        /** Get the int ident use string.*/    public static int getView(String ident){        if(ident.equals(Str_View[1])){            return 1;        }        else if(ident.equals(Str_View[2])){            return 2;        }        else if(ident.equals(Str_View[3])){            return 3;        }        else{            return 0;        }    }    /** Creates new View */    private View() {    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?