private static bool TryCreateEx(IExceptionContext ectx, ColInfo info, DataKind kind, KeyRange range, out PrimitiveType itemType, out ColInfoEx ex) { ectx.AssertValue(info); ectx.Assert(Enum.IsDefined(typeof(DataKind), kind)); ex = null; var typeSrc = info.TypeSrc; if (range != null) { itemType = TypeParsingUtils.ConstructKeyType(kind, range); if (!typeSrc.ItemType().IsKey() && !typeSrc.ItemType().IsText() && typeSrc.ItemType().RawKind() != kind && !(typeSrc.ItemType().RawKind() == DataKind.I8 && (kind == DataKind.U8 || kind == DataKind.U4))) { return(false); } } else if (!typeSrc.ItemType().IsKey()) { itemType = ColumnTypeHelper.PrimitiveFromKind(kind); } else if (!ColumnTypeHelper.IsValidDataKind(kind)) { itemType = ColumnTypeHelper.PrimitiveFromKind(kind); return(false); } else { var key = typeSrc.ItemType().AsKey(); ectx.Assert(ColumnTypeHelper.IsValidDataKind(key.RawKind())); int count = key.Count; // Technically, it's an error for the counts not to match, but we'll let the Conversions // code return false below. There's a possibility we'll change the standard conversions to // map out of bounds values to zero, in which case, this is the right thing to do. ulong max = kind.ToMaxInt(); if ((ulong)count > max) { count = (int)max; } itemType = new KeyType(kind.ToType(), key.Min, count, key.Contiguous); } // Ensure that the conversion is legal. We don't actually cache the delegate here. It will get // re-fetched by the utils code when needed. bool identity; Delegate del; if (!Conversions.Instance.TryGetStandardConversion(typeSrc.ItemType(), itemType, out del, out identity)) { if (typeSrc.ItemType().RawKind() == itemType.RawKind()) { switch (typeSrc.ItemType().RawKind()) { case DataKind.U4: // Key starts at 1. uint plus = (itemType.IsKey() ? (uint)1 : (uint)0) - (typeSrc.IsKey() ? (uint)1 : (uint)0); identity = false; ValueMapper <uint, uint> map_ = (in uint src, ref uint dst) => { dst = src + plus; }; del = (Delegate)map_; if (del == null) { throw Contracts.ExceptNotSupp("Issue with casting"); } break; default: throw Contracts.Except("Not suppoted type {0}", typeSrc.ItemType().RawKind()); } } else if (typeSrc.ItemType().RawKind() == DataKind.I8 && kind == DataKind.U8) { ulong plus = (itemType.IsKey() ? (ulong)1 : (ulong)0) - (typeSrc.IsKey() ? (ulong)1 : (ulong)0); identity = false; ValueMapper <long, ulong> map_ = (in long src, ref ulong dst) => { CheckRange(src, dst, ectx); dst = (ulong)src + plus; }; del = (Delegate)map_; if (del == null) { throw Contracts.ExceptNotSupp("Issue with casting"); } } else if (typeSrc.ItemType().RawKind() == DataKind.I8 && kind == DataKind.U4) { uint plus = (itemType.IsKey() ? (uint)1 : (uint)0) - (typeSrc.IsKey() ? (uint)1 : (uint)0); identity = false; ValueMapper <long, uint> map_ = (in long src, ref uint dst) => { CheckRange(src, dst, ectx); dst = (uint)src + plus; }; del = (Delegate)map_; if (del == null) { throw Contracts.ExceptNotSupp("Issue with casting"); } } else { return(false); } } ColumnType typeDst = itemType; if (typeSrc.IsVector()) { typeDst = new VectorType(itemType, typeSrc.AsVector().Dimensions.ToArray()); } // An output column is transposable iff the input column was transposable. VectorType slotType = null; if (info.SlotTypeSrc != null) { slotType = new VectorType(itemType, info.SlotTypeSrc.Dimensions.ToArray()); } ex = new ColInfoEx(kind, range != null, typeDst, slotType); return(true); }
private protected virtual JToken SaveAsPfaCore(BoundPfaContext ctx, int iinfo, ColInfo info, JToken srcToken) { Host.AssertValue(ctx); Host.Assert(0 <= iinfo && iinfo < _bindings.InfoCount); Host.Assert(Infos[iinfo] == info); Host.AssertValue(srcToken); Host.Assert(((ICanSavePfa)this).CanSavePfa); return(null); }
public Average Column(ColInfo c) { var a = new Average(); var q = (from w in Weeks from m in w.Meetings where c.Times.Contains(m.Date.TimeOfDay) group m by w.Sunday into g select g.Sum(mm => mm.Present)).ToList(); a.Avg = q.Any() ? q.Average() : 0; a.TotalPeople = q.Sum(); a.TotalMeetings = q.Count(); return a; }
private ValueGetter <uint> CreateUInt32GetterDelegate(ColInfo colInfo) { int columnIndex = GetColumnIndex(colInfo); return((ref uint value) => value = DataReader.IsDBNull(columnIndex) ? default : (uint)DataReader.GetInt32(columnIndex)); }
private int GetColumnIndex(ColInfo colInfo) { return(colInfo.SourceIndex ?? DataReader.GetOrdinal(colInfo.Name)); }
private ValueGetter <short> CreateInt16GetterDelegate(ColInfo colInfo) { int columnIndex = GetColumnIndex(colInfo); return((ref short value) => value = DataReader.IsDBNull(columnIndex) ? default : DataReader.GetInt16(columnIndex)); }
private ValueGetter <float> CreateSingleGetterDelegate(ColInfo colInfo) { int columnIndex = GetColumnIndex(colInfo); return((ref float value) => value = DataReader.IsDBNull(columnIndex) ? float.NaN : DataReader.GetFloat(columnIndex)); }
public Select( G.List<Exp> exps, TableExpression te, Exp where, Exp[] group, OrderByExp[] order, bool [] used, SqlExec x ) { Exps = exps; TE = te; Where = where; Order = order; Used = used; ColumnCount = exps.Count; var names = new string[ ColumnCount ]; var types = new DataType[ ColumnCount ]; for ( int i = 0; i < ColumnCount; i += 1 ) { names[i] = exps[i].Name; types[i] = exps[i].Type; } Cols = new ColInfo( names, types ); if ( x.ParseOnly ) return; if ( group != null ) { // Compute AggSpec and GroupSpec var alist = new G.List<AggSpec>(); for ( int i = 0; i < exps.Count; i += 1 ) { Exp e = exps[i]; AggOp op = e.GetAggOp(); if ( op != AggOp.None ) { AggSpec a = new AggSpec(); a.ColIx = i; a.Type = e.Type; a.Op = op; alist.Add( a ); } } AggSpec = alist.ToArray(); var glist = new G.List<GroupSpec>(); for ( int i=0; i < group.Length; i += 1 ) { GroupSpec g = new GroupSpec(); g.ColIx = Exps.Count; // Note: we could look in Exps to see if it is already there rather than adding an extra Exp. g.Type = group[ i ].Type; Exps.Add( group[ i ] ); glist.Add( g ); } GroupSpec = glist.ToArray(); } if ( Order != null ) { var sortSpec = new SortSpec[ Order.Length ]; for ( int i = 0; i < Order.Length; i += 1 ) { // Quite complicated as ORDER BY can use aliases or expressions. Exp e = Order[i].E; sortSpec[ i ].Desc = Order[i].Desc; bool found = false; if ( e is ExpName ) { string alias = ((ExpName)e).ColName; for ( int j = 0; j < Cols.Count; j += 1 ) { if ( Cols.Names[j] == alias ) { e = Exps[ j ]; found = true; break; } } } int cix = Exps.Count; Exps.Add( e ); if ( !found ) e.Bind( x ); sortSpec[ i ].Type = e.Type; sortSpec[ i ].ColIx = cix; } SortSpec = sortSpec; } }
private static bool TryCreateEx(IExceptionContext ectx, ColInfo info, DataKind kind, KeyRange range, out PrimitiveType itemType, out ColInfoEx ex) { ectx.AssertValue(info); ectx.Assert(Enum.IsDefined(typeof(DataKind), kind)); ex = null; var typeSrc = info.TypeSrc; if (range != null) { itemType = TypeParsingUtils.ConstructKeyType(kind, range); if (!typeSrc.ItemType.IsKey && !typeSrc.ItemType.IsText) { return(false); } } else if (!typeSrc.ItemType.IsKey) { itemType = PrimitiveType.FromKind(kind); } else if (!KeyType.IsValidDataKind(kind)) { itemType = PrimitiveType.FromKind(kind); return(false); } else { var key = typeSrc.ItemType.AsKey; ectx.Assert(KeyType.IsValidDataKind(key.RawKind)); int count = key.Count; // Technically, it's an error for the counts not to match, but we'll let the Conversions // code return false below. There's a possibility we'll change the standard conversions to // map out of bounds values to zero, in which case, this is the right thing to do. ulong max = kind.ToMaxInt(); if ((ulong)count > max) { count = (int)max; } itemType = new KeyType(kind, key.Min, count, key.Contiguous); } // Ensure that the conversion is legal. We don't actually cache the delegate here. It will get // re-fetched by the utils code when needed. bool identity; Delegate del; if (!Conversions.Instance.TryGetStandardConversion(typeSrc.ItemType, itemType, out del, out identity)) { return(false); } ColumnType typeDst = itemType; if (typeSrc.IsVector) { typeDst = new VectorType(itemType, typeSrc.AsVector); } // An output column is transposable iff the input column was transposable. VectorType slotType = null; if (info.SlotTypeSrc != null) { slotType = new VectorType(itemType, info.SlotTypeSrc); } ex = new ColInfoEx(kind, range != null, typeDst, slotType); return(true); }
/// <summary> /// Extracting the data from the stream /// </summary> public override void extractData() { BiffHeader bh, latestbiff; BOF firstBOF = null; //try //{ while (this.StreamReader.BaseStream.Position < this.StreamReader.BaseStream.Length) { bh.id = (RecordType)this.StreamReader.ReadUInt16(); bh.length = this.StreamReader.ReadUInt16(); TraceLogger.DebugInternal("BIFF {0}\t{1}\t", bh.id, bh.length); switch (bh.id) { case RecordType.EOF: { this.StreamReader.BaseStream.Seek(0, SeekOrigin.End); } break; case RecordType.BOF: { BOF bof = new BOF(this.StreamReader, bh.id, bh.length); switch (bof.docType) { case BOF.DocumentType.WorkbookGlobals: case BOF.DocumentType.Worksheet: firstBOF = bof; break; case BOF.DocumentType.Chart: // parse chart break; default: this.readUnkownFile(); break; } } break; case RecordType.LabelSst: { LabelSst labelsst = new LabelSst(this.StreamReader, bh.id, bh.length); this.bsd.addLabelSST(labelsst); } break; case RecordType.MulRk: { MulRk mulrk = new MulRk(this.StreamReader, bh.id, bh.length); this.bsd.addMULRK(mulrk); } break; case RecordType.Number: { Number number = new Number(this.StreamReader, bh.id, bh.length); this.bsd.addNUMBER(number); } break; case RecordType.RK: { RK rk = new RK(this.StreamReader, bh.id, bh.length); this.bsd.addRK(rk); } break; case RecordType.MergeCells: { MergeCells mergecells = new MergeCells(this.StreamReader, bh.id, bh.length); this.bsd.MERGECELLSData = mergecells; } break; case RecordType.Blank: { Blank blankcell = new Blank(this.StreamReader, bh.id, bh.length); this.bsd.addBLANK(blankcell); } break; case RecordType.MulBlank: { MulBlank mulblank = new MulBlank(this.StreamReader, bh.id, bh.length); this.bsd.addMULBLANK(mulblank); } break; case RecordType.Formula: { Formula formula = new Formula(this.StreamReader, bh.id, bh.length); this.bsd.addFORMULA(formula); TraceLogger.DebugInternal(formula.ToString()); } break; case RecordType.Array: { ARRAY array = new ARRAY(this.StreamReader, bh.id, bh.length); this.bsd.addARRAY(array); } break; case RecordType.ShrFmla: { ShrFmla shrfmla = new ShrFmla(this.StreamReader, bh.id, bh.length); this.bsd.addSharedFormula(shrfmla); } break; case RecordType.String: { STRING formulaString = new STRING(this.StreamReader, bh.id, bh.length); this.bsd.addFormulaString(formulaString.value); } break; case RecordType.Row: { Row row = new Row(this.StreamReader, bh.id, bh.length); this.bsd.addRowData(row); } break; case RecordType.ColInfo: { ColInfo colinfo = new ColInfo(this.StreamReader, bh.id, bh.length); this.bsd.addColData(colinfo); } break; case RecordType.DefColWidth: { DefColWidth defcolwidth = new DefColWidth(this.StreamReader, bh.id, bh.length); this.bsd.addDefaultColWidth(defcolwidth.cchdefColWidth); } break; case RecordType.DefaultRowHeight: { DefaultRowHeight defrowheigth = new DefaultRowHeight(this.StreamReader, bh.id, bh.length); this.bsd.addDefaultRowData(defrowheigth); } break; case RecordType.LeftMargin: { LeftMargin leftm = new LeftMargin(this.StreamReader, bh.id, bh.length); this.bsd.leftMargin = leftm.value; } break; case RecordType.RightMargin: { RightMargin rightm = new RightMargin(this.StreamReader, bh.id, bh.length); this.bsd.rightMargin = rightm.value; } break; case RecordType.TopMargin: { TopMargin topm = new TopMargin(this.StreamReader, bh.id, bh.length); this.bsd.topMargin = topm.value; } break; case RecordType.BottomMargin: { BottomMargin bottomm = new BottomMargin(this.StreamReader, bh.id, bh.length); this.bsd.bottomMargin = bottomm.value; } break; case RecordType.Setup: { Setup setup = new Setup(this.StreamReader, bh.id, bh.length); this.bsd.addSetupData(setup); } break; case RecordType.HLink: { long oldStreamPos = this.StreamReader.BaseStream.Position; try { HLink hlink = new HLink(this.StreamReader, bh.id, bh.length); bsd.addHyperLinkData(hlink); } catch (Exception ex) { this.StreamReader.BaseStream.Seek(oldStreamPos, System.IO.SeekOrigin.Begin); this.StreamReader.BaseStream.Seek(bh.length, System.IO.SeekOrigin.Current); TraceLogger.Debug("Link parse error"); TraceLogger.Error(ex.StackTrace); } } break; case RecordType.MsoDrawing: { // Record header has already been read. Reset position to record beginning. this.StreamReader.BaseStream.Position -= 2 * sizeof(UInt16); this.bsd.ObjectsSequence = new ObjectsSequence(this.StreamReader); } break; default: { // this else statement is used to read BiffRecords which aren't implemented byte[] buffer = new byte[bh.length]; buffer = this.StreamReader.ReadBytes(bh.length); } break; } latestbiff = bh; } //} //catch (Exception ex) //{ // TraceLogger.Error(ex.Message); // TraceLogger.Error(ex.StackTrace); // TraceLogger.Debug(ex.ToString()); //} }
public DummyFrom() { Cols = new ColInfo( new string[0], new DataType[0] ); }
private ValueGetter <ushort> CreateUInt16GetterDelegate(ColInfo colInfo) { int columnIndex = GetColumnIndex(colInfo); return((ref ushort value) => value = (ushort)DataReader.GetInt16(columnIndex)); }
private ValueGetter <long> CreateInt64GetterDelegate(ColInfo colInfo) { int columnIndex = GetColumnIndex(colInfo); return((ref long value) => value = DataReader.GetInt64(columnIndex)); }
private ValueGetter <int> CreateInt32GetterDelegate(ColInfo colInfo) { int columnIndex = GetColumnIndex(colInfo); return((ref int value) => value = DataReader.GetInt32(columnIndex)); }
private ValueGetter <DateTime> CreateDateTimeGetterDelegate(ColInfo colInfo) { int columnIndex = GetColumnIndex(colInfo); return((ref DateTime value) => value = DataReader.GetDateTime(columnIndex)); }
private IEnumerable <KeyValuePair <string, ColumnType> > GetTypesCore(int index, ColInfo info) { Contracts.Assert(_sealed); Contracts.AssertValue(info); HashSet <string> kinds = null; if (info.GetterCount > 0) { if (info.SchemaSrc != null) { kinds = new HashSet <string>(); } foreach (var g in info.Getters) { yield return(new KeyValuePair <string, ColumnType>(g.Kind, g.Type)); if (kinds != null) { kinds.Add(g.Kind); } } } if (info.SchemaSrc == null) { yield break; } // Pass through from base, with filtering. foreach (var kvp in info.SchemaSrc[info.IndexSrc].Metadata.Schema.Select(c => new KeyValuePair <string, ColumnType>(c.Name, c.Type))) { if (kinds != null && kinds.Contains(kvp.Key)) { continue; } if (info.FilterSrc != null && !info.FilterSrc(kvp.Key, index)) { continue; } yield return(kvp); } }
private ValueGetter <double> CreateDoubleGetterDelegate(ColInfo colInfo) { int columnIndex = GetColumnIndex(colInfo); return((ref double value) => value = DataReader.IsDBNull(columnIndex) ? double.NaN : DataReader.GetDouble(columnIndex)); }
// Computes the column type and whether multiple indicator vectors need to be concatenated. // Also populates the metadata. private static void ComputeType(KeyToVectorTransform trans, ISchema input, int iinfo, ColInfo info, bool bag, MetadataDispatcher md, out VectorType type, out bool concat) { Contracts.AssertValue(trans); Contracts.AssertValue(input); Contracts.AssertValue(info); Contracts.Assert(info.TypeSrc.ItemType.IsKey); Contracts.AssertValue(md); int size = info.TypeSrc.ItemType.KeyCount; Contracts.Assert(size > 0); // See if the source has key names. var typeNames = input.GetMetadataTypeOrNull(MetadataUtils.Kinds.KeyValues, info.Source); if (typeNames == null || !typeNames.IsKnownSizeVector || !typeNames.ItemType.IsText || typeNames.VectorSize != size) { typeNames = null; } // Don't pass through any source column metadata. using (var bldr = md.BuildMetadata(iinfo)) { if (bag || info.TypeSrc.ValueCount == 1) { // Output is a single vector computed as the sum of the output indicator vectors. concat = false; type = new VectorType(NumberType.Float, size); if (typeNames != null) { bldr.AddGetter <VBuffer <DvText> >(MetadataUtils.Kinds.SlotNames, typeNames, trans.GetKeyNames); } } else { // Output is the concatenation of the multiple output indicator vectors. concat = true; type = new VectorType(NumberType.Float, info.TypeSrc.ValueCount, size); if (typeNames != null && type.VectorSize > 0) { bldr.AddGetter <VBuffer <DvText> >(MetadataUtils.Kinds.SlotNames, new VectorType(TextType.Instance, type), trans.GetSlotNames); } } if (!bag && info.TypeSrc.ValueCount > 0) { bldr.AddGetter <VBuffer <DvInt4> >(MetadataUtils.Kinds.CategoricalSlotRanges, MetadataUtils.GetCategoricalType(info.TypeSrc.ValueCount), trans.GetCategoricalSlotRanges); } if (!bag || info.TypeSrc.ValueCount == 1) { bldr.AddPrimitive(MetadataUtils.Kinds.IsNormalized, BoolType.Instance, DvBool.True); } } }
private ValueGetter <sbyte> CreateSByteGetterDelegate(ColInfo colInfo) { int columnIndex = GetColumnIndex(colInfo); return((ref sbyte value) => value = DataReader.IsDBNull(columnIndex) ? default : (sbyte)DataReader.GetByte(columnIndex)); }
private ColumnOptions CreateColumnOptionsEx(bool join, string customSlotMap, int numberOfBits, uint hashSeed, bool ordered, ColInfo colInfo) { int[][] slotMap = null; if (colInfo.TypeSrc is VectorDataViewType vectorType) { // fill in the slot map if (!string.IsNullOrWhiteSpace(customSlotMap)) { slotMap = CompileSlotMap(customSlotMap, vectorType.Size); } else { slotMap = CreateDefaultSlotMap(join, vectorType.Size); } Host.Assert(Utils.Size(slotMap) >= 1); } return(new ColumnOptions(slotMap, numberOfBits, hashSeed, ordered)); }
private ValueGetter <ReadOnlyMemory <char> > CreateStringGetterDelegate(ColInfo colInfo) { int columnIndex = GetColumnIndex(colInfo); return((ref ReadOnlyMemory <char> value) => value = DataReader.IsDBNull(columnIndex) ? default : DataReader.GetString(columnIndex).AsMemory()); }
private ColumnInfoEx CreateColumnInfoEx(bool join, string customSlotMap, int hashBits, uint hashSeed, bool ordered, ColInfo colInfo) { int[][] slotMap = null; if (colInfo.TypeSrc.IsVector) { // fill in the slot map if (!string.IsNullOrWhiteSpace(customSlotMap)) { slotMap = CompileSlotMap(customSlotMap, colInfo.TypeSrc.ValueCount); } else { slotMap = CreateDefaultSlotMap(join, colInfo.TypeSrc.ValueCount); } Host.Assert(Utils.Size(slotMap) >= 1); } return(new ColumnInfoEx(slotMap, hashBits, hashSeed, ordered)); }
private ValueGetter <ulong> CreateUInt64GetterDelegate(ColInfo colInfo) { int columnIndex = GetColumnIndex(colInfo); return((ref ulong value) => value = DataReader.IsDBNull(columnIndex) ? default : (ulong)DataReader.GetInt64(columnIndex)); }
private void BuildInfos(out ColInfo[] infosArray, out Dictionary <string, int> nameToCol, bool user) { var raws = RawInfos; var tops = new List <int>(); bool rename = false; Dictionary <string, List <int> > dups = null; if (raws.Length == 0) { // Empty raws means take all with default HiddenColumnOption. var rawList = new List <RawColInfo>(); for (int col = 0; col < Input.ColumnCount; col++) { string src = Input.GetColumnName(col); int tmp; if (!Input.TryGetColumnIndex(src, out tmp)) { Contracts.Assert(false, "Why couldn't the schema find the name?"); continue; } if (tmp == col) { var raw = new RawColInfo(src, src, HidDefault); rawList.Add(raw); tops.Add(col); } else if (HidDefault != HiddenColumnOption.Drop) { if (dups == null) { dups = new Dictionary <string, List <int> >(); } List <int> list; if (!dups.TryGetValue(src, out list)) { dups[src] = list = new List <int>(); } list.Add(col); } } if (dups != null && HidDefault == HiddenColumnOption.Rename) { rename = true; } raws = rawList.ToArray(); } else { for (int i = 0; i < raws.Length; i++) { var raw = raws[i]; int col; if (!Input.TryGetColumnIndex(raw.Source, out col)) { throw user? Contracts.ExceptUserArg(nameof(Arguments.Column), "source column '{0}' not found", raw.Source) : Contracts.ExceptDecode("source column '{0}' not found", raw.Source); } tops.Add(col); if (raw.Hid != HiddenColumnOption.Drop) { if (dups == null) { dups = new Dictionary <string, List <int> >(); } dups[raw.Source] = null; if (raw.Hid == HiddenColumnOption.Rename) { rename = true; } } } if (dups != null) { for (int col = 0; col < Input.ColumnCount; col++) { string src = Input.GetColumnName(col); List <int> list; if (!dups.TryGetValue(src, out list)) { continue; } int tmp; if (!Input.TryGetColumnIndex(src, out tmp)) { Contracts.Assert(false, "Why couldn't the schema find the name?"); continue; } if (tmp == col) { continue; } if (list == null) { dups[src] = list = new List <int>(); } list.Add(col); } } } Contracts.Assert(tops.Count == raws.Length); HashSet <string> names = null; if (rename) { names = new HashSet <string>(raws.Select(r => r.Name)); } var infos = new List <ColInfo>(); for (int i = 0; i < raws.Length; i++) { var raw = raws[i]; int colSrc; ColumnType type; ColInfo info; // Handle dups. List <int> list; if (raw.Hid != HiddenColumnOption.Drop && dups != null && dups.TryGetValue(raw.Source, out list) && list != null) { int iinfo = infos.Count; int inc = 0; for (int iv = list.Count; --iv >= 0;) { colSrc = list[iv]; type = Input.GetColumnType(colSrc); string name = raw.Name; if (raw.Hid == HiddenColumnOption.Rename) { name = GetUniqueName(names, name, ref inc); } info = new ColInfo(name, colSrc, type); infos.Insert(iinfo, info); } } colSrc = tops[i]; type = Input.GetColumnType(colSrc); info = new ColInfo(raw.Name, colSrc, type); infos.Add(info); } infosArray = infos.ToArray(); nameToCol = new Dictionary <string, int>(Infos.Length); for (int iinfo = 0; iinfo < Infos.Length; iinfo++) { nameToCol[Infos[iinfo].Name] = iinfo; } }
private protected virtual bool SaveAsOnnxCore(OnnxContext ctx, int iinfo, ColInfo info, string srcVariableName, string dstVariableName) => false;
private ValueGetter <bool> CreateBooleanGetterDelegate(ColInfo colInfo) { int columnIndex = GetColumnIndex(colInfo); return((ref bool value) => value = DataReader.IsDBNull(columnIndex) ? default : DataReader.GetBoolean(columnIndex)); }
void Start() { health = transform.root.GetComponent<Health> (); if (!hitbox) hitbox = transform.root.GetComponent<ColInfo> (); if (!FX) FX = GetComponentInChildren<ParticleSystem> (); GetComponent<Collider> ().enabled = false; }
private ValueGetter <byte> CreateByteGetterDelegate(ColInfo colInfo) { int columnIndex = GetColumnIndex(colInfo); return((ref byte value) => value = DataReader.GetByte(columnIndex)); }
public Average Column(ColInfo c) { var a = new Average(); var q = from w in Weeks from m in w.Meetings where c.Times.Contains(m.date.TimeOfDay) group m by w.Sunday into g select g.Sum(mm => mm.Present); if (q.Count() == 0) a.avg = 0; else a.avg = q.Average(); a.totalpeople = q.Sum(); a.totalmeetings = q.Count(); return a; }
private ValueGetter <VBuffer <ushort> > CreateVBufferUInt16GetterDelegate(ColInfo colInfo) { return((ref VBuffer <ushort> value) => { int length = colInfo.SizeBase; var editor = VBufferEditor.Create(ref value, length); int i = 0; var segs = colInfo.Segments; foreach (var seg in segs) { if (seg.Name is null) { for (int columnIndex = seg.Min; columnIndex < seg.Lim; columnIndex++, i++) { editor.Values[i] = DataReader.IsDBNull(columnIndex) ? default : (ushort)DataReader.GetInt16(columnIndex); } } else { var columnIndex = DataReader.GetOrdinal(seg.Name); editor.Values[i++] = DataReader.IsDBNull(columnIndex) ? default : (ushort)DataReader.GetInt16(columnIndex); } } value = editor.Commit(); }); }