/** * Adds a SOM name to the search node chain. * @param inverseSearch the start point * @param stack the stack with the separeted SOM parts * @param unstack the full name */ public static void InverseSearchAdd(Dictionary <String, InverseStore> inverseSearch, Stack2 <string> stack, String unstack) { String last = stack.Peek(); InverseStore store; inverseSearch.TryGetValue(last, out store); if (store == null) { store = new InverseStore(); inverseSearch[last] = store; } for (int k = stack.Count - 2; k >= 0; --k) { last = stack[k]; InverseStore store2; int idx = store.part.IndexOf(last); if (idx < 0) { store.part.Add(last); store2 = new InverseStore(); store.follow.Add(store2); } else { store2 = (InverseStore)store.follow[idx]; } store = store2; } store.part.Add(""); store.follow.Add(unstack); }
/** * Searchs the SOM hiearchie from the bottom. * @param parts the SOM parts * @return the full name or <CODE>null</CODE> if not found */ public String InverseSearchGlobal(ArrayList parts) { if (parts.Count == 0) { return(null); } InverseStore store = (InverseStore)inverseSearch[parts[parts.Count - 1]]; if (store == null) { return(null); } for (int k = parts.Count - 2; k >= 0; --k) { String part = (String)parts[k]; int idx = store.part.IndexOf(part); if (idx < 0) { if (store.IsSimilar(part)) { return(null); } return(store.DefaultName); } store = (InverseStore)store.follow[idx]; } return(store.DefaultName); }
/** * Adds a SOM name to the search node chain. * @param inverseSearch the start point * @param stack the stack with the separeted SOM parts * @param unstack the full name */ public static void InverseSearchAdd(Hashtable inverseSearch, Stack2 stack, String unstack) { String last = (String)stack.Peek(); InverseStore store = (InverseStore)inverseSearch[last]; if (store == null) { store = new InverseStore(); inverseSearch[last] = store; } for (int k = stack.Count - 2; k >= 0; --k) { last = (String)stack[k]; InverseStore store2; int idx = store.part.IndexOf(last); if (idx < 0) { store.part.Add(last); store2 = new InverseStore(); store.follow.Add(store2); } else { store2 = (InverseStore)store.follow[idx]; } store = store2; } store.part.Add(""); store.follow.Add(unstack); }
/** * Adds a SOM name to the search node chain. * @param inverseSearch the start point * @param stack the stack with the separeted SOM parts * @param unstack the full name */ public static void InverseSearchAdd(Hashtable inverseSearch, Stack2 stack, String unstack) { String last = (String)stack.Peek(); InverseStore store = (InverseStore)inverseSearch[last]; if (store == null) { store = new InverseStore(); inverseSearch[last] = store; } for (int k = stack.Count - 2; k >= 0; --k) { last = (String)stack[k]; InverseStore store2; int idx = store.part.IndexOf(last); if (idx < 0) { store.part.Add(last); store2 = new InverseStore(); store.follow.Add(store2); } else store2 = (InverseStore)store.follow[idx]; store = store2; } store.part.Add(""); store.follow.Add(unstack); }