/// <summary> /// 更新语法树 /// </summary> /// <param name="oldCode">旧代码</param> /// <param name="newCode">新代码</param> /// <param name="sets">新的引用</param> public override void Update(string oldCode, string newCode, HashSet <string> sets = default) { //先移除 if (TreeCache.ContainsKey(oldCode)) { while (!TreeCache.TryRemove(oldCode, out _)) { } ; } if (sets == default) { if (ReferenceCache.ContainsKey(oldCode)) { sets = ReferenceCache[oldCode]; while (!ReferenceCache.TryRemove(oldCode, out _)) { } ; } } //再添加 AddTreeToCache(newCode); ReferenceCache[newCode] = sets; }
public static Node FindTreeClosestToBlackHeight(List <int> elements, int blackHeight) { _elements = elements; _elements.Sort(); _cache = new TreeCache(elements.Count); var tree = _cache.GetTreeClosestToBlackHeight(elements.Count, blackHeight); tree.FillWithValues(elements); return(tree); }
/// <summary> /// 更新语法树 /// </summary> /// <param name="oldCode">旧代码</param> /// <param name="newCode">新代码</param> /// <param name="usings">新的引用</param> public override void Update(string oldCode, string newCode, HashSet <string> usings = default) { //先移除 TreeCache.Remove(oldCode); if (usings == default) { if (ReferenceCache.ContainsKey(oldCode)) { usings = ReferenceCache[oldCode]; ReferenceCache.Remove(oldCode); } } //再添加 AddTreeToCache(newCode); ReferenceCache[newCode] = usings; }
public CompilationException Update(string old, string @new, HashSet <string> sets = default) { if (TreeCache.ContainsKey(old)) { while (!TreeCache.TryRemove(old, out _)) { } ; } if (sets == default) { if (UsingCache.ContainsKey(old)) { sets = UsingCache[old]; while (!UsingCache.TryRemove(old, out _)) { } ; } } return(Add(@new, sets)); }
public override void Update(string old, string @new, HashSet <string> sets = default) { if (TreeCache.ContainsKey(old)) { while (!TreeCache.TryRemove(old, out _)) { } ; } if (sets == default) { if (ReferenceCache.ContainsKey(old)) { sets = ReferenceCache[old]; while (!ReferenceCache.TryRemove(old, out _)) { } ; } } AddTreeToCache(@new); ReferenceCache[@new] = sets; }
public virtual void Update(string old, string @new, HashSet <string> sets = default) { if (TreeCache.ContainsKey(old)) { while (!TreeCache.TryRemove(old, out _)) { } ; } if (sets == default) { if (UsingCache.ContainsKey(old)) { sets = UsingCache[old]; while (!UsingCache.TryRemove(old, out _)) { } ; } } AddTreeToCache(@new); UsingCache[@new] = sets; }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TreeCache obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; }
/// <summary> /// Constructor. </summary> /// <param name="builder"> the tree builder </param> /// <param name="cache"> the tree cache (may be <code>null</code>) </param> public TreeStore(TreeBuilder builder, TreeCache cache) : base() { this.builder = builder; this.cache = cache; }