• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Index类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Index的典型用法代码示例。如果您正苦于以下问题:C# Index类的具体用法?C# Index怎么用?C# Index使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Index类属于命名空间,在下文中一共展示了Index类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CreateIndexesForForeignKeys

    public static void CreateIndexesForForeignKeys(this Configuration configuration,
			Func<string, bool> includeTablePredicate)
    {
        configuration.BuildMappings();
            var tables = (ICollection<Table>) tableMappingsProperty.GetValue(configuration, null);
            foreach (var table in tables.Where(x => includeTablePredicate(x.Name)))
            {
                var columnsOfPk = table.HasPrimaryKey ? table.PrimaryKey.Columns.Select(x => x.Name).ToArray() : new string[0];
                foreach (var foreignKey in table.ForeignKeyIterator)
                {
                    if (table.HasPrimaryKey)
                    {
                        var columnsOfFk = foreignKey.Columns.Select(x => x.Name).ToArray();
                        var fkHasSameColumnsOfPk = !columnsOfPk.Except(columnsOfFk).Concat(columnsOfFk.Except(columnsOfPk)).Any();
                        if (fkHasSameColumnsOfPk)
                        {
                            continue;
                        }
                    }
                    var idx = new Index();
                    idx.AddColumns(foreignKey.Columns);
                    idx.Name = "IX" + foreignKey.Name.Substring(2);
                    idx.Table = table;
                    table.AddIndex(idx);
                }
            }
    }
开发者ID:csokun,项目名称:WebApiNHibernate,代码行数:27,代码来源:NHibernateIndexSnippet.cs


示例2: Build

 public virtual void Build(MetricDB db, int num_pairs, int maxCandidates = -1)
 {
     this.DB = db;
     this.Fingerprints = new BinQ8HammingSpace (1);
     this.Sample = new SampleSpace("", this.DB, num_pairs * 2);
     this.MaxCandidates = maxCandidates;
     var n = this.DB.Count;
     var A = new byte[n][];
     int pc = this.DB.Count / 100 + 1;
     int advance = 0;
     var create_one = new Action<int> (delegate(int i) {
         var fp = this.GetFP(this.DB[i]);
         A[i] = fp;
         if (advance % pc == 0) {
             Console.WriteLine ("DEBUG {0}  ({1}/{2}), db: {3}, num_pairs: {4}, timestamp: {5}", this, advance, n, db.Name, num_pairs, DateTime.Now);
         }
         advance++;
     });
     ParallelOptions ops = new ParallelOptions();
     ops.MaxDegreeOfParallelism = -1;
     Parallel.For (0, n, create_one);
     foreach (var fp in A) {
         this.Fingerprints.Add( fp );
     }
     var s = new Sequential ();
     s.Build (this.Fingerprints);
     this.InternalIndex = s;
 }
开发者ID:KeithNel,项目名称:natix,代码行数:28,代码来源:HyperplaneFP.cs


示例3: sqlite3IndexAffinityStr

 /*
 ** Return a pointer to the column affinity string associated with index
 ** pIdx. A column affinity string has one character for each column in 
 ** the table, according to the affinity of the column:
 **
 **  Character      Column affinity
 **  ------------------------------
 **  'a'            TEXT
 **  'b'            NONE
 **  'c'            NUMERIC
 **  'd'            INTEGER
 **  'e'            REAL
 **
 ** An extra 'b' is appended to the end of the string to cover the
 ** rowid that appears as the last column in every index.
 **
 ** Memory for the buffer containing the column index affinity string
 ** is managed along with the rest of the Index structure. It will be
 ** released when sqlite3DeleteIndex() is called.
 */
 static string sqlite3IndexAffinityStr( Vdbe v, Index pIdx )
 {
   if ( pIdx.zColAff == null || pIdx.zColAff[0] == '\0' )
   {
     /* The first time a column affinity string for a particular index is
     ** required, it is allocated and populated here. It is then stored as
     ** a member of the Index structure for subsequent use.
     **
     ** The column affinity string will eventually be deleted by
     ** sqliteDeleteIndex() when the Index structure itself is cleaned
     ** up.
     */
     int n;
     Table pTab = pIdx.pTable;
     sqlite3 db = sqlite3VdbeDb( v );
     StringBuilder pIdx_zColAff = new StringBuilder( pIdx.nColumn + 2 );// (char )sqlite3DbMallocRaw(0, pIdx->nColumn+2);
     //      if ( pIdx_zColAff == null )
     //      {
     //        db.mallocFailed = 1;
     //        return null;
     //      }
     for ( n = 0; n < pIdx.nColumn; n++ )
     {
       pIdx_zColAff.Append( pTab.aCol[pIdx.aiColumn[n]].affinity );
     }
     pIdx_zColAff.Append( SQLITE_AFF_NONE );
     pIdx_zColAff.Append( '\0' );
     pIdx.zColAff = pIdx_zColAff.ToString();
   }
   return pIdx.zColAff;
 }
