Exemplo n.º 1
0
            /* C L O N E */

            /*----------------------------------------------------------------------------
            *   %%Function: Clone
            *   %%Qualified: AzLog.AzLogFilter.AzLogFilterCondition.Clone
            *   %%Contact: rlittle
            *
            *   Return a deep clone of this filter condition
            *  ----------------------------------------------------------------------------*/
            public AzLogFilterCondition Clone()
            {
                AzLogFilterCondition azlfcNew = new AzLogFilterCondition();

                azlfcNew.m_azlfvLHS = m_azlfvLHS.Clone();
                azlfcNew.m_azlfvRHS = m_azlfvRHS.Clone();
                azlfcNew.m_cmpop    = m_cmpop;

                return(azlfcNew);
            }
Exemplo n.º 2
0
        public static void TestAzLogFilterDateRange(string sDttmRow, AzLogFilterCondition.CmpOp cmpop1, String sCmp1, AzLogFilterCondition.CmpOp cmpop2, string sCmp2,
            bool fExpected)
        {
            AzLogFilter azlf = new AzLogFilter();
            TestAzLogFilterValueMock mock = new TestAzLogFilterValueMock();
            mock.m_dttmRow = DateTime.Parse(sDttmRow);

            azlf.Add(new AzLogFilterCondition(AzLogFilterValue.ValueType.DateTime, AzLogFilterValue.DataSource.DttmRow, AzLogEntry.LogColumn.Nil, cmpop1, DateTime.Parse(sCmp1)));
            azlf.Add(new AzLogFilterCondition(AzLogFilterValue.ValueType.DateTime, AzLogFilterValue.DataSource.DttmRow, AzLogEntry.LogColumn.Nil, cmpop2, DateTime.Parse(sCmp2)));
            azlf.Add(AzLogFilterOperation.OperationType.And);

            Assert.AreEqual(fExpected, azlf.FEvaluate(mock));
        }
Exemplo n.º 3
0
            /* C M P  O P  G E N E R I C  F R O M  C M P  O P */
            /*----------------------------------------------------------------------------
                %%Function: CmpOpGenericFromCmpOp
                %%Qualified: AzLog.AzLogFilter.AzLogFilterValue.CmpOpGenericFromCmpOp
                %%Contact: rlittle

                get the generic compare operation (deals with case insensitive string
                variants by filling in fNoCase and returning the appropriate cmpop)
            ----------------------------------------------------------------------------*/
            private static AzLogFilterCondition.CmpOp CmpOpGenericFromCmpOp(AzLogFilterCondition.CmpOp cmpOp, out bool fNoCase)
            {
                fNoCase = (int) cmpOp >= (int) AzLogFilterCondition.CmpOp.SCaseInsensitiveFirst;

                if (fNoCase)
                    cmpOp = (AzLogFilterCondition.CmpOp) ((int) cmpOp - (int) AzLogFilterCondition.CmpOp.SCaseInsensitiveFirst);

                return cmpOp;
            }
Exemplo n.º 4
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;
            }
Exemplo n.º 5
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));
            }
Exemplo n.º 6
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));
            }
Exemplo n.º 7
0
            public static void TestCmpOpGenericFromCmpOp(AzLogFilterCondition.CmpOp cmpopIn, AzLogFilterCondition.CmpOp cmpopExpected, bool fNoCaseExpected)
            {
                bool fNoCase;

                Assert.AreEqual(cmpopExpected, AzLogFilterValue.CmpOpGenericFromCmpOp(cmpopIn, out fNoCase));
                Assert.AreEqual(fNoCaseExpected, fNoCase);
            }
Exemplo n.º 8
0
 public AzLogFilterOperation(OperationType lfo, AzLogFilterCondition azlfc)
 {
     m_lfo = lfo;
     m_azlfc = azlfc;
 }
Exemplo n.º 9
0
        /* A D D */
        /*----------------------------------------------------------------------------
            %%Function: Add
            %%Qualified: AzLog.AzLogFilter.Add
            %%Contact: rlittle

            Add a single log filter condition
        ----------------------------------------------------------------------------*/
        public void Add(AzLogFilterCondition azlfc)
        {
            InvalFilterID();
            m_plazlfo.Add(new AzLogFilterOperation(AzLogFilterOperation.OperationType.Value, azlfc));
        }
Exemplo n.º 10
0
 public AzLogFilterOperation(OperationType lfo, AzLogFilterCondition azlfc)
 {
     m_lfo   = lfo;
     m_azlfc = azlfc;
 }
Exemplo n.º 11
0
        /* A D D */

        /*----------------------------------------------------------------------------
        *       %%Function: Add
        *       %%Qualified: AzLog.AzLogFilter.Add
        *       %%Contact: rlittle
        *
        *   Add a single log filter condition
        *  ----------------------------------------------------------------------------*/
        public void Add(AzLogFilterCondition azlfc)
        {
            InvalFilterID();
            m_plazlfo.Add(new AzLogFilterOperation(AzLogFilterOperation.OperationType.Value, azlfc));
        }