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

File: [local] / OpenXM / src / OpenMath / ORG / openxm / tam / CMO_LIST.java (download)

Revision 1.2, Wed Sep 13 06:32:42 2000 UTC (23 years, 10 months ago) by tam
Branch: MAIN
CVS Tags: maekawa-ipv6, RELEASE_1_1_3
Changes since 1.1: +3 -3 lines

I changed from OpenXMconnection to OpenXMstream.

/**
 * $OpenXM: OpenXM/src/OpenMath/ORG/openxm/tam/CMO_LIST.java,v 1.2 2000/09/13 06:32:42 tam Exp $
 */
package ORG.openxm.tam;

import java.io.*;

/**
 * CMO $B7A<0$N(B LIST $B7?$rI=$7$^$9(B.
 */
final public class CMO_LIST extends CMO{
  private CMO ob[];

  /**
   * CMO $BG[Ns(B src $B$rMWAG$H$9$k(B LIST $B$r:n@.$7$^$9(B.
   */
  public CMO_LIST(CMO[] src){
    ob = src;
  }

  /**
   * $BMWAG$rF@$^$9(B.
   */
  public CMO[] getElements(){
    return ob;
  }

  public int DISCRIMINATOR(){
    return CMO.LIST;
  }

  public void sendByObject(OpenXMstream os)
       throws IOException,MathcapViolation{
    os.writeInt(ob.length);

    for(int i=0;i<ob.length;i++){
      ob[i].write(os);
    }
  }

  static protected CMO receive(OpenXMstream is) throws IOException{
    int len;
    CMO[] ob;

    len = is.readInt();
    ob = new CMO[len];

    for(int i=0;i<len;i++){
      ob[i] = CMO.receive(is);
    }

    return new CMO_LIST(ob);
  }

  public String toCMOexpressionByObject(){
    String str = "";

    for(int i=0;i<ob.length;i++){
      //System.err.print(":"+ ob[i]);
      str += ","+ ob[i].toCMOexpression();
    }

    return "CMO_LIST,"+ ob.length + str;
  }
}