Beispiel #1
0
 private void PathEdit_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     //обнуление поля, если устаногвлен дефолтный текст
     if (PathEdit.Text == "Path to file")
     {
         PathEdit.Clear();
     }
 }
Beispiel #2
0
        private void UpdateUrl()
        {
            //var temp = this.Url;
            Url = PathEdit.Trim();
            //validate URL again

            //remove focus from the textbox
            WebsiteCloseEdit();
        }
Beispiel #3
0
    public void Start()
    {
        //testObj = Instantiate(testObject,Vector3.zero,Quaternion.identity).GetComponent<MovePath>();
        instance = this;
        testObj.gameObject.SetActive(false);

        gp  = canvas.GetComponent <GraphicRaycaster>();
        ped = new PointerEventData(null);

        PathMenuItemSync();

        //CreatePath();
    }
Beispiel #4
0
        public IList <int> MostSimilar(int n, int[][] roads, string[] names, string[] targetPath)
        {
            if (n != names.Length)
            {
                throw new ArgumentException("The number of vertices is wrong.");
            }

            // Edges
            var edges = new IList <int> [n];

            for (var i = 0; i < n; i++)
            {
                edges[i] = new List <int>();
            }
            foreach (var pair in roads)
            {
                var n1 = pair[0];
                var n2 = pair[1];
                edges[n1].Add(n2);
                edges[n2].Add(n1);
            }

            var dp = new PathEdit[n][];

            for (var i = 0; i < n; i++)
            {
                dp[i] = new PathEdit[targetPath.Length];
            }

            PathEdit minEdit = null;

            for (var i = 0; i < n; i++)
            {
                var edit = FindMinimumEdits(i, 0, dp, names, targetPath, edges);

                if (minEdit == null || edit.Edits < minEdit.Edits)
                {
                    minEdit = edit;
                }

                if (minEdit.Edits == 0)
                {
                    break;
                }
            }

            return(minEdit.Path);
        }
Beispiel #5
0
        private PathEdit FindMinimumEdits(int v, int t, PathEdit[][] dp, string[] names, string[] targetPath, IList <int>[] edges)
        {
            if (dp[v][t] != null)
            {
                return(dp[v][t]);
            }

            if (t == targetPath.Length - 1)
            {
                var edit = new PathEdit()
                {
                    Path = new List <int> {
                        v
                    },
                    Edits = names[v] == targetPath[t] ? 0 : 1,
                };

                dp[v][t] = edit;
                return(edit);
            }

            var      connects = edges[v];
            PathEdit minEdit  = null;

            foreach (var n in connects)
            {
                var edit = FindMinimumEdits(n, t + 1, dp, names, targetPath, edges);

                if (minEdit == null || edit.Edits < minEdit.Edits)
                {
                    minEdit = edit;
                }
            }

            PathEdit pathEdit = new PathEdit();

            pathEdit.Edits = minEdit.Edits + (names[v] == targetPath[t] ? 0 : 1);
            pathEdit.Path  = new List <int> {
                v
            };
            pathEdit.Path.AddRange(minEdit.Path);
            dp[v][t] = pathEdit;
            return(pathEdit);
        }
Beispiel #6
0
 /// <summary>
 /// Append one edit command to the list of commands to be applied.
 /// <para />
 /// Edit commands may be added in any order chosen by the application. They
 /// are automatically rearranged by the builder to provide the most efficient
 /// update possible.
 /// </summary>
 /// <param name="edit">Another edit command.</param>
 public void add(PathEdit edit)
 {
     _edits.Add(edit);
 }
Beispiel #7
0
 /// <summary>
 /// Append one edit command to the list of commands to be applied.
 /// <para />
 /// Edit commands may be added in any order chosen by the application. They
 /// are automatically rearranged by the builder to provide the most efficient
 /// update possible.
 /// </summary>
 /// <param name="edit">Another edit command.</param>
 public void add(PathEdit edit)
 {
     _edits.Add(edit);
 }