subtype是什么意思,subtype中文翻譯,subtype發(fā)音、用法及例句
?subtype
subtype發(fā)音
英:['s?bta?p] 美:['s?b?ta?p]
英: 美:
subtype中文意思翻譯
n. 子類型
subtype常見例句
1 、Substitution Principle: a variable of a given type may be assigned a value of any subtype of that type, and a method with a parameter of a given type may be invoked with an argument of any subtype of that type.───大概的意思是說某種類型的變量可以被該類型的任何子類所賦值,一個方法中的參數(shù)也可以被該參數(shù)的任何子類進行調用。
2 、Subsequent observations have revealed it to be a morph of the zergling, the most numerous zerg subtype.───但是一系列深入的觀察都發(fā)現(xiàn)毒蛉是從蟲族最常見的單位小狗演化而來的。
3 、But it is difficult to classify the histopathological subtype of the non-small cell lung carcinomas only based on the concerned nuclear stereologic parameters.───但僅依據肺癌細胞核的有關體視學參數(shù)很難對非小細胞肺癌組織學亞型進行滿意分類;
4 、Harlequin ichthyosis (HI)is a severe subtype of autosomal recessive congenital ichthyoses (ARCI).───丑角樣魚鱗病是常染色體隱性遺傳性魚鱗病的一種嚴重亞型。
5 、XU LZ,ZHOU XY,ZHU WP,et al.Detection of peripheral blood lymphocyte subtype and analysis of the rDNA transcriptional activity[J].China Oncology,1999,9(4):265-268.───[5]許良中,周曉燕,朱偉萍,等.外周血淋巴細胞亞群檢測及其rDNA轉錄活性分析[J].中國癌癥雜志,1999,9(4):265-268.
6 、It's a common respiratory ailment in pigs, but this strain appears to be a subtype never before seen in pigs or humans.───它是發(fā)生在豬身上的一種常見呼吸道疾病,但這次爆發(fā)的似乎是在豬或人類身上以前從未見到過的一個亞型。
7 、If two or more planeswalkers that share a subtype are in play, they're all put into their owners' graveyards as a state-based effect.───如果兩個或以上享有共同副類別的旅法師同時在場上,則把他們全部放到墳墓場。(旅法師的傳奇規(guī)則)
8 、A review of the current literature revealed no other cases of this uncommon alhistologic subtype of thymic carcinoma metastatic to the cranium.───對最新資料的回顧顯示沒有這種罕見胸腺癌顱內轉移的病例。
9 、SNI also resulted in a significant increase in the mRNA expression of 5-HT_7 receptor subtype at 1 d, then maintained at a high level to 28 d.───5-HT7 受體亞型mRNA的表達在術后 1d時即顯著升高,一直維持高水平的表達至28d。
10 、Laboratory tests completed today in Turkey have detected the H5 virus subtype in post-mortem specimens taken from a 12-year-old girl, from Agri Province, who died 7 January.───土耳其今日完成的實驗室檢測在一名已于1月7日死亡的阿勒省12歲女童死檢標本中發(fā)現(xiàn)了H5亞型病毒。
11 、It is interesting to note that ADHD might not be detected in girls because they have the inattentive subtype, he said.───他說,有趣的是,ADHD在女孩中很難檢測,因為她們中存在不注意亞型。
12 、WTO officials warned that H5N1 bird flu strain was mutating into a new subtype,which could be transmitted among humans.───世界衛(wèi)生組織官員警告說,H5N1型禽流感病毒正在變異成一個新亞型,這種變異后的病毒亞型能在人與人之間傳播。
13 、Lei ZH,Li JX,Yu HY,et al.Generatoin of transgenic mice habouring hepatitis B virus genome(ayw subtype)[J].Di-er Junyi Daxue Xuebao(Acad J Sec Mil Med Univ),1997,18(3):201-204.───[1]雷章恒,李建秀,余宏宇,等.乙型肝炎病毒(ayw亞型)轉基因小鼠的建立[J].第二軍醫(yī)大學學報,1997,18(3):201-204.
14 、An object's characteristics are name, mana cost, color, card type, subtype, supertype, expansion symbol, rules text, abilities, power, toughness, and loyalty.───對象的特征包括名稱,魔法力費用,顏色,類別,副類別,超類別,系列符號,規(guī)則敘述,力量,以及防御力。
15 、Volcanic type uranium deposits in China are mainly located in southeastern China with the predominant mono uranium subtype in ore composition.───中國火山巖型鈾礦床主要產于東南沿海一帶,其礦石物質成分以單鈾類型為主,但也存在一些復雜類型的礦床。
16 、As a main method to prevent AIV,inactive vaccine was applied in the practice, this kind of vaccine has the subtype specificity which limit its application.───就目前而言,能在實踐上應用的禽流感疫苗主要還是滅活疫苗,這種疫苗具有亞型特異性,但也正是這種特性限制了這種疫苗的發(fā)展。
17 、Analytical results of sequence isolated from seven children and one mother showed: Genotype and subtype of one case is B and adw, the other are C and adr.───對來自7例孩子和1例母親的HBVS區(qū)擴增片斷進行了序列測定。 結果為:1例基因型為B,血清型為adw,其余7例基因型均為C,血清型均為adr。
18 、Parameter must be either a COM-imported type or a subtype of a COM-imported type.───參數(shù)必須是COM導入類型或COM導入類型的子類型。
19 、Thirty patients were subtype adr and only one patients was adw.───30例adr亞型 ,1例adw亞型 ;
20 、Human hepatitis B virus is the prototype for a family of viruses, referred to as hepadnaviridae. It has at least 4 subtypes, ayw, adr, ayr, and adw, among which subtype adr is the most prevailing in China.───人類乙型肝炎病毒屬嗜肝DNA病毒科,至少有4種亞型:ayw、adr、ayr、和adw。
21 、Capabilities and management of a WORM drive, a subtype of media access device.───WORM驅動器(媒體訪問設備的一個分類)的功能和管理。
22 、Click a chart type in the first box, and then click the chart subtype that you want to use in the second box.───在第一個框中單擊圖表類型,然后在第二個框中單擊要使用的圖表子類型。
23 、Chromosome analysis and detection of fusion genes are helpful in the diagnosis of AML and the differentiation diagnosis of AML subtype.───兒童AML進行染色體分析及融合基因的檢測,有助于AML診斷及亞型之間的鑒別診斷。
24 、The same type cannot be the subtype and the supertype.───同一類型不能既是子類型又是父類型。
25 、Named sets defined on the key attribute of a dimension are converted to a subtype of the entity.───對維度的鍵屬性定義的命名集將轉換為實體的一個子類型。
26 、In all 40 patients, 36 patients belongs to subtype adw and 4 patients to subtype adr.───40例樣本中,ADW型36 例,ADR型4例。
27 、A creature with landwalk is unblockable as long as the defending player controls at least one land which has the specified subtype or supertype.───只要防御玩家至少操控一個所指定副類別或超類別的地,具有地行者異能的生物便不能被阻擋。
28 、Peipheral T-cell Lymphoma with Distinct Perifollicular Growth Pattern. A Distinct Subtype of T-cell Lymphoma.───具有明顯濾泡旁生長方式的外周T細胞性淋巴瘤--T細胞性淋巴瘤的又一特殊亞型?
29 、HA test was conducted with the harvested allantioc fluid,the average titer was 29.HI test was carried out with subtype H5、H7、H9 AIV antisera and ND antiserum .───分別用H5、H7、H9亞型AIV抗血清和ND抗血清進行HI試驗,發(fā)現(xiàn)該病毒僅能被H5亞型抗血清所抑制。
30 、The expression of VEGF in NSCLC was 64%,there was not significantly relationship between the expression of VEGF and histologic subtype,differentiation,p-TNM stage,and lymph nodal metastases(P>0.05).───100例NSCLC石蠟標本中,VEGF**率為64%,不同p-TNM分期、淋巴結轉移的NSCLC組織中,VEGF表達與NSCLC組織學類型和分化程度、p-TNM分期、淋巴結轉移無明顯相關性。
31 、The etiology of IHA,the main subtype,is related with increased abnormal aldosterone excreted factor and genovariation.───IHA為主要類型,發(fā)病與異常的促醛固酮分泌因子的增加及基因變異有關。
32 、No systemic chemotherapy or radiotherapy should be performed without cytohistologic evidence of cancer and its subtype.───如果沒有腫瘤的細胞組織學證據及其分型,不應當對患者行任何全身性化療或放療。
33 、Subjects were 8 to 18 years of age, 71% were male, 67% met criteria for mixed subtype with both inattentive and hyperactive/impulsive symptoms, and 38% had comorbid oppositional defiant disorder.───受試者年齡在8到18歲之間,71%?男性,67%的受試者符合注意力差、過動或易沖動的混合亞型,另外38%的受試者合并有抵抗癥狀。
34 、The different HBV subtypes have different patterns of geographic distribution. Subtype adw is the major type in Hakka area of Guangdong.───HBV亞型的分布具有明顯的域性,廣東客家人感染的HBV亞型主要為ADW型,只有少數(shù)為ADR 型。
35 、This tumor is a histologic subtype of sweat gland carcinoma.───在1952年首次被提出,文獻上僅有少數(shù)病例報告。
36 、MIME types are specified in two parts.The top-level media type declares the general type of media, and the subtype defines the specific format for that media.───MIME類型由兩部分構成,第一部分是文件的類型(“頂級分類”),后一部分制定了特定的文件格式(“二級分類”)。
37 、It is a subtype of trichothiodystrophy.───它是發(fā)硫失養(yǎng)癥的亞型。
38 、Lingual foramen cecum and fistula without connection with oral cavity was classified into subtype.───其中舌盲孔和其下瘺管與口腔不通為亞類。
39 、Bonemarrow biopsy is scheduled for next week to determine leukemia subtype.─── 下周安排了骨髓活組織檢查 來確診白血病子型
40 、Thus, inactivation of NF2, often combined with the presence of macro-mutation on 22q, is likely not as important for the development of the meningothelial subtype, as opposed to the fibroblastic form.───因此,與成纖維細胞瘤形成不同,NF2的鈍化和經常伴隨的22q巨突變 ,在腦膜瘤亞型的發(fā)展中或許并非同等重要。
41 、Peipheral T-cell Lymphoma with Distinct Perifollicular Growth Pattern.A Distinct Subtype of T-cell Lymphoma.───- 具有明顯濾泡旁生長方式的外周T細胞性淋巴瘤--T細胞性淋巴瘤的又一特殊亞型?
42 、Capabilities and management of a PC video controller, a subtype of video controller.───PC視頻控制器(視頻控制器子類型)的性能和管理。
43 、The game effect of a Tomb is that all undead inside it gain fast healing 1 and cannot be Turned or Rebuked, and spells with the [Tomb] subtype can be cast within it.───在游戲中,身處墓穴中的亡靈會獲得+1快速醫(yī)療并免疫驅散或斥喝,[墓穴]子學派的法術也能在墓穴中施放。
44 、ISH is a subtype of hypertension mainly in the elderly, and the prevalence rate of ISH in females is significantly higher than thatin males.───ISH是主要見于老年人的一種高血壓類型,女性患病率高于男性。
45 、The analysis of V3 loop amino sequence of 12 subtype B HIV-1 reveals that V3-tip motif of 6 samples (50%) is GPGQ and that of 3 samples (25%) is GPGR. In addition, the codon of arginine (R) of all the strains is CGA instead of AGA.───對B亞型毒株V3環(huán)序列的分析還發(fā)現(xiàn),位于V3環(huán)頂端的四肽序中GPGQ占50%,GPGR則僅占25%,且編碼其精氨酸(R)的密碼子均為CGA而不是AGA。
46 、The HCV isolate from two Nanjing-born patients was closely related to that in Japan. The adr and adw were found to be 55.6% and 38.4%,respectively in serum samples by HBsAg subtype identification.───HBV亞型分析:adr 占55.6% ,adw 占38.4% 。
47 、Subtype code for datetime and SQL-92 interval data types.───datetime及SQL-92 interval數(shù)據類型的子類型代碼。
48 、Subtypes ad-w and adr are the major types in Sunan area. S gene sepuence of HBV has its variability, especially in subtype adw.───HBV-S基因(“a”決定簇)序列存在多態(tài)性,其中adw亞型略為明顯。
49 、They hope to find a profile of genes and proteins to diagnose CFS and its subtype.───他們希望找到一組基因和蛋白質來診斷CFS及其亞型。
50 、If two or more planeswalkers in play share a planeswalker subtype, all are put into their owners' graveyards.───如果兩個或更多具有同樣副類別的鵬洛客同時在場,則他們都會置入其擁有者的墳墓場。
51 、Each HI-infected region of the world tends to hae a predominant genetic subtype of the irus.───世界上各個艾滋病感染地區(qū)都有在遺傳上的主要病毒亞型的趨勢。
52 、All the isolated viruses grew very well in MDCK cells, but there were only 6 strains (2.1%) in embryonated chick eggs. 21 Avian influenza surveillance specimens were all negative in H5 subtype by.───285株流感病毒都能適應MDCK細胞,但**標本液直接接種雞胚**率極低,僅為2.1%(6/285)。
53 、Pirenzenpine is a relatively selective M1 subtype muscarinic receptor antagonist and used to treat digestive system ulcer.───哌侖西平是一種M1受體選擇性的抗膽堿藥,臨床上用于治療消化性潰瘍。
54 、Analysis of E domain indicated that cloned grass carp IGF I belonged to IGF IEa 2 subtype.───E區(qū)域分析結果表明 ,所克隆的草魚IGF I序列屬于IGF IEa 2亞型
55 、To predict antigen epitopes on B cell of VP2 of canine parvovirus 2b subtype(CPV-2b),the VP2 gene of CPV-2b was cloned and sequenced.───對犬細小病毒2b亞型衣殼蛋白VP2基因進行了克隆、測序,并用分子生物學軟件DNAStar對VP2基因的推導氨基酸序列進行了表位分析。
56 、In SDS-PAGE and western-blot analysis of McAb 4E4, specific bands emerged at the site of 60KD, which indicated that 4E4 might react with NP protein of H5 subtype AIV.───SDS-PAGE 和Western-blot分析結果表明,4E4單抗與H5N1亞型的AIV在60KD附近出現(xiàn)一條特異性條帶,說明這株單抗可能是針對AIV病毒的NP蛋白;
57 、AML1-ETO fusion gene can not only be regarded as a molecular marker of acute myelocytic leukemia subtype M2b, but also is helpful in evaluating prognosis and monitoring remant leukemia.───AML1-ETO融合基因可作為M2b亞型的分子標志物,同時對判斷預后和監(jiān)測殘留白血病等方面也有一定價值。
58 、A spell's card type, supertype, and subtype are the same as those of its card.───咒語的類別,超類別與副類別就如同該牌所示。
59 、You can sacrifice a nonbasic land this way as long as it has the subtype Forest or Plains.───如果某張非基本地的副類別包括了樹林或平原,你也可以此法將它犧牲。
60 、The sequencing data of the major S fragmen from the patient showed that two HBV strains subtype adr and adw existed in the blood samples.───發(fā)現(xiàn)患者及其母親血清中均存在adr和adw兩種亞型的HBV DNA。
61 、But we have to run some more tests to determine exactly what the subtype is.─── 但我們還得再多做幾次化驗 來確診是哪一型
62 、In all 81 patients, 38 patients belong to subtype adr and 43 patients to subtype adw.───81價標本中,測得adr型38例,adw型43例,未發(fā)現(xiàn)有ayr及ayw型。
63 、Richard,A.C.,Lung.Sang,K.,ka-lun.S.,et al.Detection of highly pathogenic and Iov pathogenic avian influenza subtype H5(Eurasian lineage)using NASBA[J].Vir01.Meth 2002 103:213.225.───千澤霖,黃娟,馬仲彬,等.單抗介導的斑點免疫金滲濾法快速檢測禽流感病毒[A].中國畜牧獸醫(yī)家畜傳染病學分會第十次學術研討會禽流感研究論文專集,2003.10:90.96.
64 、Only the characteristics name, type, subtype, supertype, rules text, abilities, power, and toughness are affected by flipping a permanent.───將某永久物倒轉后,只有其類別,副類別,超類別,規(guī)則敘述,異能,力量,以及防御力會受到影響。
65 、A token is subject to anything that affects permanents in general or that affects the token's card type or subtype.───會影響永久物的事物,以及會影響某衍生物之類別或副類別的事物,都會影響到此衍生物。
66 、Fig 1 MSCT of plasma cell mastitis of left breast, quadrant subtype of inflammation type. Coronal cut of 3D reconstruction of MSCT showed lesion location.───圖1左乳漿細胞性乳腺炎MSCT,炎癥型-象限亞型。三維(3D)重建并行病變乳房冠狀位切面顯示炎癥所在位置。
67 、"Soap bubble" sign of HD of bone might have some relationship with the histologic subtype.───HD形成皂泡狀骨病變與病理亞型有一定關系;
68 、These expression plasmids were transfected into HepG2-N10 cells, a cell line which stably express HBsAg,HBeAg and adw2 subtype Dane Particles.───HepG2-N10是一個可穩(wěn)定表達HBsAg及HBeAg的細胞株(其表達HBV血清型為adw2亞型)。
69 、To satisfy the alternative cost, you may return any basic land you control to its owner's hand, regardless of that land's subtype or whether it's tapped.───為了滿足此替代性費用,你可以將任何由你操控的基本地移回其擁有者手上,不論該地的副類別或是否已橫置都是一樣。
70 、In a follow up study of 47 HBsAg families, nine mothers from nine families were subtype adr and three mothers from three families were subtype adw.───在隨訪的47戶HBsAg**家庭中有9戶母親的HBsAg屬adr亞型; 3戶母親的HBsAg屬adw亞型。
71 、The subtype of GBM and MGMT expression were prognosticators for GBM.───GBM的分型、MGMT的**表達是影響GBM患者生存期的獨立預后因素。
72 、One pair of primers were designed on the basis of HA gene of AIV, allowing simultaneous detection of AIV subtype H9 and H5, and the specific amplicons were 579bp and 177bp in size respectively.───參照AIV的HA基因序列設計1對引物,對H9和H5亞型AIV進行了擴增,產物大小分別為579bp和177bp。
73 、Laboratory tests conducted in Turkey have confirmed detection of the H5 subtype of avian influenza virus in samples from an additional two patients.───在土耳其實驗室進行的檢測已確認從另外兩名患者的標本中發(fā)現(xiàn)H5亞型禽流感病毒。
74 、AE1/ AE3 is Monoclonal antibody which can relate with several CK subtype, It can be used to mark the tumor of epithelial cell, especially identify and judge the metastasis tumor weather is epithelial cell.───AE1/AE3是針對多種角蛋白亞型的單克隆抗體,用于標記上皮及上皮源性的腫瘤,特別是鑒別和判斷轉移性腫瘤是否為上皮源性具有一定的意義。
75 、During both in vivo and in vitro development, CGC depend on the activity of the NMDA glutamate receptor subtype for survival and full differentiation [3].───在體內和體外發(fā)育過程中,小腦顆粒細胞依賴于N-甲基-D-天冬氨酸(NMDA)谷氨酸鹽受體亞型的活性而生存和完全分化。
76 、A content type is metadata which defines a part's media type, a subtype, and a set of optional parameters.───內容類型是定義部件的媒體名稱、子類型和一組可選參數(shù)的元數(shù)據。
77 、HBV has at least 4 serosubtypes, ayw, adr, ayr, and adw, among which adr is the most prevailing subtype in China.───另外,由于HBV有至少4種血清亞型(adr、ayr、adw和ayw),它們在基因組結構、生物學特性和流行地域等方面都存在著一定的差異。
78 、Subtype code for datetime and SQL-92 interval data type.───datetime和SQL-92 interval數(shù)據類型的子類型代碼。
79 、The subtype of bacteria -- called E. coli 0111 -- is "not normally found in this form of outbreak," said Leslea Bennett-Webb, director of communication for the Oklahoma State Department of Health.───俄克拉荷馬州衛(wèi)生部官員說,這種稱為E.coli0111的細菌亞種在這類暴發(fā)流行中并不常見。
80 、A creature with landwalk is unblockable as long as the defending player controls at least one land with the specified subtype and/or supertype. (See rule 309, "Declare Blockers Step.───只要對手至少操控一個所指定副類別或超類別的地,具有地行者異能的生物便不能被阻擋。
81 、The CRF01- AE subtype was the main epidemic strain.───CRF01-AE亞型為主要流行株。
82 、As a new subtype, UAH is rarely seen.───UAH是一種新的亞型,較為少見。
誰能解釋一下Java中Typeparameters的含義
ypeparameters:
泛型參數(shù)
一般意義上來說,泛型是一種把相同的代碼重用在不同的類型上的技術。它作為一個相對獨立于其它面向對象特性的技術,在面向對象語言里已經變得越來越普遍了。我們這里之所以討論泛型,一是因為泛型這種技術本身就很讓人感興趣,另外,也是因為泛型是一個被用來對付二元方法問題(binarymethodproblem)的主要工具。
和subtyping共同使用,泛型可以用來解決一些在方法特化等場合由反協(xié)變帶來的類型系統(tǒng)的困難??紤]這樣一個例子:
我們有Person和Vegitarian兩種類型,同時,我們有Vegitable和Food兩種類型。而且,Vegitable<:Food.
ObjectTypePersonis
…
methodeat(food:Food);
end;
ObjectTypeVegetarianis
…
methodeat(food:Vegitable);
end;
這里,從常識,我們知道一個Vegitarian是一個人。所以,我們希望可以有Vegetarian<:Person.
不幸的是,因為參數(shù)是反協(xié)變的,如果我們錯誤地認為Vegetarian<:Person,根據subtype的subsumption原則,一個Vegetarian的對象就可以被當作Person來用。于是一個Vegetarian就可以錯誤地吃起肉來。
使用泛型技術,我們引入TypeOperator(也就是,從一個類型導出另一個類型,概念上類似于對類型的函數(shù))。
ObjectOperatorPersonEating[F<:Food]is
…
methodeat(food:F);
end;
ObjectOperatorVegetarianEating[F<:Vegetable]is
…
methodeat(food:F);
end;
這里使用的技術被稱作BoundedTypeParameterization.(Trelli/Owl,Sather,Eiffel,PolyTOIL,Raptide以及GenericJava都支持BoundedTypeParameterization.其它的語言,如C++,只支持簡單的沒有類型約束的泛型)
F是一個類型參數(shù),它可以被實例化成一個具體的類型。類似于變量的類型定義,一個bound如F<:Vegitable限制了F只能被Vegitable及其子類型所實例化。所以,VegitarianEating[Vegitable],VegitarianEating[Carrot]都是合法的類型。而VegitarianEating[Beef]就不是一個合法的類型。類型VegitarianEating[Vegitable]是VegitarianEating的一個實例,同時它等價于類型Vegitarian.(我們用的是基于結構的subtype)
于是,我們有:
對任意F<:Vegitable,VegitarianEating[F]<:PersonEating[F]
對于原來的Vegitarian類型,我們有:
Vegetarian=VegetarianEating[Vegetable]<:PersonEating[Vegitable]
這種關系,正確地表達了“一個素食者是一個吃蔬菜的人”的概念。
除了BoundedTypeParameterization之外,還有一種類似的方法也可以解決這個素食者的問題。這種方法被叫做:BoundedAbstractType
請看這個定義:
ObjectTypePersonis
TypeF<:Food;
…
varlunch:F;
methodeat(food:F);
end;
ObjectTypeVegetarianis
TypeF<:Vegitable;
…
varlunch:F;
methodeat(food:F);
end;
這里,F(xiàn)<:Food的意思是,給定一個Person,我們知道他能吃某種Food,但我們不知道具體是哪一種。這個lunch的屬性提供這個Person所吃的Food.
在創(chuàng)建Person對象時,我們可以先選定一個Food的subtype,比如說,F(xiàn)=Dessert.然后,用一個Dessert類型的變量賦給屬性lunch.最后再實現(xiàn)一個eat(food:Dessert)的方法。
這樣,Vegetarian<:Person是安全的了。當你把一個Vegetarian當作一個Person處理時,這個Vegitarian可以安全地吃他自帶的午餐,即使你不知道他吃的是肉還是菜。
這種方法的局限在于,Person,Vegitarian只能吃他們自帶的午餐。你不能讓他們吃買來的午餐。
誰能解釋一下Java中Typeparameters的含義
ypeparameters:
泛型參數(shù)
一般意義上來說,泛型是一種把相同的代碼重用在不同的類型上的技術。它作為一個相對獨立于其它面向對象特性的技術,在面向對象語言里已經變得越來越普遍了。我們這里之所以討論泛型,一是因為泛型這種技術本身就很讓人感興趣,另外,也是因為泛型是一個被用來對付二元方法問題(binarymethodproblem)的主要工具。
和subtyping共同使用,泛型可以用來解決一些在方法特化等場合由反協(xié)變帶來的類型系統(tǒng)的困難??紤]這樣一個例子:
我們有Person和Vegitarian兩種類型,同時,我們有Vegitable和Food兩種類型。而且,Vegitable<:Food.
ObjectTypePersonis
…
methodeat(food:Food);
end;
ObjectTypeVegetarianis
…
methodeat(food:Vegitable);
end;
這里,從常識,我們知道一個Vegitarian是一個人。所以,我們希望可以有Vegetarian<:Person.
不幸的是,因為參數(shù)是反協(xié)變的,如果我們錯誤地認為Vegetarian<:Person,根據subtype的subsumption原則,一個Vegetarian的對象就可以被當作Person來用。于是一個Vegetarian就可以錯誤地吃起肉來。
使用泛型技術,我們引入TypeOperator(也就是,從一個類型導出另一個類型,概念上類似于對類型的函數(shù))。
ObjectOperatorPersonEating[F<:Food]is
…
methodeat(food:F);
end;
ObjectOperatorVegetarianEating[F<:Vegetable]is
…
methodeat(food:F);
end;
這里使用的技術被稱作BoundedTypeParameterization.(Trelli/Owl,Sather,Eiffel,PolyTOIL,Raptide以及GenericJava都支持BoundedTypeParameterization.其它的語言,如C++,只支持簡單的沒有類型約束的泛型)
F是一個類型參數(shù),它可以被實例化成一個具體的類型。類似于變量的類型定義,一個bound如F<:Vegitable限制了F只能被Vegitable及其子類型所實例化。所以,VegitarianEating[Vegitable],VegitarianEating[Carrot]都是合法的類型。而VegitarianEating[Beef]就不是一個合法的類型。類型VegitarianEating[Vegitable]是VegitarianEating的一個實例,同時它等價于類型Vegitarian.(我們用的是基于結構的subtype)
于是,我們有:
對任意F<:Vegitable,VegitarianEating[F]<:PersonEating[F]
對于原來的Vegitarian類型,我們有:
Vegetarian=VegetarianEating[Vegetable]<:PersonEating[Vegitable]
這種關系,正確地表達了“一個素食者是一個吃蔬菜的人”的概念。
除了BoundedTypeParameterization之外,還有一種類似的方法也可以解決這個素食者的問題。這種方法被叫做:BoundedAbstractType
請看這個定義:
ObjectTypePersonis
TypeF<:Food;
…
varlunch:F;
methodeat(food:F);
end;
ObjectTypeVegetarianis
TypeF<:Vegitable;
…
varlunch:F;
methodeat(food:F);
end;
這里,F(xiàn)<:Food的意思是,給定一個Person,我們知道他能吃某種Food,但我們不知道具體是哪一種。這個lunch的屬性提供這個Person所吃的Food.
在創(chuàng)建Person對象時,我們可以先選定一個Food的subtype,比如說,F(xiàn)=Dessert.然后,用一個Dessert類型的變量賦給屬性lunch.最后再實現(xiàn)一個eat(food:Dessert)的方法。
這樣,Vegetarian<:Person是安全的了。當你把一個Vegetarian當作一個Person處理時,這個Vegitarian可以安全地吃他自帶的午餐,即使你不知道他吃的是肉還是菜。
這種方法的局限在于,Person,Vegitarian只能吃他們自帶的午餐。你不能讓他們吃買來的午餐。
本站其他內容推薦
1、leaf yellowcake prepare majestic tea-table belief histrionics pediatrician ambit Cyrus
2、polyimide中文翻譯,polyimide是什么意思,polyimide發(fā)音、用法及例句
3、beardproject(beard project中文翻譯,beard project是什么意思,beard project發(fā)音、用法及例句)
4、progressing中文翻譯,progressing是什么意思,progressing發(fā)音、用法及例句
5、Goss是什么意思,Goss中文翻譯,Goss發(fā)音、用法及例句
6、reich是什么意思,reich中文翻譯,reich發(fā)音、用法及例句
7、beard是什么意思,beard中文翻譯,beard發(fā)音、用法及例句
10、插入的英文,英語,intromittent是什么意思,intromittent中文翻譯,intromittent怎么讀、發(fā)音、用法及例句
版權聲明: 本站僅提供信息存儲空間服務,旨在傳遞更多信息,不擁有所有權,不承擔相關法律責任,不代表本網贊同其觀點和對其真實性負責。如因作品內容、版權和其它問題需要同本網聯(lián)系的,請發(fā)送郵件至 舉報,一經查實,本站將立刻刪除。