Пример #1
0
        public override Moveable DeepCopy()
        {
            AndBlock copy = new AndBlock();

            if (slot1.Contents != null)
            {
                copy.slot1.Contents = slot1.Contents.DeepCopy();
            }
            if (slot2.Contents != null)
            {
                copy.slot2.Contents = slot2.Contents.DeepCopy();
            }
            return(copy);
        }
Пример #2
0
        public virtual BooleanBlock GetBooleanBlock(XmlReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            reader.MoveToContent();

            string type = reader.GetAttribute("Type");

            if (String.IsNullOrEmpty(type))
            {
                throw new ArgumentException("Could not read Type attribute from XmlReader.", "reader");
            }

            BooleanBlock booleanBlock;

            if (type.EndsWith("OrBlock"))
            {
                booleanBlock = new OrBlock();
            }
            else if (type.EndsWith("AndBlock"))
            {
                booleanBlock = new AndBlock();
            }
            else if (type.EndsWith("NotBlock"))
            {
                booleanBlock = new NotBlock();
            }
            else
            {
                throw new ArgumentException("Did not recognise BooleanBlock of type " + type + ".", "reader");
            }

            booleanBlock.ReadXml(reader);

            return(booleanBlock);
        }