codatype.java

来自「一个用java写的地震分析软件(无源码)-used to write a sei」· Java 代码 · 共 35 行

JAVA
35
字号
package org.trinet.jasi.coda;
/** Type of coda ('P', 'S', etc.) */
public class CodaType {
    public final static CodaType P = new CodaType(1, "P");
    public final static CodaType S = new CodaType(2, "S");

    private int id;
    private String type;

    private CodaType(int id, String type) {
        this.id = id;
        this.type = type;
    }

    int getId() { return id;}

    String getName() { return type;}

    public static CodaType getCodaType(int id) {
        if (id == 1) return P;
        if (id == 2) return S;
        return null;
    }
    public static CodaType getCodaType(String typeName) {
        if (typeName.equalsIgnoreCase("S")) return S;
        if (typeName.equalsIgnoreCase("P")) return P;
        return null;
    }

    public String toString() {
        return String.valueOf(id) + " " + type;
    }
}

⌨️ 快捷键说明

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