118 lines
3.7 KiB
C#
118 lines
3.7 KiB
C#
// using System;
|
|
// using System.Collections.Generic;
|
|
// using System.Linq;
|
|
// using System.Text;
|
|
|
|
//TODORemove
|
|
// /*
|
|
// * This class reprsents one lookup group that is stored together in a lookup table because it contains repeated data patterns.
|
|
// * if groupNo is zero, then the group is not stord in a lookup table at all.
|
|
// *
|
|
// *
|
|
// *
|
|
// */
|
|
// namespace BCG
|
|
// {
|
|
// public class BlueRowLookupGroup
|
|
// {
|
|
// BlueTableSchema myEntrySchema;
|
|
// public IBlueTableSchema entrySchema
|
|
// {
|
|
// get { return myEntrySchema; }
|
|
// //cant' set this value, have to build it from the row's schema
|
|
|
|
// }
|
|
|
|
// //for faster access and such
|
|
// private int[] myGroupColNos;
|
|
// public int[] groupColNos
|
|
// {
|
|
// get { return myGroupColNos; }
|
|
|
|
// }
|
|
// private string[] myGroupColNames;
|
|
// public string[] groupColNames
|
|
// {
|
|
// get { return myGroupColNames; }
|
|
// }
|
|
|
|
// private short myGroupNumber;
|
|
// public short groupNumber
|
|
// {
|
|
// get { return myGroupNumber; }
|
|
|
|
// }
|
|
|
|
// /* how many bits are the ids into the table?
|
|
// * In c# everything is stored as integers, but when it goes across the wire
|
|
// * the data can be represented as a byte, a short, or an int
|
|
// */
|
|
// private short myTableSize;
|
|
// public short tableSize
|
|
// {
|
|
// get { return myTableSize; }
|
|
|
|
// }
|
|
|
|
// //if the group number is 0, the group is not stored in tables for serialization
|
|
// public bool isStoredInTable
|
|
// {
|
|
// get { return myGroupNumber != 0; }
|
|
|
|
// }
|
|
// public BlueRowLookupGroup(short num, short sizeInBits, params string[] cols)
|
|
// {
|
|
|
|
// myGroupNumber = num;
|
|
// myTableSize = sizeInBits;
|
|
// myGroupColNames = cols ;
|
|
// }
|
|
|
|
// /*Takes a LookupTableSchema for the rows this group caches for, and builds the schema representing
|
|
// each of these entries in the lookup table. This function should be called by the LookupTableSchema
|
|
// during its constructor.
|
|
|
|
// This function also caches the column numbers for this group, for quicker access*/
|
|
// public void buildEntrySchema(LookupTableSchema theSchema)
|
|
// {
|
|
// ColumnInfo[] columns = new ColumnInfo[myGroupColNames.Length + 1];
|
|
// myGroupColNos = new int[myGroupColNames.Length];
|
|
// //the first column in our table is always the ID
|
|
// int idColumn = 0;
|
|
// columns[idColumn] = new ColumnInfo("id", idColumn, typeof(int));
|
|
// //go through each of the columns
|
|
// for (int col = 1; col < columns.Length; ++col)
|
|
// {
|
|
// ColumnInfo columnInInputTable = theSchema[groupColNames[col - 1]];
|
|
// if (columnInInputTable.isConstant)
|
|
// columns[col] = new ColumnInfo(columnInInputTable.colName, col, columnInInputTable.colValue);
|
|
// else
|
|
// columns[col] = new ColumnInfo(columnInInputTable.colName, col, columnInInputTable.colType);
|
|
|
|
// myGroupColNos[col - 1] = columnInInputTable.colNo;
|
|
// }
|
|
|
|
|
|
|
|
// myEntrySchema = new BlueTableSchema(columns, "Lookup Group " + theSchema.tableName + ":" + myGroupNumber);
|
|
|
|
// }
|
|
|
|
// /*takes a row as input, and extracts the members of the group from the row */
|
|
// public object[] extractGroupFromRow(IBlueRow input)
|
|
// {
|
|
// int numCols = myGroupColNames.Length;
|
|
// object[] results = new object[numCols];
|
|
|
|
// for (int col = 0; col < numCols; ++col)
|
|
// results[col] = input[myGroupColNos[col]];
|
|
|
|
// return results;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
// }
|