private void InstallComponent() { if (InstallationManager.selectedPrefab != null) { if (ComponentIsAttached()) { Destroy(MachineBuilder.componentGrid[nodePosition]); MachineBuilder.componentGrid.Remove(nodePosition); } // Only gears are permitted if the node is restricted if (restrictedInstallation && InstallationManager.selectedPrefab.transform.tag != "GearBit") { return; } attachedComponent = Instantiate(InstallationManager.selectedPrefab, componentContainer.transform); attachedComponent.name = InstallationManager.selectedPrefab.ToString(); // Y position is component type-specific attachedComponent.transform.position = new Vector3( transform.position.x, transform.position.y + InstallationManager.GetYDelta(), 0f); MachineBuilder.componentGrid.Add(nodePosition, attachedComponent); Debug.Log(MachineBuilder.LogComponentGrid()); occupied = true; } }
private static Func <IUser> CreateMachineFactory(Func <LegalEntity> ownerFactory) => MachineBuilder .Machine() .WithProducer(new Producer()) .WithModel("fast-one") .OwnedBy(ownerFactory()) .Build;
private void Init() { var builder = new MachineBuilder(); _machine = builder.Build(); _machine.Locations["A1"].Stock(_cokeCan); }
static void Main(string[] args) { var typedValue = string.Empty; var machineBuilder = new MachineBuilder(); var kAlphabet = new Alphabet(alphabet); var keyboard = new Keyboard(kAlphabet); var monitor = new Monitor(); Machine machine = machineBuilder.Monitor.SetMonitor(monitor).Keyboard.SetKeyboard(keyboard); while (true) { var stations = StationFilter.GetStationsByTypedValue(typedValue); machine.SetAddition("station", stations.Stations); keyboard.Filter(string.Join(string.Empty, stations.NextCharacteres)); Console.WriteLine("TICKET MACHINE"); Console.WriteLine(); Console.WriteLine(machine); Console.WriteLine("Enter the Station Name : "); typedValue = Console.ReadLine(); keyboard.Alphabet = new Alphabet(alphabet); Console.WriteLine(typedValue); Console.Clear(); } }
private void RegexButton_OnClick(object sender, RoutedEventArgs e) { try { if (string.IsNullOrEmpty(RegexTextBox.Text)) { MessageBox.Show("Строка пустая!"); } else { GrammarRichTextBox.Document.Blocks.Clear(); MainPanel.Children.Clear(); Regex rgx = new Regex(RegexTextBox.Text); var builder = new MachineBuilder(); var detBuilder = new DetermMachineBuilder(); var FSM = detBuilder.Build(builder.Build(rgx)); DetermFSM = FSM; GraphBuilder graphBuilder = new GraphBuilder(MainPanel, 50, 50); Graph = graphBuilder.BuildGraph(FSM, 300, 300, 200); var startState = Graph.Vertices.First(v => v.State == FSM.StartState); ScrollViewer.ScrollToHorizontalOffset(Canvas.GetTop(startState) - (Width - ScrollViewer.Margin.Right) / 2); ScrollViewer.ScrollToVerticalOffset(Canvas.GetLeft(startState) - Height / 2); if (DetermFSM.IsFinalState(DetermFSM.StartState)) { CheckImage.Source = new BitmapImage(new Uri("Images/true.png", UriKind.RelativeOrAbsolute)); } else { CheckImage.Source = new BitmapImage(new Uri("Images/wrong.png", UriKind.RelativeOrAbsolute)); } InitiateGrammarTextBox(); CheckWordButton.IsEnabled = true; CheckWordTempTextBox.IsEnabled = true; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
static void Main(string[] args) { Regex rgx = new Regex("(a|b)*"); var builder = new MachineBuilder(); var fsm = builder.Build(rgx); var newFsm = GetDmk1kFSM(); var detBuilder = new DetermMachineBuilder(); var det = detBuilder.Build(newFsm); var det2 = detBuilder.Build(fsm); var another = GetAnotherFSM(); var det1 = detBuilder.Build(another); Console.WriteLine(det.GetAsRegularGrammar()); Console.WriteLine("abba is" + det2.CheckWord("abba")); Console.WriteLine("abbab is" + det2.CheckWord("abbab")); Console.ReadKey(); }
private void Init() { var builder = new MachineBuilder(); _machine = builder.Build(); }
public void setup() { _builder = new MachineBuilder(); _proxyListBuilderMock = new Mock <MachineProxyListBuilder>(); }