Annotation of OpenXM/src/OpenMath/ORG/openxm/tam/CMO_DISTRIBUTED_POLYNOMIAL.java, Revision 1.1
1.1 ! tam 1: /**
! 2: * $OpenXM$
! 3: */
! 4: package ORG.openxm.tam;
! 5:
! 6: import java.io.*;
! 7:
! 8: /**
! 9: * CMO $B7A<0$N(B distributed polynomial $B7?$rI=$7$^$9(B.
! 10: */
! 11: final public class CMO_DISTRIBUTED_POLYNOMIAL extends CMO{
! 12: private CMO ring;
! 13: private CMO_MONOMIAL32[] monomials;
! 14:
! 15: /**
! 16: * $B4D(B ring $B>e$N(B MONOMIAL32 $B7?$NG[Ns(B monomials $B$r;}$DB?9`<0$r:n@.$7$^$9(B.
! 17: */
! 18: public CMO_DISTRIBUTED_POLYNOMIAL(CMO ring,CMO_MONOMIAL32[] monomials){
! 19: this.ring = ring;
! 20: this.monomials = monomials;
! 21: }
! 22:
! 23: public int DISCRIMINATOR(){
! 24: return CMO.DISTRIBUTED_POLYNOMIAL;
! 25: }
! 26:
! 27: public void sendByObject(OpenXMconnection os)
! 28: throws IOException,MathcapViolation{
! 29: if(monomials.length == 0){
! 30: os.writeInt(1);
! 31: ring.write(os);
! 32: new CMO_ZERO().write(os);
! 33: }else{
! 34: os.writeInt(monomials.length);
! 35: ring.write(os);
! 36: for(int i=0;i<monomials.length;i++){
! 37: monomials[i].write(os);
! 38: }
! 39: }
! 40: }
! 41:
! 42: static protected CMO receive(OpenXMconnection is) throws IOException{
! 43: CMO ring;
! 44: CMO_MONOMIAL32[] monomials;
! 45: CMO tmp;
! 46: int m;
! 47:
! 48: m = is.readInt();
! 49:
! 50: tmp = CMO.receive(is);
! 51: if(!(tmp instanceof CMO_DMS_GENERIC)){
! 52: System.err.println("not CMOobject");
! 53: }
! 54: ring = tmp;
! 55:
! 56: tmp = (CMO_MONOMIAL32)CMO.receive(is);
! 57: if(tmp instanceof CMO_ZERO && m == 1){
! 58: monomials = new CMO_MONOMIAL32[0];
! 59: }else{
! 60: monomials = new CMO_MONOMIAL32[m];
! 61: monomials[0] = (CMO_MONOMIAL32)tmp;
! 62: }
! 63:
! 64: for(int i=1;i<m;i++){
! 65: monomials[i] = (CMO_MONOMIAL32)CMO.receive(is);
! 66: }
! 67:
! 68: return new CMO_DISTRIBUTED_POLYNOMIAL(ring,monomials);
! 69: }
! 70:
! 71: public String toCMOexpressionByObject(){
! 72: String ret = "CMO_DISTRIBUTED_POLYNOMIAL,";
! 73:
! 74: if(monomials.length == 0){
! 75: ret += 1 +",";
! 76: ret += ring.toCMOexpression();
! 77: ret += ","+ new CMO_ZERO().toCMOexpression();
! 78: }else{
! 79: ret += monomials.length +",";
! 80: ret += ring.toCMOexpression();
! 81: for(int i=0;i<monomials.length;i++){
! 82: ret += ","+ monomials[i].toCMOexpression();
! 83: }
! 84: }
! 85:
! 86: return ret;
! 87: }
! 88:
! 89: /**
! 90: * $BB?9`<0$,Dj5A$5$l$F$$$k4D$rF@$^$9(B.
! 91: */
! 92: public CMO getRing(){
! 93: return ring;
! 94: }
! 95:
! 96: /**
! 97: * $BB?9`<0$N3F(B monomial $B$rF@$^$9(B.
! 98: */
! 99: public CMO_MONOMIAL32[] getMonomials(){
! 100: return monomials;
! 101: }
! 102: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>