示例#1
0
        public bool addData(String timestamp, String field, Object value)
        {
            if (_fields < MAX_MESSAGE_FIELDS)
            {
                // Add data to this NgestMessage
                TimeSeriesDataObject t;

                // Does a TimeSeriesDataObject exist at this timestamp in this message?
                try
                {
                    t = _data[timestamp];
                } catch (KeyNotFoundException e)
                {
                    // No, create one and insert it at the correct timestamp
                    t = new TimeSeriesDataObject();

                    _data[timestamp] = t;
                }

                t.addValue(field, value);

                _fields++;

                // Indicate data accepted
                return(true);
            }
            else
            {
                // Indicate data not accepted
                return(false);
            }
        }
        public bool addData(String timestamp, String field, Object value)
        {
            if (_fields < MAX_MESSAGE_FIELDS)
            {
                // Add data to this NgestMessage
                TimeSeriesDataObject t;

                // Does a TimeSeriesDataObject exist at this timestamp in this message?
                try
                {
                    t = _data[timestamp];
                } catch (KeyNotFoundException e)
                {
                    // No, create one and insert it at the correct timestamp
                    t = new TimeSeriesDataObject();

                    _data[timestamp] = t;

                }

                t.addValue(field, value);

                _fields++;

                // Indicate data accepted
                return true;
            }
            else
            {
                // Indicate data not accepted
                return false;
            }

        }