示例#1
0
            /// <summary>
            /// Returns the first action of the given kind, between the processor and the processedObject.
            /// </summary>
            /// <param name="kind"></param>
            /// <param name="processor"></param>
            /// <param name="processedObject"></param>
            /// <returns></returns>
            public TradeAction GetFirst(TradeAction.Kind kind, Somebody processor, Something processedObject)
            {
                ICollection<Persistent> result = kind.FindMany("Processor = {0} AND ProcessedObject = {1}", new Object[] { processor, processedObject });
                TradeAction first = null;

                foreach (TradeAction action in result)
                {
                    if (first == null || action.When < first.When)
                    {
                        first = action;
                    }
                }

                return first;
            }
示例#2
0
            /// <summary>
            /// Returns the first action of the given kind, between the processor and the processedObjects.
            /// </summary>
            /// <param name="kind"></param>
            /// <param name="processor"></param>
            /// <param name="processedObjects"></param>
            /// <returns></returns>
            public TradeAction GetFirst(TradeAction.Kind kind, Somebody processor, ICollection processedObjects)
            {
                TradeAction first = null;

                foreach (Something processedObject in processedObjects)
                {
                    TradeAction action = GetFirst(kind, processor, processedObject);

                    if (first == null || action.When < first.When)
                    {
                        first = action;
                    }
                }

                return first;
            }
示例#3
0
 /// <summary>
 /// Returns the processor that was the last one to perform the TradeAction for the given objects.
 /// </summary>
 /// <param name="kind"></param>
 /// <param name="processedObjects"></param>
 /// <returns></returns>
 public Somebody GetLatestProcessor(TradeAction.Kind kind, ICollection processedObjects)
 {
     TradeAction latest = GetLatestForObjects(kind, processedObjects);
     return (latest != null) ? latest.Processor : null;
 }
示例#4
0
            /// <summary>
            /// Returns the latest action of the given kind, for the given processors.
            /// </summary>
            /// <param name="kind"></param>
            /// <param name="processors"></param>
            /// <returns></returns>
            public TradeAction GetLatestForProcessors(TradeAction.Kind kind, ICollection processors)
            {
                TradeAction latestForProcessors = null;

                foreach (Somebody processor in processors)
                {
                    TradeAction action = GetFirstForProcessor(kind, processor);

                    if (latestForProcessors == null || action.When > latestForProcessors.When)
                    {
                        latestForProcessors = action;
                    }
                }

                return latestForProcessors;
            }
示例#5
0
 /// <summary>
 /// Returns the processor that was the last one to perform the TradeAction for the given object.
 /// </summary>
 /// <param name="kind"></param>
 /// <param name="processedObject"></param>
 /// <returns></returns>
 public Somebody GetLatestProcessor(TradeAction.Kind kind, Something processedObject)
 {
     TradeAction latest = GetLatestForObject(kind, processedObject);
     return (latest != null) ? latest.Processor : null;
 }
示例#6
0
            /// <summary>
            /// Returns the latest action of the given kind, for the given processor.
            /// </summary>
            /// <param name="kind"></param>
            /// <param name="processor"></param>
            /// <returns></returns>
            public TradeAction GetLatestForProcessor(TradeAction.Kind kind, Somebody processor)
            {
                ICollection<Persistent> result = kind.FindMany("Processor = {0}", new Object[] { processor });
                TradeAction latest = null;

                foreach (TradeAction action in result)
                {
                    if (latest == null || action.When > latest.When)
                    {
                        latest = action;
                    }
                }

                return latest;
            }
示例#7
0
            /// <summary>
            /// Returns the latest action of the given kind, for the processedObjects.
            /// </summary>
            /// <param name="kind"></param>
            /// <param name="processedObjects"></param>
            /// <returns></returns>
            public TradeAction GetLatestForObjects(TradeAction.Kind kind, ICollection processedObjects)
            {
                TradeAction latest = null;

                foreach (Something processedObject in processedObjects)
                {
                    TradeAction action = GetLatestForObject(kind, processedObject);

                    if (latest == null || action.When > latest.When)
                    {
                        latest = action;
                    }
                }

                return latest;
            }
示例#8
0
 /// <summary>
 /// Returns the processedObject that was the first one on a TradeAction for the given processors.
 /// </summary>
 /// <param name="kind"></param>
 /// <param name="processors"></param>
 /// <returns></returns>
 public Something GetFirstProcessedObject(TradeAction.Kind kind, ICollection processors)
 {
     TradeAction first = GetFirstForObjects(kind, processors);
     return (first != null) ? first.ProcessedObject : null;
 }
示例#9
0
 /// <summary>
 /// Returns the processedObject that was the first one on a TradeAction for the given processor.
 /// </summary>
 /// <param name="kind"></param>
 /// <param name="processor"></param>
 /// <returns></returns>
 public Something GetFirstProcessedObject(TradeAction.Kind kind, Somebody processor)
 {
     TradeAction first = GetFirstForProcessor(kind, processor);
     return (first != null) ? first.ProcessedObject : null;
 }
示例#10
0
            /// <summary>
            /// Returns the first action of the given kind, for the given processors.
            /// </summary>
            /// <param name="kind"></param>
            /// <param name="processors"></param>
            /// <returns></returns>
            public TradeAction GetFirstForProcessors(TradeAction.Kind kind, ICollection processors)
            {
                TradeAction first = null;

                foreach (Somebody processor in processors)
                {
                    TradeAction action = GetFirstForProcessor(kind, processor);

                    if (first == null || action.When < first.When)
                    {
                        first = action;
                    }
                }

                return first;
            }