Example #1
0
 public object OGetValue(AzLogFilterValue.ValueType vt, AzLogFilterValue.DataSource ds, AzLogEntry.LogColumn lc)
 {
     switch (ds)
         {
         case AzLogFilterValue.DataSource.Column:
             return m_mpColumnValue[lc];
         case AzLogFilterValue.DataSource.DttmStart:
             return m_dttmStart;
         case AzLogFilterValue.DataSource.DttmEnd:
             return m_dttmEnd;
         case AzLogFilterValue.DataSource.DttmRow:
             return m_dttmRow;
         }
     return null;
 }
Example #2
0
            public static void TestStringTypes(string sLHS, string sRHS, AzLogFilterCondition.CmpOp cmpop, bool fExpected)
            {
                AzLogFilterValue azlfvLHS = new AzLogFilterValue(sLHS);
                AzLogFilterValue azlfvRHS = new AzLogFilterValue(sRHS);

                Assert.AreEqual(fExpected, azlfvLHS.FEvaluate(cmpop, azlfvRHS, null));
            }
Example #3
0
            /* F  E V A L U A T E */
            /*----------------------------------------------------------------------------
                %%Function: FEvaluate
                %%Qualified: AzLog.AzLogFilter.AzLogFilterValue.FEvaluate
                %%Contact: rlittle

            ----------------------------------------------------------------------------*/
            public bool FEvaluate(AzLogFilterCondition.CmpOp cmpOp, AzLogFilterValue azlfvRHS, ILogFilterItem ilf)
            {
                int nCmp;
                bool fNoCase;

                cmpOp = CmpOpGenericFromCmpOp(cmpOp, out fNoCase);

                if (m_vt != azlfvRHS.m_vt)
                    throw new Exception("cannot evaluate dissimilar value types");

                if (m_vt == ValueType.String)
                    nCmp = System.String.Compare(this.String(ilf), azlfvRHS.String(ilf), fNoCase);
                else if (m_vt == ValueType.DateTime)
                    nCmp = DateTime.Compare(this.Dttm(ilf), azlfvRHS.Dttm(ilf));
                else
                    nCmp = 0;

                switch (cmpOp)
                    {
                    case AzLogFilterCondition.CmpOp.Eq:
                        return nCmp == 0;
                    case AzLogFilterCondition.CmpOp.SEq:
                        return nCmp == 0;
                    case AzLogFilterCondition.CmpOp.Ne:
                        return nCmp != 0;
                    case AzLogFilterCondition.CmpOp.SNe:
                        return nCmp == 0;
                    case AzLogFilterCondition.CmpOp.Gt:
                        return nCmp > 0;
                    case AzLogFilterCondition.CmpOp.Gte:
                        return nCmp >= 0;
                    case AzLogFilterCondition.CmpOp.Lt:
                        return nCmp < 0;
                    case AzLogFilterCondition.CmpOp.Lte:
                        return nCmp <= 0;
                    }

                return false;
            }
Example #4
0
            public static void TestDateTimeTypes(string sDttmLHS, string sDttmRHS, AzLogFilterCondition.CmpOp cmpop,
                bool fExpected)
            {
                AzLogFilterValue azlfvLHS = new AzLogFilterValue(DateTime.Parse(sDttmLHS));
                AzLogFilterValue azlfvRHS = new AzLogFilterValue(DateTime.Parse(sDttmRHS));

                Assert.AreEqual(fExpected, azlfvLHS.FEvaluate(cmpop, azlfvRHS, null));
            }
Example #5
0
            public static void TestDataSourceDttm()
            {
                TestAzLogFilterValueMock mock = new TestAzLogFilterValueMock();
                mock.m_dttmStart = DateTime.Parse("5/5/1995");
                mock.m_dttmEnd = DateTime.Parse("5/5/1995 3:00");
                mock.m_dttmRow = DateTime.Parse("5/5/1995 1:30");

                AzLogFilterValue azlfvLHS = new AzLogFilterValue(ValueType.DateTime, DataSource.DttmStart, AzLogEntry.LogColumn.Nil);

                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995")), mock));
                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/4/1995 19:00")), mock));
                Assert.AreEqual(false, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 1:00")), mock));
                Assert.AreEqual(false, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 3:00")), mock));
                Assert.AreEqual(false, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 4:00")), mock));

                azlfvLHS = new AzLogFilterValue(ValueType.DateTime, DataSource.DttmEnd, AzLogEntry.LogColumn.Nil);

                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995")), mock));
                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/4/1995 19:00")), mock));
                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 1:00")), mock));
                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 3:00")), mock));
                Assert.AreEqual(false, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 4:00")), mock));

                azlfvLHS = new AzLogFilterValue(ValueType.DateTime, DataSource.DttmRow, AzLogEntry.LogColumn.Nil);

                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995")), mock));
                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/4/1995 19:00")), mock));
                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 1:00")), mock));
                Assert.AreEqual(false, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 3:00")), mock));
                Assert.AreEqual(false, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue(DateTime.Parse("5/5/1995 4:00")), mock));
            }
Example #6
0
            public static void TestDataSourceColumn()
            {
                TestAzLogFilterValueMock mock = new TestAzLogFilterValueMock();
                mock.m_mpColumnValue = new Dictionary<AzLogEntry.LogColumn, string>();
                mock.m_mpColumnValue.Add(AzLogEntry.LogColumn.AppName, "TestValue");

                AzLogFilterValue azlfvLHS = new AzLogFilterValue(ValueType.String, DataSource.Column, AzLogEntry.LogColumn.AppName);

                Assert.AreEqual(true, azlfvLHS.FEvaluate(AzLogFilterCondition.CmpOp.Gte, new AzLogFilterValue("TestValue"), mock));
            }
Example #7
0
            /* _  I N I T */
            /*----------------------------------------------------------------------------
                %%Function: _Init
                %%Qualified: AzLog.AzLogFilter.AzLogFilterCondition._Init
                %%Contact: rlittle

            ----------------------------------------------------------------------------*/
            private void _Init(AzLogFilterValue.ValueType vt, AzLogFilterValue.DataSource dsLeft, AzLogEntry.LogColumn lc, CmpOp cmpop, DateTime dttmValueRight)
            {
                m_azlfvLHS = new AzLogFilterValue(vt, dsLeft, lc);
                m_azlfvRHS = new AzLogFilterValue(dttmValueRight);
                m_cmpop = cmpop;
            }
Example #8
0
            /* A Z  L O G  F I L T E R  C O N D I T I O N */
            /*----------------------------------------------------------------------------
                %%Function: AzLogFilterCondition
                %%Qualified: AzLog.AzLogFilter.AzLogFilterCondition.AzLogFilterCondition
                %%Contact: rlittle

            ----------------------------------------------------------------------------*/
            public AzLogFilterCondition(AzLogFilterValue.ValueType vt, AzLogFilterValue.DataSource dsLeft, AzLogEntry.LogColumn lc, CmpOp cmpop, DateTime dttmValueRight)
            {
                _Init(vt, dsLeft, lc, cmpop, dttmValueRight);
            }