开发者ID:Gillardo,项目名称:Cordova-SQLitePlugin,代码行数:51,代码来源:insert_c.cs


示例4: GetAutoIndex

        internal Index GetAutoIndex()
        {
            Index index = new Index();
            index.SetLocation(UriHelper.ConcatUri(GraphEnvironment.GetBaseUri(),"db/data/index/auto/node"));

            return index;
        }
开发者ID:sonyarouje,项目名称:Neo4jD,代码行数:7,代码来源:IndexRepo.cs


示例5: Dispose

 public void Dispose()
 {
     if (Index != null)
      {
     Index = null;
      }
 }
开发者ID:golden86,项目名称:ItemBuckets,代码行数:7,代码来源:Searcher.cs


示例6: FlannColoredModelPoints

        public FlannColoredModelPoints(List<Tuple<CvPoint3D64f, CvColor>> modelPoints, IndexParams indexParams, SearchParams searchParams, double colorScale)
        {
            _modelPoints = modelPoints;

            _modelMat = new CvMat(_modelPoints.Count, 6, MatrixType.F32C1);
            unsafe
            {
                float* modelArr = _modelMat.DataSingle;
                foreach (var tuple in _modelPoints)
                {
                    *(modelArr++) = (float)tuple.Item1.X;
                    *(modelArr++) = (float)tuple.Item1.Y;
                    *(modelArr++) = (float)tuple.Item1.Z;
                    *(modelArr++) = (float)(tuple.Item2.R * colorScale / 255);
                    *(modelArr++) = (float)(tuple.Item2.G * colorScale / 255);
                    *(modelArr++) = (float)(tuple.Item2.B * colorScale / 255);
                }
            }
            _colorScale = colorScale;
            _modelDataMat = new Mat(_modelMat);
            _indexParam = indexParams;
            _searchParam = searchParams;
            _indexParam.IsEnabledDispose = false;
            _searchParam.IsEnabledDispose = false;
            _flannIndex = new Index(_modelDataMat, _indexParam);
        }
开发者ID:guozanhua,项目名称:KinectMotionCapture,代码行数:26,代码来源:ColoredIterativePointMatching.cs


示例7: InnerInvoke

        async Task InnerInvoke(Context context, Index index)
        {
            ElementInstance element;
            for (int i = index.Value; i < executingElements.Count; i++)
            {
                index.Value = i;
                element = executingElements[index.Value];
                if (element.IsBefore)
                {
                    await element.Invoke(context, ctx => Task.CompletedTask).ConfigureAwait(false);
                    continue;
                }

                if (element.IsSurround)
                {
                    index.Value += 1;
                    await element.Invoke(context, ctx => InnerInvoke(ctx, index)).ConfigureAwait(false);
                    i = index.Value++;
                    continue;
                }

                if (element.IsAfter)
                {
                    afterElements.Push(Tuple.Create(context, element));
                }
            }

            if (index.Value == executingElements.Count)
            {
                foreach (var contextAndElement in afterElements)
                {
                    await contextAndElement.Item2.Invoke(contextAndElement.Item1, ctx => Task.CompletedTask).ConfigureAwait(false);
                }
            }
        }
开发者ID:danielmarbach,项目名称:async-dolls,代码行数:35,代码来源:Chain.cs


示例8: set

 public void set(BaseSprite spr)
 {
     this.sprite = spr;
     Debug.Assert(sprite != null);
     this.name = (SpriteEnum)spr.getName();
     this.index = spr.getIndex();
 }
开发者ID:frobro98,项目名称:School-Projects,代码行数:7,代码来源:SpriteBatchNode.cs


