近來老魚持續自習著中醫學, 為了讓自己在背近400多個"經絡"穴道有一個好工具, 逐著手開始撰寫了這個 API 以便在不久能與其它表現層技術相結合, 讓老魚在背頌同時有更好的"快快樂樂學經絡"的學習輔助工具~
這個範例完全使用 Google Guava API 來完成, 若您想了解它, 可以另外參考老魚的另一本學習筆記相關主題頁:
http://sites.google.com/site/javaenterpriseeditiongroup/se-in-depth/google-guava
程序執行結果圖:
範例的更新與完整說明連結:
http://iching.wisdomfish.org/tcm/tcmis/meridian
JAVA CODE :中醫藥學-TCMES-經絡-Meridian
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | package org.wisdomfish.tcm;
import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
// Java EE 6, JSF 2.0
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
/**
* 中醫藥學-TCMES-經絡
* The meridian (simplified Chinese: 經絡;
* traditional Chinese: 經絡; pinyin: jīngluò)
* @author WisdomFish.ORG - 郭朝益(ChaoYi, Kuo), http:://www.wisdomfish.org
* @version 0.1 dev
* @since 2010-07-16
*
*/
@ManagedBean
@ApplicationScoped
public class Meridian {
private final static ImmutableMap<String, ImmutableList<String>> Meridians;
private final static int NOT_POINTS = 1;
private final static int IS_KEY_CNAME = 0;
private Meridian(){};
static {
Builder<String, ImmutableList<String>> init = ImmutableMap.builder();
Meridians = init.
put("LU", ImmutableList.copyOf(
"手太陰肺經 中府 雲門 天府 俠白 尺澤 孔最 列缺 經渠 太淵 魚際 少商".
split("\\s"))).
put("LI", ImmutableList.copyOf(
"手陽明大腸經 商陽 二間 三間 合谷 陽溪 偏歷 溫溜 下廉 上廉 手三里 曲池 肘髎 手五里 臂臑 肩髃 巨骨 天鼎 扶突 口禾髎 迎香".
split("\\s"))).
put("PC", ImmutableList.copyOf(
"手厥陰心包經 天池 天泉 曲澤 隙門 間使 內關 大陵 勞宮 中沖".
split("\\s"))).
build();
}
/**
* 取得經絡代碼清單
* @return 經絡代碼清單
*/
public static ImmutableSet<String> getMeridianIds() {
return Meridians.keySet();
}
/**
* 查詢指定經絡代碼之中文名稱.
* @param keyID 經絡代碼
* @return 經絡代碼中文名稱
*/
public static String getMeridianName(String keyID) {
return Meridians.get(keyID).get(IS_KEY_CNAME);
}
/**
* 查詢指定經絡的腧穴總數值
* @param keyID 經絡代碼
* @return 腧穴總數數值
*/
public static int getAcupuncturePointsSize(String keyID) {
return Meridians.get(keyID).size() - NOT_POINTS;
}
/**
* 取得指定經絡腧的腧穴中文名稱清單
* @param keyID 經絡代碼
* @return 腧穴中文名稱清單
*/
public static ImmutableList<String> getAcupuncturePoints(String keyID) {
return Meridians.get(keyID).subList(NOT_POINTS, Meridians.get(keyID).size());
}
/**
* 查詢指定經絡中特定編號的腧穴中文名稱
* @param keyID 經絡代碼
* @param numID 腧穴代碼
* @return 腧穴中文名稱
*/
public static String getAcupuncturePointName(String keyID, int numID) {
return Meridians.get(keyID).get(numID);
}
public static void main(String[] args) {
final String KEY_ID = "PC";
final int NUM_ID = 5;
long startTime = System.nanoTime()/1000000L;
// System.out.println("經絡總清單:" + Meridians.entrySet());
System.out.println("經絡代碼清單:" + Meridian.getMeridianIds());
System.out.println("代碼名稱-" + KEY_ID + " = " + Meridian.getMeridianName(KEY_ID));
System.out.println(Meridian.getMeridianName(KEY_ID) + " 腧穴總數:" +
Meridian.getAcupuncturePointsSize(KEY_ID) + " 穴");
System.out.println(Meridian.getMeridianName(KEY_ID) + " 腧穴清單:" +
Meridian.getAcupuncturePoints(KEY_ID));
System.out.println(Meridian.getMeridianName(KEY_ID) + " 腧穴編號-" + KEY_ID + NUM_ID +
" = " + Meridian.getAcupuncturePointName(KEY_ID, NUM_ID) + "穴");
long endTime = System.nanoTime()/1000000L;
long time = endTime - startTime;
System.out.println("處理耗時:" + time + "ms");
}
} |
1xbet korean - Legalbet
回覆刪除› 2021/06/21 › 1xbet korea-korea-korea-korea-korea-korea-korea-korea-korea-korea-korea You must be playing with one of our partners, if you หาเงินออนไลน์ are a Korean player. Please play with one 바카라 사이트 of our partners, if you are