Adding tests for stream serialization
This commit is contained in:
commit
e2f5e6717d
46 files changed
+2822
-2518
No files matched your search
@@ -1,116 +1,117 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Text;
|
||||
|
||||
/*
|
||||
* 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
|
||||
//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; }
|
||||
// //for faster access and such
|
||||
// private int[] myGroupColNos;
|
||||
// public int[] groupColNos
|
||||
// {
|
||||
// get { return myGroupColNos; }
|
||||
|
||||
}
|
||||
private string[] myGroupColNames;
|
||||
public string[] groupColNames
|
||||
{
|
||||
get { return myGroupColNames; }
|
||||
}
|
||||
// }
|
||||
// private string[] myGroupColNames;
|
||||
// public string[] groupColNames
|
||||
// {
|
||||
// get { return myGroupColNames; }
|
||||
// }
|
||||
|
||||
private short myGroupNumber;
|
||||
public short groupNumber
|
||||
{
|
||||
get { return myGroupNumber; }
|
||||
// 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; }
|
||||
// }
|
||||
|
||||
}
|
||||
// /* 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)
|
||||
{
|
||||
// //if the group number is 0, the group is not stored in tables for serialization
|
||||
// public bool isStoredInTable
|
||||
// {
|
||||
// get { return myGroupNumber != 0; }
|
||||
|
||||
myGroupNumber = num;
|
||||
myTableSize = sizeInBits;
|
||||
myGroupColNames = cols ;
|
||||
}
|
||||
// }
|
||||
// public BlueRowLookupGroup(short num, short sizeInBits, params string[] 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);
|
||||
// myGroupNumber = num;
|
||||
// myTableSize = sizeInBits;
|
||||
// myGroupColNames = cols ;
|
||||
// }
|
||||
|
||||
myGroupColNos[col - 1] = columnInInputTable.colNo;
|
||||
}
|
||||
// /*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);
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
// 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;
|
||||
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// }
|
||||
// }
|
||||
Reference in new issue
Block a user