Пример #1
0
        public override string ToString()
        {
            StringWriter stringWriter = new StringWriter();
            PrintWriter  @out         = new PrintWriter(stringWriter, true);

            @out.printf("Now:%s \n", _now);
            @out.printf("Pending messages:%s \n", _messageDeliveries.Count);
            @out.printf("Pending timeouts:%s \n", TotalCurrentTimeouts());

            foreach (TestProtocolServer testProtocolServer in Participants.Values)
            {
                @out.println("  " + testProtocolServer);
            }
            return(stringWriter.ToString());
        }
Пример #2
0
 internal virtual void PrintProgress(int progress)
 {
     Out.print('.');
     if (progress % 20 == 0)
     {
         Out.printf(" %3d%%%n", progress / 2);
     }
 }
Пример #3
0
 internal virtual void WriteValues(Locale locale, long timestamp, string line, object[] values)
 {
     lock (this)
     {
         StreamSupplier.get();
         PrintWriter.printf(locale, string.format(locale, "%d,%s%n", timestamp, line), values);
         PrintWriter.flush();
     }
 }
Пример #4
0
        public RecordSetMD mReadMapFor(JniPMMLItem aJniPMMLItem, PrintWriter pw, Boolean bFillDictionaryNames)
        //throws com.WDataSci.WDS.WDSException
        {
            try {
                if (!this.Mode.bIn(RecordSetMDEnums.eMode.Input, RecordSetMDEnums.eMode.Internal))
                {
                    throw new WDSException("Error, wrong mode for RecordSetMD.mReadMapFor(JniPMML)!");
                }

                if (this.SchemaType.equals(RecordSetMDEnums.eSchemaType.XSD))
                {
                    this.SchemaMatter.mReadMapFor(this, aJniPMMLItem, pw, bFillDictionaryNames);
                }
                else if (this.SchemaType.equals(RecordSetMDEnums.eSchemaType.NamingConvention) && this.Type.isFlatFile())
                {
                    this.FileMatter.mReadMapFor(this, aJniPMMLItem, pw, bFillDictionaryNames);
                }
                else if (this.Type.equals(RecordSetMDEnums.eType.HDF5))
                {
                    this.HDF5Matter.mReadMapFor(this, aJniPMMLItem, pw, bFillDictionaryNames);
                }
                else if (this.Type.equals(RecordSetMDEnums.eType.DBB))
                {
                    this.DBBMatter.mReadMap(this, aJniPMMLItem, pw, bFillDictionaryNames);
                }

                if (pw != null)
                {
                    pw.printf("leaving RecordSetMD.mReadMapFor constructor\n");
                }
                if (pw != null)
                {
                    pw.flush();
                }
                return(this);
            }
            catch (Exception e) {
                throw new WDSException("Error in RecordSetMD.mReadMapFor", e);
            }
        }