示例9: sqlite3IndexKeyinfo

 // Return a dynamicly allocated KeyInfo structure that can be used with OP_OpenRead or OP_OpenWrite to access database index pIdx.
 //
 // If successful, a pointer to the new structure is returned. In this case the caller is responsible for calling sqlite3DbFree(db, ) on the returned
 // pointer. If an error occurs (out of memory or missing collation sequence), NULL is returned and the state of pParse updated to reflect
 // the error.
 internal static KeyInfo sqlite3IndexKeyinfo(Parse pParse, Index pIdx)
 {
     var nCol = pIdx.nColumn;
     var db = pParse.db;
     var pKey = new KeyInfo();
     if (pKey != null)
     {
         pKey.db = pParse.db;
         pKey.aSortOrder = new byte[nCol];
         pKey.aColl = new CollSeq[nCol];
         for (var i = 0; i < nCol; i++)
         {
             var zColl = pIdx.azColl[i];
             Debug.Assert(zColl != null);
             pKey.aColl[i] = sqlite3LocateCollSeq(pParse, zColl);
             pKey.aSortOrder[i] = pIdx.aSortOrder[i];
         }
         pKey.nField = (ushort)nCol;
     }
     if (pParse.nErr != 0)
     {
         pKey = null;
         sqlite3DbFree(db, ref pKey);
     }
     return pKey;
 }
开发者ID:JiujiangZhu,项目名称:feaserver,代码行数:31,代码来源:Build.cs


示例10: ProcessQuery

        /// <summary>
        /// The process query.
        /// </summary>
        /// <param name="condition">
        /// The condition.
        /// </param>
        /// <param name="index">
        /// The index.
        /// </param>
        /// <returns>
        /// The <see cref="BooleanQuery"/>.
        /// </returns>
        public override Query ProcessQuery(QueryOccurance condition, Index index)
        {
            Assert.ArgumentNotNull(index, "Index");

            var baseQuery = base.ProcessQuery(condition, index);

            var translator = new QueryTranslator(index);
            Assert.IsNotNull(translator, "translator");

            var fieldQuery = this.Partial ? QueryBuilder.BuildPartialFieldValueClause(index, this.FieldName, this.FieldValue) :
                                            QueryBuilder.BuildExactFieldValueClause(index, this.FieldName, this.FieldValue);

            if (baseQuery == null)
            {
                return fieldQuery;
            }

            if (baseQuery is BooleanQuery)
            {
                var booleanQuery = baseQuery as BooleanQuery;
                booleanQuery.Add(fieldQuery, translator.GetOccur(condition));
            }

            return baseQuery;
        }
开发者ID:NetworkTen,项目名称:SitecoreSearchContrib,代码行数:37,代码来源:FieldSearchParam.cs


