Пример #1
0
        public override byte[] GetBytes()
        {
            Forklift f      = Database.Instance.Data.Forklifts.FirstOrDefault().Value;
            Node     ignore = f.RearNode;

            ForkliftPath fp = new ForkliftPath(GetPath(), ignore);

            return(Encoding.ASCII.GetBytes(fp.getDirections()));
        }
Пример #2
0
        public override byte[] GetBytes()
        {
            Forklift f = Database.Instance.Data.Forklifts.FirstOrDefault().Value;
            Node ignore = f.RearNode;

            ForkliftPath fp = new ForkliftPath(GetPath(), ignore);

            return Encoding.ASCII.GetBytes(fp.getDirections());
        }
        public void TestForkliftPathGraphSixNodesFromAToBBackToB()
        {
            Graph g = Database.Instance.Data.Graphs.FirstOrDefault().Value;

            Path p = g.ShortestPath(g.getNode("a"), g.getNode("b"), g.getNode("b"));

            ForkliftPath fp = new ForkliftPath(p, g.getNode("b"));

            string actual = fp.getDirections();
            string expected = "NNLSNSNNLNL";

            Assert.IsTrue(actual == expected);

        }
Пример #4
0
        public override byte[] GetBytes()
        {
            Forklift f      = Database.Instance.Data.Forklifts.FirstOrDefault().Value;
            Node     ignore = f.RearNode;

            Path p = GetPath();

            if (p == null)
            {
                throw new NullReferenceException("Path is empty (either at destination, or impossible)");
            }

            ForkliftPath fp = new ForkliftPath(p, ignore);

            string directions = fp.getDirections();

            // We add some special instructions to handle the different job types
            // D - forklift down
            // N - move to next red tape
            // U - forklift up
            // T - Turn around
            // B - Back off small step

            // The instructions is inserted in reversed order
            if (Type == PalletJobType.fetch)
            {
                // Removes the extra N
                directions = directions.Substring(1, directions.Length - 1);

                // Add directions to fetch the pallet
                directions = directions.Insert(0, "TUNDR");
            }
            else if (Type == PalletJobType.deliver)
            {
                // Removes the extra N
                directions = directions.Substring(1, directions.Length - 1);

                // Add directions to deliver the pallet
                directions = directions.Insert(0, "TUBDNR");
            }

            return(Encoding.ASCII.GetBytes(directions));
        }
Пример #5
0
        public override byte[] GetBytes()
        {
            Forklift f = Database.Instance.Data.Forklifts.FirstOrDefault().Value;
            Node ignore = f.RearNode;

            Path p = GetPath();

            if (p == null)
            {
                throw new NullReferenceException("Path is empty (either at destination, or impossible)");
            }

            ForkliftPath fp = new ForkliftPath(p, ignore);

            string directions = fp.getDirections();

            // We add some special instructions to handle the different job types
            // D - forklift down
            // N - move to next red tape
            // U - forklift up
            // T - Turn around
            // B - Back off small step

            // The instructions is inserted in reversed order
            if (Type == PalletJobType.fetch)
            {
                // Removes the extra N
                directions = directions.Substring(1, directions.Length - 1);

                // Add directions to fetch the pallet
                directions = directions.Insert(0, "TUNDR");
            }
            else if (Type == PalletJobType.deliver)
            {
                // Removes the extra N
                directions = directions.Substring(1, directions.Length - 1);

                // Add directions to deliver the pallet
                directions = directions.Insert(0, "TUBDNR");
            }

            return Encoding.ASCII.GetBytes(directions);
        }