/// <summary> /// Decodes the stream of L78 encoded data /// </summary> /// <returns></returns> public string Decode() { if (CompressorPairs.Count <= 0) { throw new Exception( $"{nameof(Lz78)} : {nameof(Decode)} : Method is not ready to decode, decode input is Empty or NULL"); } foreach (var pair in CompressorPairs) { if (pair.Index == 0) { DecoderList.Add(pair.Word); DecoderDictionary[DecodeIndex] = pair.Word; } else if (pair.Index > 0) { string w = DecoderDictionary[pair.Index]; DecoderList.Add($"{w}{pair.Word}"); DecoderDictionary[DecodeIndex] = $"{w}{pair.Word}"; } DecodeIndex += 1; } ExecTimes[1] = Timer.Elapsed; return(string.Join(string.Empty, DecoderList)); }
public WocketsController(string name, string filename, string description) { this._Name = name; this._Filename = filename; this._Description = description; this.savingEvent = new AutoResetEvent(false); this.waitToSaveEvent = new AutoResetEvent(false); this.pollingEvent = new AutoResetEvent(false); this.waitToPollEvent = new AutoResetEvent(false); this.classifyingEvent = new AutoResetEvent(false); this.trainingEvent = new AutoResetEvent(false); this._Decoders = new DecoderList(); this._Receivers = new ReceiverList(); this._Sensors = new SensorList(); }
public void Dispose() { #if (PocketPC) if (dataCollectionThread != null) { dataCollectionThread.Abort(); } if (interfaceActivityThread != null) { interfaceActivityThread.Abort(); } #endif if (aPollingThread != null) { aPollingThread.Abort(); } if (aSavingThread != null) { aSavingThread.Abort(); } if (trainingTW != null) { trainingTW.Flush(); trainingTW.Close(); trainingTW = null; } if (structureTW != null) { structureTW.Flush(); structureTW.Close(); structureTW = null; } for (int i = 0; (i < this._Receivers.Count); i++) { //this._Receivers[i]._Status = ReceiverStatus.Disconnected; //Thread.Sleep(100); if (this._Sensors[i]._Loaded) { this._Receivers[i].Dispose(); Thread.Sleep(1000); this._Receivers[i] = null; } } this._Receivers = null; for (int i = 0; (i < this._Sensors.Count); i++) { if (this._Sensors[i]._Loaded) { this._Sensors[i].Dispose(); this._Decoders[i].Dispose(); this._Sensors[i] = null; this._Decoders[i] = null; } } this._Sensors = null; this._Decoders = null; //NetworkStacks._BluetoothStack.Dispose(); }
public void Dispose() { #if (PocketPC) if (dataCollectionThread != null) dataCollectionThread.Abort(); if (interfaceActivityThread != null) interfaceActivityThread.Abort(); #endif if (aPollingThread != null) aPollingThread.Abort(); if (aSavingThread != null) aSavingThread.Abort(); if (trainingTW != null) { trainingTW.Flush(); trainingTW.Close(); trainingTW = null; } if (structureTW != null) { structureTW.Flush(); structureTW.Close(); structureTW = null; } for (int i = 0; (i < this._Receivers.Count); i++) { //this._Receivers[i]._Status = ReceiverStatus.Disconnected; //Thread.Sleep(100); if (this._Sensors[i]._Loaded) { this._Receivers[i].Dispose(); Thread.Sleep(1000); this._Receivers[i] = null; } } this._Receivers = null; for (int i = 0; (i < this._Sensors.Count); i++) if (this._Sensors[i]._Loaded) { this._Sensors[i].Dispose(); this._Decoders[i].Dispose(); this._Sensors[i] = null; this._Decoders[i] = null; } this._Sensors = null; this._Decoders = null; //NetworkStacks._BluetoothStack.Dispose(); }