示例11: ObservableModelNode

        /// <summary>
        /// Initializes a new instance of the <see cref="ObservableModelNode"/> class.
        /// </summary>
        /// <param name="ownerViewModel">The <see cref="ObservableViewModel"/> that owns the new <see cref="ObservableModelNode"/>.</param>
        /// <param name="baseName">The base name of this node. Can be null if <see cref="index"/> is not. If so a name will be automatically generated from the index.</param>
        /// <param name="isPrimitive">Indicate whether this node should be considered as a primitive node.</param>
        /// <param name="sourceNode">The model node bound to the new <see cref="ObservableModelNode"/>.</param>
        /// <param name="graphNodePath">The <see cref="GraphNodePath"/> corresponding to the given <see cref="sourceNode"/>.</param>
        /// <param name="index">The index of this content in the model node, when this node represent an item of a collection. <see cref="Index.Empty"/> must be passed otherwise</param>
        protected ObservableModelNode(ObservableViewModel ownerViewModel, string baseName, bool isPrimitive, IGraphNode sourceNode, GraphNodePath graphNodePath, Index index)
            : base(ownerViewModel, baseName, index)
        {
            if (sourceNode == null) throw new ArgumentNullException(nameof(sourceNode));
            if (baseName == null && index == null)
                throw new ArgumentException("baseName and index can't be both null.");

            this.isPrimitive = isPrimitive;
            SourceNode = sourceNode;
            // By default we will always combine items of list of primitive items.
            CombineMode = !index.IsEmpty && isPrimitive ? CombineMode.AlwaysCombine : CombineMode.CombineOnlyForAll;
            SourceNodePath = graphNodePath;

            // Override display name if available
            var memberDescriptor = GetMemberDescriptor() as MemberDescriptorBase;
            if (memberDescriptor != null)
            {
                if (index.IsEmpty)
                {
                    var displayAttribute = TypeDescriptorFactory.Default.AttributeRegistry.GetAttribute<DisplayAttribute>(memberDescriptor.MemberInfo);
                    if (!string.IsNullOrEmpty(displayAttribute?.Name))
                    {
                        DisplayName = displayAttribute.Name;
                    }
                    IsReadOnly = !memberDescriptor.HasSet;
                }
            }
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:37,代码来源:ObservableModelNode.cs


示例12: Build

        public void Build(MetricDB db, int k, Index ref_index)
        {
            this.DB = db;
            this.K = k;
            this.R = ref_index;
            int sigma = this.R.DB.Count;
            this.INVINDEX = new List<List<int>> (sigma);
            for (int i = 0; i < sigma; ++i) {
                this.INVINDEX.Add(new List<int>());
            }
            var A = new int[this.DB.Count][];
            int count = 0;
            var compute_one = new Action<int>(delegate(int objID) {
                var u = this.GetKnr(this.DB[objID], this.K);
                A[objID] = u;
                ++count;
                if (count % 1000 == 0) {
                    Console.WriteLine ("==== {0}/{1} db: {2}, k: {3}", count, this.DB.Count, this.DB.Name, k);
                }
            });
            ParallelOptions ops = new ParallelOptions();
            ops.MaxDegreeOfParallelism = -1;
            Parallel.ForEach(new ListGen<int>((int i) => i, this.DB.Count), ops, compute_one);

            for (int objID = 0; objID < this.DB.Count; ++objID) {
                var u = A[objID];
                for (int i = 0; i < this.K; ++i) {
                    this.INVINDEX[u[i]].Add (objID);
                }
            }
        }
开发者ID:KeithNel,项目名称:natix,代码行数:31,代码来源:NappHash.cs


示例13: set

 public void set(SpriteEnum sName, ImageEnum iName, Index index = Index.Index_Null)
 {
     this.name = sName;
     this.index = index;
     sprite = GameSpriteManager.find(sName, index);
     imgToSwap = ImageManager.find(iName);
 }
开发者ID:frobro98,项目名称:School-Projects,代码行数:7,代码来源:AnimatedSprite.cs


示例14: AnimatedSprite

 public AnimatedSprite()
 {
     name = SpriteEnum.Not_Initialized;
     index = Index.Index_Null;
     sprite = null;
     imgToSwap = null;
 }
开发者ID:frobro98,项目名称:School-Projects,代码行数:7,代码来源:AnimatedSprite.cs


示例15: Retrieve

        /// <summary>
        /// Retrieves the value itself or the value of one of its item, depending on the given <see cref="Index"/>.
        /// </summary>
        /// <param name="value">The value on which this method applies.</param>
        /// <param name="index">The index of the item to retrieve. If <see cref="Index.Empty"/> is passed, this method will return the value itself.</param>
        /// <param name="descriptor">The descriptor of the type of <paramref name="value"/>.</param>
        /// <returns>The value itself or the value of one of its item.</returns>
        public static object Retrieve(object value, Index index, ITypeDescriptor descriptor)
        {
            if (index.IsEmpty)
                return value;

            if (value == null) throw new ArgumentNullException(nameof(value));

            var collectionDescriptor = descriptor as CollectionDescriptor;
            if (collectionDescriptor != null)
            {
                return collectionDescriptor.GetValue(value, index.Int);
            }
            var dictionaryDescriptor = descriptor as DictionaryDescriptor;
            if (dictionaryDescriptor != null)
            {
                return dictionaryDescriptor.GetValue(value, index.Value);
            }

            // Try with the concrete type descriptor
            var objectDescriptor = TypeDescriptorFactory.Default.Find(value.GetType());
            if (objectDescriptor != descriptor)
            {
                return Retrieve(value, index, objectDescriptor);
            }

            throw new NotSupportedException("Unable to retrieve the value at the given index, this collection is unsupported");
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:34,代码来源:Content.cs


示例16: ExecuteSync

        protected override void ExecuteSync(IContent content, Index index, object parameter)
        {
            var value = content.Retrieve(index);
            var collectionDescriptor = (CollectionDescriptor)TypeDescriptorFactory.Default.Find(value.GetType());

            object itemToAdd = null;
            var elementType = collectionDescriptor.ElementType;
            if (CanAddNull(elementType) || IsReferenceType(elementType))
            {
                // If the parameter is a type instead of an instance, try to construct an instance of this type
                var type = parameter as Type;
                if (type?.GetConstructor(Type.EmptyTypes) != null)
                    itemToAdd = ObjectFactoryRegistry.NewInstance(type);
            }
            else if (collectionDescriptor.ElementType == typeof(string))
            {
                itemToAdd = parameter ?? "";
            }
            else
            {
                itemToAdd = parameter ?? ObjectFactoryRegistry.NewInstance(collectionDescriptor.ElementType);
            }
            if (index.IsEmpty)
            {
                content.Add(itemToAdd);
            }
            else
            {
                // Handle collections in collections
                // TODO: this is not working on the observable node side
                var collectionNode = content.Reference.AsEnumerable[index].TargetNode;
                collectionNode.Content.Add(itemToAdd);
            }
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:34,代码来源:AddNewItemCommand.cs


示例17: TestInitialize

 public void TestInitialize()
 {
     _testApiKey = Environment.GetEnvironmentVariable("ALGOLIA_API_KEY");
     _testApplicationID = Environment.GetEnvironmentVariable("ALGOLIA_APPLICATION_ID");
     _client = new AlgoliaClient(_testApplicationID, _testApiKey);
     _index = _client.InitIndex(safe_name("àlgol?à-csharp"));
 }
开发者ID:james-andrewsmith,项目名称:algoliasearch-client-csharp,代码行数:7,代码来源:UnitTest1.cs


示例18: BuildingSpot

 public BuildingSpot(Tile firstTile, Tile secondTile)
 {
     building = Building.None;
     FirstTile = firstTile;
     SecondTile = secondTile;
     SpotIndex = new Index(FirstTile, SecondTile);
 }
开发者ID:whyisthearray,项目名称:smthng,代码行数:7,代码来源:BuildingSpot.cs


示例19: create

        public static ShieldBlock create(ShieldBlock.LeftTopBlock type, Index index, float x, float y)
        {
            ShieldBlock block;
            if (index.Equals(Index.Index_0))
            {
                block = new ShieldBlock(GameObject.Name.Shields, index, SpriteEnum.LeftTop_0, x, y);
            }
            else if (index.Equals(Index.Index_1))
            {
                block = new ShieldBlock(GameObject.Name.Shields, index, SpriteEnum.LeftTop_1, x, y);
            }
            else if (index.Equals(Index.Index_2))
            {
                block = new ShieldBlock(GameObject.Name.Shields, index, SpriteEnum.LeftTop_2, x, y);
            }
            else
            {
                block = new ShieldBlock(GameObject.Name.Shields, index, SpriteEnum.LeftTop_3, x, y);
            }

            GameObjectManager.insert(block, Instance.root);
            Instance.batch.attach(block.Spr);
            SpriteBatchManager.attachToGroup(block.ColObj.Spr, BatchGroup.BatchType.Collisions);
            return block;
        }
开发者ID:frobro98,项目名称:School-Projects,代码行数:25,代码来源:ShieldFactory.cs


示例20: GetButtonDown

 public static bool GetButtonDown(Button button, Index controlIndex)
 {
     KeyCode code = GetKeycode(button, controlIndex);
     bool aux = Input.GetKeyDown(code);
     if (!aux && (int)controlIndex < 3) //miramos el PC
     {
         string xName = "";
         switch (button)
         {
             case Button.A:
                 xName = "1_Action_" + (int)controlIndex;
                 break;
             case Button.B:
                 xName = "2_Action_" + (int)controlIndex;
                 break;
             case Button.Y:
                 xName = "3_Action_" + (int)controlIndex;
                 break;
             case Button.X:
                 xName = "4_Action_" + (int)controlIndex;
                 break;
         }
         aux = Input.GetAxis(xName) > 0.0f;
     }
     return aux;
 }
开发者ID:DanielParra159,项目名称:GGJ2016,代码行数:26,代码来源:GamePad.cs



注:本文中的Index类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Index3类代码示例发布时间:2022-05-24
下一篇:
C# IndentedTextWriter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap