public override StringBuilder Represent(SearchResult searchResult) { StringBuilder builder = new StringBuilder(); for (int t = 0; t < searchResult.TableCount; t++) { int k = 0; for (; k < searchResult.Count; k++) { if (searchResult[k].SheetNames[t] != null) { break; } } if (k >= searchResult.Count) { continue; } Base.Prefix.Prefix = searchResult[k].SheetNames[t]; builder.Append(Base.Represent(searchResult, t)); } IRepresenter allCount = new CountRepresenter(new Representer()); builder.Append(allCount.Represent(searchResult)); return(builder); }
public override StringBuilder Represent(SearchResult searchResult) { StringBuilder builder = new StringBuilder(); for (int k = 0; k < searchResult.Count; k++) { builder.AppendLine(searchResult.Keys[k] + " :"); builder.Append(Base.Represent(searchResult[k])); builder.AppendLine(); } IRepresenter allCount = new CountRepresenter(new Representer()); builder.Append(allCount.Represent(searchResult)); return(builder); }
/// <summary> /// Wraps a <see cref="Representer"/> in the correct order into needed <see cref="IWrapper{IRepresenter}"/>, depending on passed <paramref name="Flags"/> /// </summary> /// <param name="Flags"><see cref="ActionFlags"/> value, that defines wrapping process</param> /// <returns>Custom <see cref="IRepresenter"/>, that was created corresponding to passed <paramref name="Flags"/> value</returns> public static IRepresenter GetRepresenter(ActionFlags Flags) { Flags = Flags & ~ActionFlags.Unrestrict; IRepresenter result = new Representer(); if (Flags == (ActionFlags.Sheets | ActionFlags.Keys)) { return(new KeyRepresenter(new LoneSheetRepresenter(new Representer()))); } if (Flags == (ActionFlags.Sheets | ActionFlags.Count)) { return(new LoneSheetRepresenter(new CountRepresenter(new Representer()))); } if (Flags == (ActionFlags.Sheets | ActionFlags.Keys | ActionFlags.Count)) { return(new KeyRepresenter(new LoneSheetRepresenter(new CountRepresenter(new Representer())))); } if ((Flags & ActionFlags.Names) > 0) { result = new CellNameRepresenter(result); } if ((Flags & ActionFlags.Count) > 0) { result = new CountRepresenter(result); } if ((Flags & ActionFlags.Sheets) > 0) { result = new SheetRepresenter(result); } if ((Flags & ActionFlags.Keys) > 0) { result = new KeyRepresenter(result); } return(result); }