public static byte Edge_CallMsgCount(Factorable obj, Dataset dataset)
        {
            Edge e = obj as Edge;

            if (e == null)
            {
                return(0);
            }

            List <CallInfo> callInfo = dataset.InquiryData <List <CallInfo> >(new ArrayList {
                e.From.Attribute[MobileAttribute.UserId],
                e.To.Attribute[MobileAttribute.UserId]
            });
            List <MessageInfo> msgInfo = dataset.InquiryData <List <MessageInfo> >(new ArrayList {
                e.From.Attribute[MobileAttribute.UserId],
                e.To.Attribute[MobileAttribute.UserId]
            });

            Int64 callCount = dataset.InquiryDataWithMethod <List <Int64> >(new ArrayList(),
                                                                            MobileDataset.FetchAllCallInfoCount_List)[0];
            Int64 msgCount = dataset.InquiryDataWithMethod <List <Int64> >(new ArrayList(),
                                                                           MobileDataset.FetchAllMessageInfoCount_List)[0];

            double result = (callInfo == null ? 0 : callInfo.Count) +
                            (msgInfo == null ? 0 : msgInfo.Count);

            return(Bytelize(result, (callCount + msgCount) / 10));
        }
        public static byte Edge_CallMsgFrequency_Hour(Factorable obj, Dataset dataset, int hour)
        {
            Edge e = obj as Edge;

            if (e == null)
            {
                return(0);
            }

            List <CallInfo> callInfo = dataset.InquiryData <List <CallInfo> >(new ArrayList {
                e.From.Attribute[MobileAttribute.UserId],
                e.To.Attribute[MobileAttribute.UserId]
            });
            List <MessageInfo> msgInfo = dataset.InquiryData <List <MessageInfo> >(new ArrayList {
                e.From.Attribute[MobileAttribute.UserId],
                e.To.Attribute[MobileAttribute.UserId]
            });

            int callCount     = callInfo.Count;
            int msgCount      = msgInfo.Count;
            int callHourCount = callInfo.Count(x => x.CALL_TIME.Hour == hour);
            int msgHourCount  = msgInfo.Count(x => x.MSG_TIME.Hour == hour);

            double result = callHourCount + msgHourCount;

            return(Bytelize(result, callCount + msgCount));
        }
Beispiel #3
0
        public void RegisterFactoryClass07Test()
        {
            // When registering IFactorable, but constructing Factorable, the registration
            // is ignored (as IFactorable != Factorable), and we get a regular Factorable back:

            ObjectFactory.Instance.RegisterFactoryClass(typeof(IFactorable), typeof(FactorableSub));

            Factorable f = ObjectFactory.Instance.Construct <Factorable>(12);

            Assert.IsInstanceOfType(f, typeof(Factorable));
            Assert.IsNotInstanceOfType(f, typeof(FactorableSub));
            Assert.AreEqual(12, f.Value);
        }