Beispiel #1
0
 /// <summary>
 /// Adds a new error to monitor in the pocket.
 /// </summary>
 /// <param name="error">The name of the error</param>
 public void AddError(string error)
 {
     if (!managers.ContainsKey(error))
     {
         managers[error] = new PocketManager(name, error);
     }
 }
Beispiel #2
0
        ///
        /// Returns the last update error for the network in the pocket or the
        /// MAX_VALUE of double if there is no network in the pocket.
        /// @param error The name of the error.
        /// @return The error.
        ///
        public double GetLastUpdateError(string error)
        {
            double        result  = Double.MaxValue;
            PocketManager manager = (PocketManager)managers[error];

            result = manager.GetLastUpdateError();
            return(result);
        }
Beispiel #3
0
        ///
        /// Return the epoch the pocket was updated.  A -1 is returned if there is
        /// no network in the pocket.
        /// @param error The name of the error.
        /// @return The epoch number.
        ///
        public int GetLastUpdateEpoch(string error)
        {
            int           result  = -1;
            PocketManager manager = (PocketManager)managers[error];

            result = manager.GetLastUpdateEpoch();
            return(result);
        }
Beispiel #4
0
 ///
 /// Closes named error, cleaning up the pocket.
 ///
 /// @param error The name of the error.
 ///
 public void CloseError(string error)
 {
     if (managers.ContainsKey(error))
     {
         PocketManager pm = (PocketManager)managers[error];
         pm.Cleanup();
         managers.Remove(error);
     }
 }
Beispiel #5
0
        ///
        /// Save the network to the pocket with the named error calculator.
        /// @param error The name of the error.
        /// @param network The network to save.
        /// @param trainer The trainer training the network.
        ///
        public void SaveNetwork(string error, Network network, Trainer trainer)
        {
            PocketManager manager = (PocketManager)managers[error];

            if (trainer.ErrorManager.GetError(error) < manager.GetLastUpdateError())
            {
                manager.SaveNetwork(network, trainer);
            }
        }
Beispiel #6
0
 public void OnCollisionEnter(Collision col)
 {
     Debug.Log(col.gameObject.name);
     if (col.gameObject.tag == "Ball" || col.gameObject.name == "CueBall")
     {
         PocketManager pMan = this.transform.parent.GetComponent <PocketManager>();
         pMan.BallPocketed(col.gameObject);
     }
 }
Beispiel #7
0
        ///
        /// Returns the contents of the pocket or null if there is no network in
        /// the pocket.
        /// @param error The name of the error.
        /// @return The network.
        ///
        public Network GetContents(string error)
        {
            Network result = null;

            if (managers.ContainsKey(error))
            {
                PocketManager pm = (PocketManager)managers[error];
                result = pm.GetNetwork();
            }
            return(result);
        }