IStructuralNodeTemplate CreateTableListNode(MetaDataTableCodes[] codes, HeapSizeFlags heapSizes) { var tables = new CompoundNodeTemplate(); var statistics = new MetaDataTableStatistics(GetRowCounts(codes), heapSizes); for (var i = 0; i < codes.Length; i++) { var code = codes[i]; var rowCount = statistics.GetRowCount(code); if (rowCount <= 0) { continue; } var rowTemplate = CreateRowTemplate(statistics, code); if (rowTemplate == null) { tables.Add(code + " Not Yet Implemented", StandardTemplates.UInt8); return(tables); } tables.Add(code.ToString(), new RepeatingNodeTemplate(rowTemplate, rowCount, GetMetaDataTokenFormatter(code))); } return(tables); }
public override IStructuralNodeTemplate SelectTemplate(MetaDataTableStatistics statistics) { var count = 0; for (var i = 0; i < _codes.Length; i++) { var tmp = statistics.GetRowCount(_codes[i]); if (tmp > count) { count = tmp; } } return((RequiredBits(count) + _codeBits) > 16 ? LongForm : ShortForm); }