Beispiel #1
0
        public SuffixArrayMatchFinder(FindLimitations limits, FindOptions options)
        {
            _array = new SuffixArray();

            FindLimitations = limits;
            FindOptions     = options;
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new instance of <see cref="HistoryMatchState"/>.
        /// </summary>
        /// <param name="input">The input this match represents.</param>
        /// <param name="startPosition">The position at which to start pre process.</param>
        /// <param name="limits">The limits to search sequences in.</param>
        /// <param name="unitSize">The size of a unit to be matched.</param>
        public HistoryMatchState(byte[] input, int startPosition, FindLimitations limits, UnitSize unitSize)
        {
            _limits = limits;

            _valueLength = Math.Min(3, limits.MinLength);
            switch (_valueLength)
            {
            case 3:
                _readValue = ReadValue3;
                break;

            case 2:
                _readValue = ReadValue2;
                break;

            default:
                _readValue = ReadValue1;
                break;
            }

            _unitSize = (int)unitSize;
            switch (unitSize)
            {
            case UnitSize.Byte:
                _calculateMatchSize = CalculateMatchSizeByte;
                break;

            case UnitSize.Short:
                _calculateMatchSize = CalculateMatchSizeShort;
                break;
            }

            PrepareOffsetTable(input, startPosition);
        }
Beispiel #3
0
        public StaticValueRleMatchFinder(byte valueToMatch, FindLimitations limits, FindOptions options)
        {
            _valueToMatch = valueToMatch;

            FindLimitations = limits;
            FindOptions     = options;
        }
        /// <inheritdoc cref="Dispose()"/>
        public void Dispose()
        {
            _offsetTable         = null;
            _reversedOffsetTable = null;

            _byteTable = null;
            _endTable  = null;

            _options = null;
            _limits  = null;
        }
Beispiel #5
0
        /// <summary>
        /// Creates a new instance of <see cref="HistoryMatchState"/>.
        /// </summary>
        /// <param name="input">The input this match represents.</param>
        /// <param name="limits">The limits to search sequences in.</param>
        /// <param name="unitSize">The size of a unit to be matched.</param>
        public HistoryMatchState(byte[] input, FindLimitations limits, UnitSize unitSize)
        {
            _limits = limits;

            // Determine unit size dependant delegates
            _unitSize = (int)unitSize;
            switch (unitSize)
            {
            case UnitSize.Byte:
                _calculateMatchSize = CalculateMatchSizeByte;
                break;

            case UnitSize.Short:
                _calculateMatchSize = CalculateMatchSizeShort;
                break;
            }

            // Determine value reading delegate, based on given limitations
            _valueLength = Math.Min(3, limits.MinLength) / _unitSize * _unitSize;
            switch (_valueLength)
            {
            case 3:
                _readValue = ReadValue3;
                break;

            case 2:
                _readValue = ReadValue2;
                break;

            default:
                _readValue = ReadValue1;
                break;
            }

            // Prepare chained list of offsets per value
            PrepareOffsetTable(input);
        }
Beispiel #6
0
 /// <summary>
 /// Creates a new instance of <see cref="HistoryMatchFinder"/>
 /// </summary>
 /// <param name="limits">The limits to search sequences in.</param>
 /// <param name="options">The options to search sequences with.</param>
 public HistoryMatchFinder(FindLimitations limits, FindOptions options)
 {
     FindLimitations = limits;
     FindOptions     = options;
 }
Beispiel #7
0
 /// <summary>
 /// Creates a new instance of <see cref="RleMatchFinder"/>.
 /// </summary>
 /// <param name="limits">The limits to search sequences in.</param>
 /// <param name="options">The options to search sequences with.</param>
 public RleMatchFinder(FindLimitations limits, FindOptions options) :
     base(limits, options)
 {
 }
Beispiel #8
0
 /// <summary>
 /// Creates a new instance of <see cref="HistoryMatchFinder"/>
 /// </summary>
 /// <param name="limits">The limits to search sequences in.</param>
 /// <param name="options">The options to search sequences with.</param>
 public HistoryMatchFinder(FindLimitations limits, FindOptions options) :
     base(limits, options)
 {
 }
Beispiel #9
0
 /// <summary>
 /// Creates a new instance of <see cref="RleMatchFinder"/>.
 /// </summary>
 /// <param name="limits">The limits to search sequences in.</param>
 /// <param name="options">The options to search sequences with.</param>
 public RleMatchFinder(FindLimitations limits, FindOptions options)
 {
     FindLimitations = limits;
     FindOptions     = options;
 }
Beispiel #10
0
        /// <inheritdoc />
        public void Dispose()
        {
            _offsetTable = null;

            _limits = null;
        }
 /// <summary>
 /// Creates a new instance of <see cref="HybridSuffixTreeMatchFinder"/>.
 /// </summary>
 /// <param name="limits">The search limitations to find pattern matches.</param>
 /// <param name="options">The additional configuration for finding pattern matches.</param>
 public HybridSuffixTreeMatchFinder(FindLimitations limits, FindOptions options) :
     base(limits, options)
 {
     _tree = new HybridSuffixTree();
 }
 /// <summary>
 /// Creates a new instance of <see cref="HistoryMatchState"/>.
 /// </summary>
 /// <param name="limits">The limits to search sequences in.</param>
 /// <param name="options">The options to search sequences with.</param>
 public HistoryMatchState(FindLimitations limits, FindOptions options)
 {
     _limits  = limits;
     _options = options;
 }
Beispiel #13
0
 protected BaseMatchFinder(FindLimitations limits, FindOptions options)
 {
     this.FindLimitations = limits;
     FindOptions          = options;
 }