Beispiel #1
0
 public void AddFinalSymble()
 {
     if (Terminals.Select(x => x.Value).All(y => y != "$"))
     {
         Terminals.Add("$".ToTerminal());
     }
 }
        void Update_Terminals()
        {
            Terminals.Clear();
            List <BOL.Terminal.objTerminal> List = DAL.Terminal.Terminal_Repository.GetActiveTerminals();

            List.ForEach(x => Terminals.Add(x));
        }
Beispiel #3
0
 public void AddTerminal(Terminal terminal)
 {
     //Ensure terminal is not already in List
     if (Terminals.FirstOrDefault(x => x.Name.Equals(terminal.Name, StringComparison.OrdinalIgnoreCase)) == null)
     {
         Terminals.Add(terminal);
     }
 }
Beispiel #4
0
        /// <summary>
        /// Registers a terminal with a depot.
        /// </summary>
        /// <param name="depot"></param>
        /// <returns>A unique id for the terminal</returns>
        public string CreateTerminal(IDepot depot)
        {
            var terminal = new TerminalMetadata(depot);

            Terminals.Add(terminal);

            return(terminal.Id);
        }
Beispiel #5
0
        public void AddTerminal(CrawlerTerminal terminal)
        {
            if (Terminals.Any(i => i.ConnectionId == terminal.ConnectionId) &&
                Terminals.Any(i => i.Group == terminal.Group))
            {
                return;
            }

            Terminals.Add(terminal);
        }
Beispiel #6
0
        public CFG(Node startLeftNode, Node startRightNode)
        {
            this.Terminals = new Dictionary <char, CFGTerminal>();
            Terminals.Add('_', new CFGTerminal('_'));
            this.AllTransitions = new Dictionary <string, CFGVariable>();
            CFGVariable startVariable = new CFGVariable(startLeftNode, startRightNode);

            AllTransitions.Add($"{startLeftNode.Name}{startRightNode.Name}", startVariable);
            this.StartVariable = startVariable;
        }
Beispiel #7
0
        public override void AddReference(ModelCode referenceId, long globalId)
        {
            switch (referenceId)
            {
            case ModelCode.TERMINAL_CONDEQUIP:
                Terminals.Add(globalId);
                break;

            default:
                base.AddReference(referenceId, globalId);
                break;
            }
        }
        public override void AddReference(ModelCode referenceId, long globalId)
        {
            switch (referenceId)
            {                       //DALJA KLASA_TRENUTNA
            case ModelCode.TERMINAL_CONDEQ:
                Terminals.Add(globalId);
                break;

            default:
                base.AddReference(referenceId, globalId);
                break;
            }
        }
        /// <summary>
        /// Adds a terminal to this node.
        /// </summary>
        /// <param name="terminal">The terminal to add.</param>
        public virtual void AddTerminal(TerminalModel terminal)
        {
            if (Terminals.Contains(terminal))
            {
                throw new ModelValidationException(this, "This terminal has already been added");
            }

            if (terminal.ParentNode is object)
            {
                throw new ModelValidationException(this, "Remove terminal from its current node before adding it to this one");
            }

            terminal.ParentNode = this;
            Terminals.Add(terminal);
        }
Beispiel #10
0
 public void Compile()
 {
     foreach (Production p in Productions)
     {
         Variables.Add(new Variable(p.Head));
         foreach (char c in p.Body.ToCharArray())
         {
             if (Utils.IsTerminal(c))
             {
                 Terminals.Add(new Terminal(c));
             }
             else if (Utils.IsVariable(c))
             {
                 Variables.Add(new Variable(c));
             }
         }
     }
 }
Beispiel #11
0
        void Update_Terminal_Collections()
        {
            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork += (s, arg) =>
            {
                arg.Result = DAL.Terminal.Terminal_Repository.GetSortedAllTerminals();
            };

            bw.RunWorkerCompleted += (s, arg) =>
            {
                if (arg.Error == null)
                {
                    if (arg.Result != null)
                    {
                        Terminals.Clear();
                        ((List <BOL.Terminal.objTerminal>)arg.Result).ForEach(x => Terminals.Add(x));
                    }
                }
            };
            bw.RunWorkerAsync();
        }
 /// <inheritdoc />
 public override void Open()
 {
     base.Open();
     Terminals.Add(this);
 }
Beispiel #13
0
        public void OnLoad(ConfigNode node)
        {
            IsLoaded = false;

            // Depots need to be loaded first!
            if (node.HasNode(DEPOTS_NODE_NAME))
            {
                var wolfNode   = node.GetNode(DEPOTS_NODE_NAME);
                var depotNodes = wolfNode.GetNodes();
                foreach (var depotNode in depotNodes)
                {
                    var bodyValue  = depotNode.GetValue("Body");
                    var biomeValue = depotNode.GetValue("Biome");

                    var depot = new Depot(bodyValue, biomeValue);
                    depot.OnLoad(depotNode);
                    Depots.Add(depot);
                }
            }
            if (node.HasNode(CREW_ROUTES_NODE_NAME))
            {
                var wolfNode       = node.GetNode(CREW_ROUTES_NODE_NAME);
                var crewRouteNodes = wolfNode.GetNodes();
                foreach (var crewRouteNode in crewRouteNodes)
                {
                    var route = new CrewRoute(this);
                    route.OnLoad(crewRouteNode);
                    CrewRoutes.Add(route);
                }
            }
            if (node.HasNode(HOPPERS_NODE_NAME))
            {
                var wolfNode    = node.GetNode(HOPPERS_NODE_NAME);
                var hoppersNode = wolfNode.GetNodes();
                foreach (var hopperNode in hoppersNode)
                {
                    var bodyValue  = hopperNode.GetValue("Body");
                    var biomeValue = hopperNode.GetValue("Biome");
                    var depot      = Depots.FirstOrDefault(d => d.Body == bodyValue && d.Biome == biomeValue);

                    if (depot != null)
                    {
                        var hopper = new HopperMetadata(depot);
                        hopper.OnLoad(hopperNode);
                        Hoppers.Add(hopper);
                    }
                }
            }
            if (node.HasNode(ROUTES_NODE_NAME))
            {
                var wolfNode   = node.GetNode(ROUTES_NODE_NAME);
                var routeNodes = wolfNode.GetNodes();
                foreach (var routeNode in routeNodes)
                {
                    var route = new Route(this);
                    route.OnLoad(routeNode);
                    Routes.Add(route);
                }
            }
            if (node.HasNode(TERMINALS_NODE_NAME))
            {
                var wolfNode      = node.GetNode(TERMINALS_NODE_NAME);
                var terminalNodes = wolfNode.GetNodes();
                foreach (var terminalNode in terminalNodes)
                {
                    var terminal = new TerminalMetadata();
                    terminal.OnLoad(terminalNode);
                    Terminals.Add(terminal);
                }
            }

            IsLoaded = true;
        }
 public void AddTerminal(Terminal terminal)
 {
     terminal.TerminalRequiredAnswer += TerminalOnTerminalRequiredAnswer;
     Terminals.Add(terminal);
 }