public Iterator(TernaryTree outerInstance) { this.outerInstance = outerInstance; cur = -1; ns = new Stack <Item>(); ks = new StringBuilder(); isInitialized = false; }
public Iterator(TernaryTree outerInstance) { this.outerInstance = outerInstance; cur = -1; ns = new Stack <>(); ks = new StringBuilder(); rewind(); }
public virtual object Clone() { TernaryTree t = new TernaryTree(); t.m_lo = (char[])this.m_lo.Clone(); t.m_hi = (char[])this.m_hi.Clone(); t.m_eq = (char[])this.m_eq.Clone(); t.m_sc = (char[])this.m_sc.Clone(); t.m_kv = (CharVector)this.m_kv.Clone(); t.m_root = this.m_root; t.m_freenode = this.m_freenode; t.m_length = this.m_length; return(t); }
public override TernaryTree clone() { TernaryTree t = new TernaryTree(); t.lo = this.lo.Clone(); t.hi = this.hi.Clone(); t.eq = this.eq.Clone(); t.sc = this.sc.Clone(); t.kv = this.kv.clone(); t.root = this.root; t.freenode = this.freenode; t.length = this.length; return(t); }
public object Clone() { TernaryTree t = new TernaryTree(); t.lo = (char[])this.lo.Clone(); t.hi = (char[])this.hi.Clone(); t.eq = (char[])this.eq.Clone(); t.sc = (char[])this.sc.Clone(); t.kv = (CharVector)this.kv.Clone(); t.root = this.root; t.freenode = this.freenode; t.length = this.length; return(t); }
/// <summary> /// Read hyphenation patterns from an <see cref="XmlReader"/>. /// </summary> /// <param name="source"> <see cref="XmlReader"/> input source for the file </param> /// <exception cref="IOException"> In case the parsing fails </exception> public virtual void LoadPatterns(XmlReader source) { PatternParser pp = new PatternParser(this); ivalues = new TernaryTree(); pp.Parse(source); // patterns/values should be now in the tree // let's optimize a bit TrimToSize(); m_vspace.TrimToSize(); m_classmap.TrimToSize(); // get rid of the auxiliary map ivalues = null; }
/// <summary> /// Read hyphenation patterns from an XML file. /// </summary> /// <param name="source"> the InputSource for the file </param> /// <exception cref="IOException"> In case the parsing fails </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void loadPatterns(org.xml.sax.InputSource source) throws java.io.IOException public virtual void loadPatterns(InputSource source) { PatternParser pp = new PatternParser(this); ivalues = new TernaryTree(); pp.parse(source); // patterns/values should be now in the tree // let's optimize a bit trimToSize(); vspace.trimToSize(); classmap.trimToSize(); // get rid of the auxiliary map ivalues = null; }
/// <summary> /// Each node stores a character (splitchar) which is part of some key(s). In a /// compressed branch (one that only contain a single string key) the trailer /// of the key which is not already in nodes is stored externally in the kv /// array. As items are inserted, key substrings decrease. Some substrings may /// completely disappear when the whole branch is totally decompressed. The /// tree is traversed to find the key substrings actually used. In addition, /// duplicate substrings are removed using a map (implemented with a /// TernaryTree!). /// /// </summary> public virtual void TrimToSize() { // first balance the tree for best performance Balance(); // redimension the node arrays RedimNodeArrays(m_freenode); // ok, compact kv array CharVector kx = new CharVector(); kx.Alloc(1); TernaryTree map = new TernaryTree(); Compact(kx, map, m_root); m_kv = kx; m_kv.TrimToSize(); }
/// <summary> /// Each node stores a character (splitchar) which is part of some key(s). In a /// compressed branch (one that only contain a single string key) the trailer /// of the key which is not already in nodes is stored externally in the kv /// array. As items are inserted, key substrings decrease. Some substrings may /// completely disappear when the whole branch is totally decompressed. The /// tree is traversed to find the key substrings actually used. In addition, /// duplicate substrings are removed using a map (implemented with a /// TernaryTree!). /// /// </summary> public virtual void trimToSize() { // first balance the tree for best performance balance(); // redimension the node arrays redimNodeArrays(freenode); // ok, compact kv array CharVector kx = new CharVector(); kx.alloc(1); TernaryTree map = new TernaryTree(); compact(kx, map, root); kv = kx; kv.trimToSize(); }