当前位置: 首页>>代码示例>>C#>>正文


C# Index类代码示例

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


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


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