Beispiel #1
0
        // ----------------------------------------------------------------------------------------
        /// <!-- SetFieldExactly -->
        /// <summary>
        ///
        /// </summary>
        /// <param name="enSet"></param>
        /// <param name="endeme"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public EndemeItem SetFieldExactly(EndemeSet enSet, Endeme endeme, object value)
        {
            EndemeItem item = null;

            // --------------------------------------------------------------------------
            //  Preprocess the endeme
            // --------------------------------------------------------------------------
            if (endeme == null)
            {
                return(null);
            }
            else
            {
                if (endeme.EnSet == null)
                {
                    endeme.EnSet = enSet;
                }
                if (endeme.EnSet != enSet)
                {
                    throw new Exception("boom");
                }


                // ----------------------------------------------------------------------
                //  Figure out what value to store and where to store the value
                // ----------------------------------------------------------------------
                item = this.ExactlyLike(endeme);
                if (item == null)
                {
                    item = this.Add("", enSet, endeme, EndemeItem.Simple(new EndemeValue(value)));
                }
                else
                {
                    item.Item = EndemeItem.Simple(new EndemeValue(value));
                }


                //string str = AsciiValue;
            }

            return(item);
        }
Beispiel #2
0
        // ----------------------------------------------------------------------------------------
        /// <!-- SetField -->
        /// <summary>
        ///
        /// </summary>
        /// <param name="key1"></param>
        /// <param name="key2"></param>
        /// <param name="value"></param>
        public void SetField(EndemeSet enSet, Endeme endeme, object value)
        {
            // --------------------------------------------------------------------------
            //  Preprocess the endeme
            // --------------------------------------------------------------------------
            if (endeme == null)
            {
                return;  // storage location not definced
            }
            else
            {
                if (endeme.EnSet == null)
                {
                    endeme.EnSet = enSet;
                }
                if (endeme.EnSet != enSet)
                {
                    throw new Exception("error- storage endeme has wrong endeme set");
                }


                // ----------------------------------------------------------------------
                //  Figure out what value to store and where to store the value
                // ----------------------------------------------------------------------
                EndemeItem item = this.MostLike(endeme);
                if (item == null || item.TempMatch < this.EqualityThreshold)
                {
                    item = this.Add("", enSet, endeme, EndemeItem.Simple(new EndemeValue(value)));
                }
                else
                {
                    item.Item = EndemeItem.Simple(new EndemeValue(value));
                }


                //string str = AsciiValue;
            }
        }