Example #1
0
        public Protect(Protect another)
        {
            formula = new ArrayList();
            warden = new ArrayList();
            Oid refOid = null;

            try
            {
                if (another.Oid != null)
                {
                    refOid = (Oid)another.Oid.Clone();
                }

                if (another.Formula != null)
                {
                    AssertFormula[] items = (AssertFormula[])another.Formula.Clone();
                    formula.Clear();
                    foreach (AssertFormula item in items)
                    {
                        formula.Add(new AssertFormula(item));
                    }
                }

                if (another.Warden != null)
                {
                    Warden[] items = (Warden[])another.Warden.Clone();
                    warden.Clear();
                    foreach (Warden item in items)
                    {
                        warden.Add(new Warden(item));
                    }
                }
            }
            catch (Exception e)
            {
                e.ToString();
            }

            oid = refOid;
        }
Example #2
0
        public override bool Equals(object o)
        {
            if (o == null || GetType() != o.GetType())
            {
                return false;
            }

            Protect other = new Protect((Protect)o);

            if (this.oid != null)
            {
                if (!this.Oid.Equals(other.Oid))
                {
                    return false;
                }
            }

            if (Formula.Length != other.Formula.Length)
            {
                return false;
            }

            for (int i = 0; i < Formula.Length; i++)
            {
                if (!Formula[i].Equals(other.Formula[i]))
                {
                    return false;
                }
            }

            if (Warden.Length != other.Warden.Length)
            {
                return false;
            }

            for (int i = 0; i < Warden.Length; i++)
            {
                if (!Warden[i].Equals(other.Warden[i]))
                {
                    return false;
                }
            }

            return true;
        }
Example #3
0
        public RuleML(RuleML another)
        {
            Oid refOid = null;
            Assert refAssert = null;
            Query refQuery = null;
            Protect refProtect = null;
            parent = new ArrayList();
            try
            {
                if (another.Assert != null)
                {
                    refAssert = (Assert)another.Assert.Clone();
                }

                if (another.Oid != null)
                {
                    refOid = (Oid)another.Oid.Clone();
                }

                if (another.Query != null)
                {
                    refQuery = (Query)another.Query.Clone();
                }

                if (another.Protect != null)
                {
                    refProtect = (Protect)another.Protect.Clone();
                }

                if (another.Parent != null)
                {
                    int[] items = (int[])another.Parent.Clone();
                    parent.Clear();
                    foreach (int item in items)
                    {
                        parent.Add(item);
                    }
                }
            }
            catch (Exception e)
            {
                e.ToString();
            }

            assert = refAssert;
            oid = refOid;
            protect = refProtect;
            query = refQuery;
            id = another.id;
        }