TCM



Scala 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
package org.wisdomfish.tcm.scala

/**
 * 中醫藥學-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-19
 */

object Meritan {
	
	private val NOT_POINTS = 1
	private val IS_KEY_CNAME = 0
	private val handlefunc = (s: String) => s.split("\\s").toList
	private val Meridians = Map.newBuilder[String, List[String]] += (
			"LU" -> handlefunc("手太陰肺經 中府 雲門 天府 俠白 尺澤 孔最 列缺 經渠 太淵 魚際 少商"),
			"LI" -> handlefunc("手陽明大腸經 商陽 二間 三間 合谷 陽溪 偏歷 溫溜 下廉 上廉 手三里 曲池 肘髎 手五里 臂臑 肩髃 巨骨 天鼎 扶突 口禾髎 迎香")
			) result
	
	def getMeridianIds: List[String] =
			Meridians.keys.toList
	def getMeridianCName(keyID: String) = 
			Meridians(keyID) view(IS_KEY_CNAME)
	def getAcupuncturePointsSize(keyID: String) =
			Meridians(keyID).size - NOT_POINTS
	def getAcupuncturePoints(keyID: String) = 
			Meridians(keyID) slice(NOT_POINTS, getAcupuncturePointsSize(keyID))
	def getAcupuncturePointName(keyID: String, numID: Int) = 
			Meridians(keyID) view(numID)
}




Comments