Annotation of OpenXM/src/OpenMath/ORG/openxm/tam/CMO_TREE.java, Revision 1.2
1.1 tam 1: /**
1.2 ! tam 2: * $OpenXM: OpenXM/src/OpenMath/ORG/openxm/tam/CMO_TREE.java,v 1.1 2000/09/12 07:05:07 tam Exp $
1.1 tam 3: */
4: package ORG.openxm.tam;
5:
6: import java.io.*;
7:
8: /**
9: * CMO $B7A<0$N(B TREE $B7?$rI=$7$^$9(B.
10: * $B$3$l$O(B OpenMath $B$N(B Content Dictionary $B$GDj5A$5$l$F$$$k%*%V%8%'%/%H$r(B
11: * $BI=$9%/%i%9$G$9(B.
12: */
13: final public class CMO_TREE extends CMO{
14: private String name,cdname;
15: private CMO_LIST leaves;
16:
17: /**
18: * leaves $B$rMWAG$H$7(B cdname $B$GDj5A$5$l$F$$$k(B name $B$rI=$9(B TREE $B$r:n@.$7$^$9(B.
19: * $B%;%^%s%F%#%C%/%9$O%A%'%C%/$5$l$^$;$s(B.
20: */
21: public CMO_TREE(String name,String cdname,CMO_LIST leaves){
22: this.name = name;
23: this.cdname = cdname;
24: this.leaves = leaves;
25: }
26:
27: /**
28: * $BL>A0$rF@$^$9(B.
29: */
30: public String getName(){
31: return name;
32: }
33:
34: /**
35: * $BL>A0$,Dj5A$5$l$F$$$k(B CD $B$NL>A0$rF@$^$9(B.
36: */
37: public String getCDName(){
38: return cdname;
39: }
40:
41: /**
42: * $BMWAG$rF@$^$9(B.
43: */
44: public CMO_LIST getLeaves(){
45: return leaves;
46: }
47:
48: public int DISCRIMINATOR(){
49: return CMO.TREE;
50: }
51:
1.2 ! tam 52: public void sendByObject(OpenXMstream os)
1.1 tam 53: throws IOException,MathcapViolation{
54: new CMO_STRING(name).write(os);
55: new CMO_STRING(cdname).write(os);
56: leaves.write(os);
57: }
58:
1.2 ! tam 59: static protected CMO receive(OpenXMstream is) throws IOException{
1.1 tam 60: String name,cdname;
61: CMO_LIST leaves;
62: CMO tmp;
63:
64: tmp = CMO.receive(is);
65: if(!(tmp instanceof CMO_STRING)){
66: System.err.println("not CMOobject");
67: }
68: name = ((CMO_STRING)tmp).getString();
69:
70: tmp = CMO.receive(is);
71: if(!(tmp instanceof CMO_STRING)){
72: System.err.println("not CMOobject");
73: }
74: cdname = ((CMO_STRING)tmp).getString();
75:
76: tmp = CMO.receive(is);
77: if(!(tmp instanceof CMO_LIST)){
78: System.err.println("not CMOobject");
79: }
80: leaves = (CMO_LIST)tmp;
81:
82: return new CMO_TREE(name,cdname,leaves);
83: }
84:
85: public String toCMOexpressionByObject(){
86: return "CMO_TREE,"+ name +","+ cdname +","+ leaves.toCMOexpression();
87: }
88: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>