/// <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); } }
/// /// 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); }
/// /// 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); }
/// /// 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); } }
/// /// 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); } }
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); } }
/// /// 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); }