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

Annotation of OpenXM/src/OpenMath/ORG/openxm/tam/CMO_LIST.java, Revision 1.2

1.1       tam         1: /**
1.2     ! tam         2:  * $OpenXM: OpenXM/src/OpenMath/ORG/openxm/tam/CMO_LIST.java,v 1.1 2000/09/12 07:05:06 tam Exp $
1.1       tam         3:  */
                      4: package ORG.openxm.tam;
                      5:
                      6: import java.io.*;
                      7:
                      8: /**
                      9:  * CMO $B7A<0$N(B LIST $B7?$rI=$7$^$9(B.
                     10:  */
                     11: final public class CMO_LIST extends CMO{
                     12:   private CMO ob[];
                     13:
                     14:   /**
                     15:    * CMO $BG[Ns(B src $B$rMWAG$H$9$k(B LIST $B$r:n@.$7$^$9(B.
                     16:    */
                     17:   public CMO_LIST(CMO[] src){
                     18:     ob = src;
                     19:   }
                     20:
                     21:   /**
                     22:    * $BMWAG$rF@$^$9(B.
                     23:    */
                     24:   public CMO[] getElements(){
                     25:     return ob;
                     26:   }
                     27:
                     28:   public int DISCRIMINATOR(){
                     29:     return CMO.LIST;
                     30:   }
                     31:
1.2     ! tam        32:   public void sendByObject(OpenXMstream os)
1.1       tam        33:        throws IOException,MathcapViolation{
                     34:     os.writeInt(ob.length);
                     35:
                     36:     for(int i=0;i<ob.length;i++){
                     37:       ob[i].write(os);
                     38:     }
                     39:   }
                     40:
1.2     ! tam        41:   static protected CMO receive(OpenXMstream is) throws IOException{
1.1       tam        42:     int len;
                     43:     CMO[] ob;
                     44:
                     45:     len = is.readInt();
                     46:     ob = new CMO[len];
                     47:
                     48:     for(int i=0;i<len;i++){
                     49:       ob[i] = CMO.receive(is);
                     50:     }
                     51:
                     52:     return new CMO_LIST(ob);
                     53:   }
                     54:
                     55:   public String toCMOexpressionByObject(){
                     56:     String str = "";
                     57:
                     58:     for(int i=0;i<ob.length;i++){
                     59:       //System.err.print(":"+ ob[i]);
                     60:       str += ","+ ob[i].toCMOexpression();
                     61:     }
                     62:
                     63:     return "CMO_LIST,"+ ob.length + str;
                     64:   }
                     65: }

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