virtual public void SetState(SymbolState nextState, bool useOverlap = true) { if (useOverlap == false && _currentState == nextState) { return; } _currentState = nextState; switch (_currentState) { case SymbolState.Null: Reset(); break; case SymbolState.Idle: Idle(); break; case SymbolState.Spin: Spin(); break; case SymbolState.Stop: Stop(); break; case SymbolState.Scatter: Scatter(); break; case SymbolState.Trigger: Trigger(); break; case SymbolState.Win: Win(); break; case SymbolState.Fix: Fix(); break; } }
public bool VerifyState(BrokerState expectedBrokerState, SymbolState expectedSymbolState, int timeout) { if (debug) { log.Debug("VerifyState broker " + expectedBrokerState + ", symbol " + expectedSymbolState + ", timeout " + timeout); } long startTime = Factory.TickCount; count = 0; TickBinary binary = new TickBinary(); while (Factory.TickCount - startTime < timeout * 1000) { if (propagateException != null) { throw propagateException; } try { if (!TryDequeueTick(ref binary)) { if (SyncTicks.Enabled && symbolState == SymbolState.RealTime) { tickSync.RemoveTick(ref binary); } } else { Thread.Sleep(100); } } catch (QueueException ex) { if (HandleQueueException(ex)) { break; } } if (brokerState == expectedBrokerState && symbolState == expectedSymbolState) { return(true); } } return(false); }
void AlignSymbols(float offsetY = 0f, SymbolState state = SymbolState.Null) { var ypos = GetStartSymbolPos(); var len = _symbols.Count; for (var i = 0; i < len; ++i) { var symbol = _symbols[i]; symbol.Y = ypos; ypos -= symbol.Height; if (state != SymbolState.Null) { symbol.SetState(state); } } _symbolContainer.localPosition = new Vector3(0f, offsetY, 0f); }
/// <summary> /// Only runs if the symbol state is SystemSymbol. Basically this will write the version marker, /// write all imported table names, and move to the local symbols /// </summary> /// <param name="writeIvm">Whether to write the Ion version marker</param> private void StartLocalSymbolTableIfNeeded(bool writeIvm) { if (_symbolState != SymbolState.SystemSymbols) { return; } if (writeIvm) { _symbolsWriter.WriteIonVersionMarker(); } _symbolsWriter.AddTypeAnnotationSymbol(Symbols.GetSystemSymbol(SystemSymbols.IonSymbolTableSid)); _symbolsWriter.StepIn(IonType.Struct); // $ion_symbol_table:{} if (_importContext.Parents.Length > 0) { _symbolsWriter.SetFieldNameSymbol(Symbols.GetSystemSymbol(SystemSymbols.ImportsSid)); _symbolsWriter.StepIn(IonType.List); // $imports: [] foreach (var importedTable in _importContext.Parents) { _symbolsWriter.StepIn(IonType.Struct); // {name:'a', version: 1, max_id: 33} _symbolsWriter.SetFieldNameSymbol(Symbols.GetSystemSymbol(SystemSymbols.NameSid)); _symbolsWriter.WriteString(importedTable.Name); _symbolsWriter.SetFieldNameSymbol(Symbols.GetSystemSymbol(SystemSymbols.VersionSid)); _symbolsWriter.WriteInt(importedTable.Version); _symbolsWriter.SetFieldNameSymbol(Symbols.GetSystemSymbol(SystemSymbols.MaxIdSid)); _symbolsWriter.WriteInt(importedTable.MaxId); _symbolsWriter.StepOut(); } _symbolsWriter.StepOut(); // $imports: [] } _symbolState = SymbolState.LocalSymbolsWithImportsOnly; }
/// <summary> /// sets volume symbols /// use VolumeID enum and SymbolState enum as argument /// </summary> /// <param name="volumeid">id of volume symbol</param> /// <param name="symbolstate">symbol state</param> public void SetVolume(VolumeID volumeid, SymbolState symbolstate) { //create handle for datagram Byte[] btDatagram = new Byte[64]; try { //create datagram btDatagram[0x00] = 0x04; //count of successive bytes btDatagram[0x01] = 0x1b; //header (fix value) btDatagram[0x02] = 0x30; //command: set a symbol btDatagram[0x03] = Convert.ToByte(volumeid); //ID of volume symbol btDatagram[0x04] = Convert.ToByte(symbolstate); //required state of symbol //send command SendCommand(btDatagram); } catch (Exception ex) { throw new Exception("Setting volume symbol failed: ", ex); } }
public void Init() { _thisState = SymbolState.Close; GetValue(); }