Annotation of OpenXM/src/OpenMath/ORG/openxm/tam/CMO_LIST.java, Revision 1.3
1.1 tam 1: /**
1.3 ! ohara 2: * $OpenXM: OpenXM/src/OpenMath/ORG/openxm/tam/CMO_LIST.java,v 1.2 2000/09/13 06:32:42 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: }
1.3 ! ohara 31:
! 32: public boolean allowQ (int[] datacap) {
! 33: if(CMO.allowQ_tag(datacap, DISCRIMINATOR())) {
! 34: for (int j=0; j < ob.length; j++) {
! 35: if (!ob[j].allowQ(datacap)) {
! 36: return false;
! 37: }
! 38: }
! 39: return true;
! 40: }
! 41: return false;
! 42: }
1.1 tam 43:
1.2 tam 44: public void sendByObject(OpenXMstream os)
1.1 tam 45: throws IOException,MathcapViolation{
46: os.writeInt(ob.length);
47:
48: for(int i=0;i<ob.length;i++){
49: ob[i].write(os);
50: }
51: }
52:
1.2 tam 53: static protected CMO receive(OpenXMstream is) throws IOException{
1.1 tam 54: int len;
55: CMO[] ob;
56:
57: len = is.readInt();
58: ob = new CMO[len];
59:
60: for(int i=0;i<len;i++){
61: ob[i] = CMO.receive(is);
62: }
63:
64: return new CMO_LIST(ob);
65: }
66:
67: public String toCMOexpressionByObject(){
68: String str = "";
69:
70: for(int i=0;i<ob.length;i++){
71: //System.err.print(":"+ ob[i]);
72: str += ","+ ob[i].toCMOexpression();
73: }
74:
75: return "CMO_LIST,"+ ob.length + str;
76: }
77: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>