Beispiel #1
0
        public Boolean SearchUp(int g, RabbitCommandMessage cmd)
        {
            Boolean res = false;

            if (_treeParentPair != null)
            {
                res = res || _treeParentPair.SearchUp(_treeGenderSide, cmd);
            }
            if (g == 1)
            {
                if (_treeChildFPair != null)
                {
                    res = res || _treeChildFPair.SearchDown(cmd);
                }
            }
            if (g == 2)
            {
                if (_treeChildMPair != null)
                {
                    res = res || _treeChildMPair.SearchDown(cmd);
                }
            }
            res = res || this.FemaleRabbit.SearchFromParent(cmd);
            res = res || this.MaleRabbit.SearchFromParent(cmd);
            if (SearchGoingOn != null)
            {
                res = res || SearchGoingOn(cmd);
            }
            return(res);
        }
Beispiel #2
0
 public Boolean SearchWindow(RabbitCommandMessage cmd)
 {
     if (cmd.SourceWindowRabbitID == _rabbitID)
     {
         return(false);
     }
     return(rabbitField1.SearchField(cmd));
 }
Beispiel #3
0
        /// <summary>Посылает сообщение поиска кролика в окна</summary>
        /// <param name="cmd">Комманда поиска</param>
        /// <see cref="RabbitCommandMessage"/>
        /// <returns></returns>
        public static Boolean BroadcastSearch(RabbitCommandMessage cmd)
        {
            Boolean res = false;

            foreach (KeyValuePair <int, GeneticsMainForm> f in _GenForms)
            {
                res = res || f.Value.SearchWindow(cmd);
            }
            return(res);
        }
Beispiel #4
0
 private void GeneticsMainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!_batchClose)
     {
         RabbitCommandMessage cmd = new RabbitCommandMessage();
         cmd.Command              = RabbitCommandMessage.Commands.ForgetWindow;
         cmd.TargetRabbitID       = 0;
         cmd.SourceWindowRabbitID = _rabbitID;
         GeneticsManager.BroadcastSearch(cmd);
         GeneticsManager.RemoveForm(_rabbitID);
     }
 }
Beispiel #5
0
 public void MeetNeighbors()
 {
     if (_rabbit != null)
     {
         RabbitCommandMessage cmd = new RabbitCommandMessage();
         cmd.Command              = RabbitCommandMessage.Commands.FindClone;
         cmd.TargetRabbitID       = _rabbit.ID;
         cmd.SourceWindowRabbitID = _windowRabbitID;
         if (_parentPair.SearchFromChild(cmd))
         {
             _duplicated = true;
             Redraw();
         }
     }
 }
Beispiel #6
0
 private void RabbitBar_Leave(object sender, EventArgs e)
 {
     _active = false;
     Redraw();
     if (_rabbit != null)
     {
         if (_parentPair != null)
         {
             RabbitCommandMessage cmd = new RabbitCommandMessage();
             cmd.Command              = RabbitCommandMessage.Commands.Unhighlight;
             cmd.TargetRabbitID       = _rabbit.ID;
             cmd.SourceWindowRabbitID = _windowRabbitID;
             _parentPair.SearchFromChild(cmd);
         }
     }
 }
Beispiel #7
0
        public Boolean SearchFromParent(RabbitCommandMessage cmd)
        {
            Boolean res = false;

            if (_rabbit != null)
            {
                if (cmd.TargetRabbitID == _rabbit.ID)
                {
                    if (cmd.Command == RabbitCommandMessage.Commands.Highlight)
                    {
                        _highlight = true;
                        Redraw();
                    }
                    if (cmd.Command == RabbitCommandMessage.Commands.Unhighlight)
                    {
                        _highlight = false;
                        Redraw();
                    }
                    if (cmd.Command == RabbitCommandMessage.Commands.FindClone)
                    {
                        _duplicated = true;
                        res         = true;
                        if (!_CommonWith.ContainsKey(cmd.SourceWindowRabbitID))
                        {
                            _CommonWith.Add(cmd.SourceWindowRabbitID, true);
                            Redraw();
                        }
                    }
                }
                if (cmd.Command == RabbitCommandMessage.Commands.ForgetWindow)
                {
                    _CommonWith.Remove(cmd.SourceWindowRabbitID);
                    _duplicated = (_CommonWith.Count > 0);
                    res         = true;
                    Redraw();
                }
            }
            return(res);
        }
Beispiel #8
0
        public Boolean SearchDown(RabbitCommandMessage cmd)
        {
            Boolean res = false;

            if (_treeChildFPair != null)
            {
                res = res || this._treeChildFPair.SearchDown(cmd);
            }
            if (_treeChildMPair != null)
            {
                res = res || this._treeChildMPair.SearchDown(cmd);
            }

            res = res || this.FemaleRabbit.SearchFromParent(cmd);
            res = res || this.MaleRabbit.SearchFromParent(cmd);
            if (SearchGoingOn != null)
            {
                res = res || SearchGoingOn(cmd);
            }

            return(res);
        }
Beispiel #9
0
        public Boolean SearchFromChild(RabbitCommandMessage cmd, bool evProc)
        {
            Boolean res = false;

            if (_treeParentPair != null)
            {
                res = res || this._treeParentPair.SearchUp(_treeGenderSide, cmd);
            }
            if ((evProc) && (SearchGoingOn != null))
            {
                res = res || SearchGoingOn(cmd);
            }
            if (_treeChildFPair != null)
            {
                res = res || this._treeChildFPair.SearchDown(cmd);
            }
            if (_treeChildMPair != null)
            {
                res = res || this._treeChildMPair.SearchDown(cmd);
            }
            return(res);
        }
Beispiel #10
0
 private bool rabbitField1_SearchGoingOn(RabbitCommandMessage cmd)
 {
     //			cmd.SourceRabbitID = _RabbitID;
     return(GeneticsManager.BroadcastSearch(cmd));
 }
Beispiel #11
0
 public Boolean SearchFromChild(RabbitCommandMessage cmd)
 {
     return(SearchFromChild(cmd, true));
 }