public void RegisterAlgorithm(StreamingAlgorithm <T> alg) { lock (this) { if (alg is StreamingUserAlgorithm <T> ) { if (!agent.ApplyUserLevel(alg.Epsilon)) { throw new Exception("PINQ access denied"); } } // otherwise, we will apply when we receive the data activeAlgorithms.Add(alg); } }
public void UnregisterAlgorithm(StreamingAlgorithm <T> alg) { lock (this) { if (alg is StreamingUserAlgorithm <T> ) { agent.UnapplyUserLevel(alg.Epsilon); } // otherwise, we will unapply after we receive the data if (processing) { toRemove.Add(alg); } else { activeAlgorithms.Remove(alg); } } }