本文整理汇总了C#中VarVec.Set方法的典型用法代码示例。如果您正苦于以下问题:C# VarVec.Set方法的具体用法?C# VarVec.Set怎么用?C# VarVec.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VarVec
的用法示例。
在下文中一共展示了VarVec.Set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Table
internal Table(Command command, TableMD tableMetadata, int tableId)
{
m_tableMetadata = tableMetadata;
m_columns = Command.CreateVarList();
m_keys = command.CreateVarVec();
m_nonnullableColumns = command.CreateVarVec();
m_tableId = tableId;
var columnVarMap = new Dictionary<string, ColumnVar>();
foreach (var c in tableMetadata.Columns)
{
var v = command.CreateColumnVar(this, c);
columnVarMap[c.Name] = v;
if (!c.IsNullable)
{
m_nonnullableColumns.Set(v);
}
}
foreach (var c in tableMetadata.Keys)
{
var v = columnVarMap[c.Name];
m_keys.Set(v);
}
m_referencedColumns = command.CreateVarVec(m_columns);
}
示例2: CreateVarVec
private static VarVec CreateVarVec(params int[] bits)
{
var command = new Mock<Command>();
var vec = new VarVec(command.Object);
bits.Each(b =>
{
var v = CreateVar(b);
vec.Set(v);
command.Setup(m => m.GetVar(b)).Returns(v);
});
return vec;
}
示例3: ConvertToNestOpInput
// <summary>
// Convert a CollectOp subtree (when used as the defining expression for a
// VarDefOp) into a reasonable input to a NestOp.
// </summary>
// <remarks>
// There are a couple of cases that we handle here:
// (a) PhysicalProject(X) ==> X
// (b) PhysicalProject(Sort(X)) ==> Sort(X)
// </remarks>
// <param name="physicalProjectNode"> the child of the CollectOp </param>
// <param name="collectionVar"> the collectionVar being defined </param>
// <param name="collectionInfoList"> where to append the new collectionInfo </param>
// <param name="collectionNodes"> where to append the collectionNode </param>
// <param name="externalReferences"> a bit vector of external references of the physicalProject </param>
// <param name="collectionReferences"> a bit vector of collection vars </param>
private void ConvertToNestOpInput(
Node physicalProjectNode, Var collectionVar, List<CollectionInfo> collectionInfoList, List<Node> collectionNodes,
VarVec externalReferences, VarVec collectionReferences)
{
// Keep track of any external references the physicalProjectOp has
externalReferences.Or(Command.GetNodeInfo(physicalProjectNode).ExternalReferences);
// Case: (a) PhysicalProject(X) ==> X
var nestOpInput = physicalProjectNode.Child0;
// Now build the collectionInfo for this input, including the flattened
// list of vars, which is essentially the outputs from the physicalProject
// with the sortKey vars that aren't already in the outputs we already
// have.
var physicalProjectOp = (PhysicalProjectOp)physicalProjectNode.Op;
var flattenedElementVarList = Command.CreateVarList(physicalProjectOp.Outputs);
var flattenedElementVarVec = Command.CreateVarVec(flattenedElementVarList); // Use a VarVec to make the lookups faster
List<SortKey> sortKeys = null;
if (OpType.Sort
== nestOpInput.Op.OpType)
{
// Case: (b) PhysicalProject(Sort(X)) ==> Sort(X)
var sortOp = (SortOp)nestOpInput.Op;
sortKeys = OpCopier.Copy(Command, sortOp.Keys);
foreach (var sk in sortKeys)
{
if (!flattenedElementVarVec.IsSet(sk.Var))
{
flattenedElementVarList.Add(sk.Var);
flattenedElementVarVec.Set(sk.Var);
}
}
}
else
{
sortKeys = new List<SortKey>();
}
// Get the keys for the collection
var keyVars = Command.GetExtendedNodeInfo(nestOpInput).Keys.KeyVars;
//Check whether all key are projected
var keyVarsClone = keyVars.Clone();
keyVarsClone.Minus(flattenedElementVarVec);
var keys = (keyVarsClone.IsEmpty) ? keyVars.Clone() : Command.CreateVarVec();
// Create the collectionInfo
var collectionInfo = Command.CreateCollectionInfo(
collectionVar, physicalProjectOp.ColumnMap.Element, flattenedElementVarList, keys, sortKeys, null /*discriminatorValue*/);
// Now update the collections we're tracking.
collectionInfoList.Add(collectionInfo);
collectionNodes.Add(nestOpInput);
collectionReferences.Set(collectionVar);
}
示例4: EnsureReferencedVarsAreRemoved
// <summary>
// If we're going to eat the ProjectNode, then we at least need to make
// sure we remap any vars it defines as varRefs, and ensure that any
// references to them are switched.
// </summary>
private void EnsureReferencedVarsAreRemoved(List<Node> referencedVars, VarVec outputVars)
{
foreach (var chi in referencedVars)
{
var varDefOp = (VarDefOp)chi.Op;
var defVar = varDefOp.Var;
var refVar = ResolveVarReference(defVar);
m_varRemapper.AddMapping(defVar, refVar);
outputVars.Clear(defVar);
outputVars.Set(refVar);
}
}