using System; using System.Diagnostics; namespace SpaceInvaders { public abstract class Component : Visitor { //------------------------------------------------------------------- // FIELDS //------------------------------------------------------------------- public enum Type { Leaf, Composite, Error } public Type type; public Component pParent; public Component pReverse; //------------------------------------------------------------------- // CONSTRUCTION //------------------------------------------------------------------- public Component(Component.Type type) { this.type = type; this.pParent = null; this.pReverse = null; } //------------------------------------------------------------------- // PUBLIC METHODS //------------------------------------------------------------------- public virtual void Ressurect() { this.pParent = null; this.pReverse = null; } //------------------------------------------------------------------- // ABSTRACT METHODS //------------------------------------------------------------------- public abstract void AddComponent(Component c); public abstract void RemoveComponent(Component c); public abstract void PrintComponent(); public abstract void Move(float x, float y); } // end class } // end namespace