コード例 #1
0
ファイル: AndOperator.cs プロジェクト: maorRoz/Sadna
        private bool Equals(AndOperator obj)
        {
            bool answer = true;

            if (_cond1 == null)
            {
                answer = answer && (obj._cond1 == null);
            }
            if (_cond2 == null)
            {
                answer = answer && (obj._cond2 == null);
            }
            if (Subject == null)
            {
                answer = answer && (obj.Subject == null);
            }
            if (_cond1 != null)
            {
                answer = answer && (_cond1.Equals(obj._cond1));
            }
            if (_cond2 != null)
            {
                answer = answer && (_cond2.Equals(obj._cond2));
            }
            if (Subject != null)
            {
                answer = answer && (Subject.Equals(obj.Subject));
            }
            answer = answer && obj.ID.Equals(ID) && obj.Type.Equals(Type);
            return(answer);
        }
コード例 #2
0
ファイル: PolicyHandler.cs プロジェクト: maorRoz/Sadna
        private PurchasePolicy CreatePolicy(PolicyType type, string subject, OperatorType op, int id1, int id2)
        {
            PurchasePolicy policy = null;

            switch (op)
            {
            case OperatorType.AND:
                policy = new AndOperator(type, subject, GetPolicy(id1), GetPolicy(id2), SessionPolicies.Count);
                break;

            case OperatorType.OR:
                policy = new OrOperator(type, subject, GetPolicy(id1), GetPolicy(id2), SessionPolicies.Count);
                break;

            case OperatorType.NOT:
                policy = new NotOperator(type, subject, GetPolicy(id1), null, SessionPolicies.Count);
                break;
            }
            SessionPolicies.Add(policy);
            return(policy);
        }