/// <summary>
        /// Process an entry.
        /// </summary>
        /// <param name="entry">The entry to process.</param>
        /// <param name="arg">The argument.</param>
        /// <returns>
        /// Processing result.
        /// </returns>
        public object Process(IMutableCacheEntry <int, int> entry, int arg)
        {
            if (!entry.Exists)
            {
                entry.Value = entry.Key * arg;
            }

            return(null);
        }
Beispiel #2
0
            public object Process(IMutableCacheEntry <string, long> e, object arg)
            {
                //get current count
                var val = e.Value;

                //increment count by 1
                e.Value = val == 0 ? 1L : val + 1;

                return(null);
            }
Beispiel #3
0
 public Artifact Process(IMutableCacheEntry <string, Artifact> entry, Artifact arg)
 {
     if (entry.Exists)
     {
         entry.Value = Merge(entry.Value, arg);
     }
     else
     {
         entry.Value = arg;
     }
     return(null);
 }
            public object Process(IMutableCacheEntry <int, IBinaryObject> entry, object arg)
            {
                // Create a builder from the old value
                var bldr = entry.Value.ToBuilder();

                //Update the field in the builder
                bldr.SetField("Name", "Ignite");

                // Set new value to the entry
                entry.Value = bldr.Build();

                return(null);
            }
            public FlowData Process(IMutableCacheEntry <FlowKey, FlowData> entry, FlowData arg)
            {
                if (entry.Exists)
                {
                    var flowUid = FlowUidGenerator.NewUid(entry.Key, Math.Min(entry.Value.FirstSeen, arg.FirstSeen));
                    entry.Value = Merge(entry.Value, arg, flowUid.ToString());
                }
                else
                {
                    entry.Value = arg;
                }

                return(null);
            }
Beispiel #6
0
        public bool Process(IMutableCacheEntry <INonSpatialAffinityKey, byte[]> entry, Guid arg)
        {
            ISurveyedSurfaces ss = DIContext.Obtain <ISurveyedSurfaces>();

            if (entry.Exists)
            {
                ss.FromBytes(entry.Value);
            }

            if (ss.RemoveSurveyedSurface(arg))
            {
                entry.Value = ss.ToBytes();
                return(true);
            }

            return(false);
        }
Beispiel #7
0
        public bool Process(IMutableCacheEntry <INonSpatialAffinityKey, byte[]> entry, ISurveyedSurface arg)
        {
            try
            {
                ISurveyedSurfaces ss = DIContext.Obtain <ISurveyedSurfaces>();
                if (entry.Exists)
                {
                    ss.FromBytes(entry.Value);
                }

                ss.AddSurveyedSurfaceDetails(arg.ID, arg.Get_DesignDescriptor(), arg.AsAtDate, arg.Extents);

                entry.Value = ss.ToBytes();

                return(true);
            }
            catch
            {
                throw; // return false;
            }
        }
Beispiel #8
0
        /** <inheritdoc /> */
        int ICacheEntryProcessor <int, int, int, int> .Process(IMutableCacheEntry <int, int> entry, int arg)
        {
            if (ThrowOnKey < 0 || ThrowOnKey == entry.Key)
            {
                if (ThrowErr)
                {
                    throw new Exception(ExceptionText);
                }

                if (ThrowErrBinarizable)
                {
                    throw new BinarizableTestException {
                              Info = ExceptionText
                    }
                }
                ;

                if (ThrowErrNonSerializable)
                {
                    throw new NonSerializableException();
                }
            }

            Assert.AreEqual(Exists, entry.Exists);

            if (Remove)
            {
                entry.Remove();
            }
            else
            {
                entry.Value = entry.Value + arg;
            }

            return(entry.Value);
        }
 public int Process(IMutableCacheEntry <int, int> entry, int arg)
 {
     entry.Value += arg;
     return(arg);
 }
Beispiel #10
0
            /** <inheritdoc /> */
            public int Process(IMutableCacheEntry <int, int> entry, int arg)
            {
                entry.Value = entry.Key + 1;

                return(0);
            }
Beispiel #11
0
        /// <summary>
        /// Process an entry.
        /// </summary>
        /// <param name="entry">The entry to process.</param>
        /// <param name="arg">The argument.</param>
        /// <returns>
        /// Processing result.
        /// </returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public object Process(IMutableCacheEntry <int, int> entry, int arg)
        {
            entry.Value += arg;

            return(null);
        }
Beispiel #12
0
            public object Process(IMutableCacheEntry <string, long> e, object arg)
            {
                e.Value++;

                return(null);
            }
 /** <inheritdoc /> */
 public int Process(IMutableCacheEntry <int, int> entry, int arg)
 {
     return(arg);
 }
Beispiel #14
0
 /** <inheritdoc /> */
 public int Process(IMutableCacheEntry <int, int> entry, int arg)
 {
     throw new Exception("Invalid method");
 }
Beispiel #15
0
            public int Process(IMutableCacheEntry <int, int> entry, int arg)
            {
                var value = entry.Exists ? arg : entry.Value + arg;

                return(entry.Value);
            }