Ejemplo n.º 1
0
        public override Moveable DeepCopy()
        {
            NotBlock copy = new NotBlock();

            if (slot1.Contents != null)
            {
                copy.slot1.Contents = slot1.Contents.DeepCopy();
            }
            return(copy);
        }
Ejemplo n.º 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);
        }