[BACK]Return to CMO_TREE.java CVS log [TXT][DIR] Up to [local] / OpenXM / src / OpenMath / ORG / openxm / tam

Annotation of OpenXM/src/OpenMath/ORG/openxm/tam/CMO_TREE.java, Revision 1.3

1.1       tam         1: /**
1.3     ! ohara       2:  * $OpenXM: OpenXM/src/OpenMath/ORG/openxm/tam/CMO_TREE.java,v 1.2 2000/09/13 06:32:43 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:   }
1.3     ! ohara      51:
        !            52:     public boolean allowQ (int[] datacap) {
        !            53:                return CMO.allowQ_tag(datacap, DISCRIMINATOR())
        !            54:                        && leaves.allowQ(datacap);
        !            55:     }
1.1       tam        56:
1.2       tam        57:   public void sendByObject(OpenXMstream os)
1.1       tam        58:        throws IOException,MathcapViolation{
                     59:     new CMO_STRING(name).write(os);
                     60:     new CMO_STRING(cdname).write(os);
                     61:     leaves.write(os);
                     62:   }
                     63:
1.2       tam        64:   static protected CMO receive(OpenXMstream is) throws IOException{
1.1       tam        65:     String name,cdname;
                     66:     CMO_LIST leaves;
                     67:     CMO tmp;
                     68:
                     69:     tmp = CMO.receive(is);
                     70:     if(!(tmp instanceof CMO_STRING)){
                     71:       System.err.println("not CMOobject");
                     72:     }
                     73:     name = ((CMO_STRING)tmp).getString();
                     74:
                     75:     tmp = CMO.receive(is);
                     76:     if(!(tmp instanceof CMO_STRING)){
                     77:       System.err.println("not CMOobject");
                     78:     }
                     79:     cdname = ((CMO_STRING)tmp).getString();
                     80:
                     81:     tmp = CMO.receive(is);
                     82:     if(!(tmp instanceof CMO_LIST)){
                     83:       System.err.println("not CMOobject");
                     84:     }
                     85:     leaves = (CMO_LIST)tmp;
                     86:
                     87:     return new CMO_TREE(name,cdname,leaves);
                     88:   }
                     89:
                     90:   public String toCMOexpressionByObject(){
                     91:     return "CMO_TREE,"+ name +","+ cdname +","+ leaves.toCMOexpression();
                     92:   }
                     93: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>