public Chain() { links = new Dictionary <string, ChainLink>(); ChainLink link = new ChainLink("", null); Console.WriteLine(link); links.Add(link.Token, link); }
private void generateOutput() { ChainLink link = chain.getFirstLink(); output.Write(link.Token + " "); for (int i = 0; i < average; i++) { link = link.getNextLink(); output.Write(link.Token + " "); if (i % 6 == 0) { output.Write("\n"); } } }
public void AddLink(ChainLink link) { //if (Token == "") //return; if (nextLinks.ContainsKey(link.Token)) { linkOcurences[link.Token] = linkOcurences[link.Token] + 1; } else { nextLinks.Add(link.Token, link); linkOcurences.Add(link.Token, 1); linkProbability.Add(link.Token, 0.0); } linkCount++; updateProbability(); }
public ChainLink(string token, ChainLink endLink) { this.Token = token; nextLinks = new Dictionary <string, ChainLink>(); linkOcurences = new Dictionary <string, int>(); linkProbability = new Dictionary <string, double>(); if (endLink != null) { nextLinks.Add(endLink.Token, endLink); linkOcurences.Add(endLink.Token, 1); linkProbability.Add(endLink.Token, 1.0); linkCount = 1; } else { linkCount = 0; } }
public void AddLink(string prevToken, string newToken) { //Console.WriteLine("prevToken: " + prevToken); //Console.WriteLine("newToken: " + newToken); if (links.ContainsKey(prevToken)) { if (links.ContainsKey(newToken)) { links[prevToken].AddLink(links[newToken]); } else { ChainLink link = new ChainLink(newToken, null); links.Add(link.Token, link); links[prevToken].AddLink(link); } } else { throw new Exception(); } }