public override bool Equals(Object other)
 {
     if (other != null && other is SyncQuark)
     {
         SyncQuark sq = other as SyncQuark;
         return((this.m_quarkLocX == sq.m_quarkLocX) && (this.m_quarkLocY == sq.m_quarkLocY));
     }
     return(false);
 }
        private void RegisterActor(XMLQuarkSubscription sub, bool isRoot)
        {
            HashSet <string> activeQuarks  = SyncQuark.DecodeSyncQuarks(sub.activeQuarks);
            HashSet <string> passiveQuarks = SyncQuark.DecodeSyncQuarks(sub.passiveQuarks);
            QuarkPublisher   qp;

            // Save SyncID to XMLQuarkSubscription, if we need the info later
            if (m_actor.ContainsKey(sub.actorID))
            {
                UnRegisterActor(sub.actorID);
            }
            if (isRoot)
            {
                RootInfo root = new RootInfo();
                root.quarkAddress = sub.rootAddress;
                root.syncAddress  = sub.syncListenerAddress;
                root.Roots.Add(root);
                m_actor[sub.actorID] = root;
                m_rootActors.Add((RootInfo)m_actor[sub.actorID]);
            }
            else
            {
                if (sub.syncListenerAddress.Length > 0)
                {
                    RelayActor relActor = new RelayActor();
                    relActor.syncAddress = sub.syncListenerAddress;
                    m_actor[sub.actorID] = relActor;
                }
                else
                {
                    Actor actor = new Actor();
                    m_actor[sub.actorID] = actor;
                }
                // Note: Adding all the roots as this actor's root for now.
                foreach (RootInfo root in m_rootActors)
                {
                    m_actor[sub.actorID].Roots.Add(root);
                }
            }
            m_actor[sub.actorID].ActiveQuarks  = activeQuarks;
            m_actor[sub.actorID].PassiveQuarks = passiveQuarks;

            m_actor[sub.actorID].XmlSubscription = sub;

            foreach (string quark in activeQuarks)
            {
                if (!QuarkSubscriptions.TryGetValue(quark, out qp))
                {
                    qp = new QuarkPublisher(new SyncQuark(quark));
                    QuarkSubscriptions.Add(quark, qp);
                }
                qp.AddActiveSubscriber(sub.actorID);
                if (isRoot)
                {
                    qp.SetRootActor(sub.actorID);
                }
            }

            foreach (string quark in passiveQuarks)
            {
                if (!QuarkSubscriptions.TryGetValue(quark, out qp))
                {
                    qp = new QuarkPublisher(new SyncQuark(quark));
                    QuarkSubscriptions.Add(quark, qp);
                }
                qp.AddPassiveSubscriber(sub.actorID);
            }
        }
 public QuarkPublisher(SyncQuark quark)
 {
     m_quarkName = quark.QuarkName;
     m_quark     = quark;
 }