Пример #5
0
        public void mReadMap(RecordSetMD aRecordSetMD, JniPMMLItem aJniPMML, PrintWriter pw, Boolean bFillDictionaryNames)
        //throws com.WDataSci.WDS.WDSException
        {
            try {
                int i  = -1;
                int ii = -1;
                int j  = -1;
                int jj = -1;
                int k  = -1;
                int kk = -1;


                //Java Boolean bUsingPMML = (aJniPMML != null && aJniPMML.PMMLMatter.Doc != null);
                //C#
                Boolean bUsingPMML = false;

                String[] lFieldStringNames = null;
                int      nDataFieldNames   = 0;
                if (bUsingPMML)
                {
                    lFieldStringNames = aJniPMML.PMMLDataFieldStringNames();
                    nDataFieldNames   = lFieldStringNames.Length;
                }

                if (pw != null)
                {
                    pw.printf("In RecordSetMD constructor\n");
                }
                if (pw != null)
                {
                    pw.flush();
                }

                //point to file or memory
                DBB buffer = this.Header.Buffer;
                buffer.position(0, 0, 0);

                try {
                    //get compound dataset information

                    long nColumns = buffer.nRecords;
                    long nBlockMaxStringByteLength = this.Header.MaxStringByteLength;

                    int nBlockCoreColumnSize = (int)(buffer.nRecordFLenBytes);
                    int nBlockAllocatedSize  = (int)(buffer.nDBBRequiredBytes);

                    if (nBlockAllocatedSize > this.Header.Buffer.Length)
                    {
                        throw new com.WDataSci.WDS.WDSException("Error, HeaderBuffer capacity, " + this.Header.Buffer.Length
                                                                + ", is less then what should be BlockAllocatedSize, " + nBlockAllocatedSize
                                                                );
                    }

                    int nBlockCoreSize = (int)(buffer.nDBBLeadingBytes + buffer.nDBBFLenBytes);

                    if (pw != null)
                    {
                        pw.printf("In RecordSetMD constructor, nColumns=%d\n", nColumns);
                    }
                    if (pw != null)
                    {
                        pw.flush();
                    }

                    byte[] namebuffer = new byte[(int)(nBlockMaxStringByteLength)];


                    //iterate through columns (dataset members)

                    aRecordSetMD.Column = new FieldMD[(int)(nColumns)];

                    int bptr = 0;

                    for (ii = 0; ii < nColumns; ii++, bptr += (int)nBlockCoreColumnSize)
                    {
                        buffer.position(buffer.ptr, bptr, buffer.vlenptr);

                        aRecordSetMD.Column[ii] = new FieldMD();
                        FieldMD col = aRecordSetMD.Column[ii];

                        //the first two fields are always names and taken to be variable length
                        col.Name = buffer.GetLayerVLenString(1, nBlockMaxStringByteLength);

                        //Check for PMML DataFieldName map
                        //If not mapped externally, the next VLenString pointer will be 0 and will come back as empty
                        String tmpname = buffer.GetLayerVLenString(1, nBlockMaxStringByteLength);

                        //Search for PMML DataFieldName map, take input supplied map first, then the usual search

                        /* Java >>> *
                         * Boolean found = false;
                         * if ( bUsingPMML && tmpname.length() > 0 ) {
                         *  for (j = 0; !found && j < nDataFieldNames; j++) {
                         *      if ( tmpname.equals(lFieldStringNames[j]) ) {
                         *          col.MapToMapKey(lFieldStringNames[j]);
                         *          found = true;
                         *          break;
                         *      }
                         *  }
                         * }
                         * if ( bUsingPMML && !found ) {
                         *  for (j = 0; !found && j < nDataFieldNames; j++) {
                         *      if ( col.Name.equals(lFieldStringNames[j]) ) {
                         *          col.MapToMapKey(lFieldNames[j]);
                         *          found = true;
                         *          break;
                         *      }
                         *  }
                         * }
                         * /* <<< Java */
                        if (!bUsingPMML && bFillDictionaryNames)
                        {
                            col.MapToMapKey(col.Name);
                        }

                        //Java col.DTyp = FieldMDEnums.eDTyp.FromInt(buffer.GetLayerInt(1));
                        //C#
                        col.DTyp = FieldMDExt.eDTyp_FromInt((int)buffer.GetLayerInt(1));

                        //See notes above on Date and DateTime types
                        //Since the header block is being passed in, Date and DateTime types are provided.

                        col.ByteMemLength = (long)buffer.GetLayerLong(1);
                        col.ByteMaxLength = (long)buffer.GetLayerLong(1);
                        if (col.DTyp.bIn(FieldMDEnums.eDTyp.VLS, FieldMDEnums.eDTyp.Str))
                        {
                            col.StringMaxLength = (int)(col.ByteMaxLength / 2);
                        }

                        //no longer using the last byte for bIsMappedToPMMLFieldName, so there is filler space at the end
                    }
                }
                catch (Exception e) {
                    throw new com.WDataSci.WDS.WDSException("Error in RecordSetMD processing of Header DBB:", e);
                }

                if (pw != null)
                {
                    pw.printf("leaving RecordSetMD constructor\n");
                }
                if (pw != null)
                {
                    pw.flush();
                }
            }
            catch (Exception e) {
                throw new com.WDataSci.WDS.WDSException("Error in ProcessInputMapFor", e);
            }
        }