IndexFor() static private method

Returns index for hash code h.
static private IndexFor ( int h, int length ) : int
h int
length int
return int
        private bool AddLabelOffsetToHashArray(HashArray a, int hash, int ordinal, int knownOffset)
        {
            int index  = CompactLabelToOrdinal.IndexFor(hash, a.offsets.Length);
            int offset = a.offsets[index];

            if (offset == 0)
            {
                a.offsets[index] = knownOffset;
                a.cids[index]    = ordinal;
                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
        private static bool AddLabelOffsetToHashArray(HashArray a, int hash, int ordinal, int knownOffset) // LUCENENET: CA1822: Mark members as static
        {
            int index  = CompactLabelToOrdinal.IndexFor(hash, a.offsets.Length);
            int offset = a.offsets[index];

            if (offset == 0)
            {
                a.offsets[index] = knownOffset;
                a.cids[index]    = ordinal;
                return(true);
            }

            return(false);
        }
        private bool AddLabel(HashArray a, FacetLabel label, int hash, int ordinal)
        {
            int index  = CompactLabelToOrdinal.IndexFor(hash, a.offsets.Length);
            int offset = a.offsets[index];

            if (offset == 0)
            {
                a.offsets[index] = this.labelRepository.Length;
                CategoryPathUtils.Serialize(label, labelRepository);
                a.cids[index] = ordinal;
                return(true);
            }

            return(false);
        }