private void PrintFloatsDistributionById(IFloatObject floatObject) { try { Regex matchNumber = new Regex(@"\d+"); this.logger?.Log(); this.floatIdByLabelKeys .Cast <string>() .OrderBy(s => int.Parse(matchNumber.Match(s).Value ?? "1")) .ToList() .ForEach(id => { this.logger?.Log( "{2}\t#{0}\tis in float\t#{1}", id, this.floatIdByLabel[id], floatObject.Description); }); } catch (Exception e) { this.logger?.Log(e, "Cannot print the table of floats."); } }
/// <summary> /// Gets the number of floating objects of a given type and populates label-and-id-related hash tables. /// This method generates the "dictionary" to correctly post-process xref/@rid references. /// </summary> /// <param name="context">XmlNode to be harvested.</param> /// <param name="floatObject">IFloatObject model to provide information for the floating object.</param> /// <returns>Number of floating objects of type refType with label containing "floatType".</returns> private int GetFloatsOfType(XmlNode context, IFloatObject floatObject) { this.floatIdByLabel = new Hashtable(); this.floatLabelById = new Hashtable(); int numberOfFloatsOfType = 0; try { XmlNodeList floatsNodeList = context.SelectNodes(floatObject.FloatObjectXPath); foreach (XmlNode floatNode in floatsNodeList) { string id = this.GetFloatId(floatObject.FloatReferenceType, floatNode); string labelText = this.GetFloatLabelText(floatNode); this.UpdateFloatLabelByIdList(id, labelText); this.UpdateFloatIdByLabelList(id, labelText); } numberOfFloatsOfType = floatsNodeList.Count; } catch (Exception e) { this.logger?.Log(e, string.Empty); } this.floatIdByLabelKeys = this.floatIdByLabel.Keys; this.floatIdByLabelValues = this.floatIdByLabel.Values; this.PrintFloatsDistributionById(floatObject); return(numberOfFloatsOfType); }
private void TagFloatObjects(XmlNode context, IFloatObject floatObject) { this.InitFloats(); int numberOfFloatsOfType = this.GetFloatsOfType(context, floatObject); if (numberOfFloatsOfType > 0) { this.TagFloatsOfType(context, floatObject.InternalReferenceType, floatObject.MatchCitationPattern); this.FormatXref(context); this.ProcessFloatsRid(context, numberOfFloatsOfType, floatObject.InternalReferenceType); this.FormatXrefGroup(context, floatObject.InternalReferenceType); } }