org.amino.alg.scan
Interface Scanner

All Known Implementing Classes:
AbstractScanner, ParallelScanner

public interface Scanner

Interface for searching byte arrays.

Author:
donawa

Method Summary
 int binarySearch(byte[] a, byte v)
           
 int binarySearch(byte[] a, int from, int to, byte v)
          Search a byte value from byte-array.
 int[] findAll(byte[] a, byte v)
          Find the indices of all occurrences of the given value in the array.
 int[] findAll(byte[] a, byte[] v)
          Find the index of the any occurrence of the given sequence in the array.
 int[] findAll(byte[] a, byte[] v, int from, int to)
          Find the index of the any occurrence of the given sequence in an array segment.
 int[] findAll(byte[] a, byte v, int from, int to)
          Find the indices of all occurrences of the given value in an array segment.
 int findAny(byte[] a, byte v)
          Find the index of the any occurrence of the given value in the array.
 int findAny(byte[] a, byte[] v)
          Find the index of the any occurrence of the given sequence in the array.
 int findAny(byte[] a, byte[] v, int from, int to)
          Find the index of the any occurrence of the given sequence in an array segment.
 int findAny(byte[] a, byte v, int from, int to)
          Find the index of the any occurrence of the given value in an array segment.
 int findFirst(byte[] a, byte v)
          Find the index of the first occurrence of the given value in the array.
 int findFirst(byte[] a, byte[] v)
          Find the index of the first occurrence of the given sequence in the array.
 int findLast(byte[] a, byte v)
          Find the index of the last occurrence of the given value in the array.
 int findLast(byte[] a, byte[] v)
          Find the index of the last occurrence of the given sequence in the array.
 int findNext(byte[] a, byte[] v, int index)
          Find the next index of the given sequence in the array.
 int findNext(byte[] a, byte v, int index)
          Find the next index of the given value in the array.
 int findPrevious(byte[] a, byte[] v, int index)
          Find the previous index of the given value in the array.
 int findPrevious(byte[] a, byte v, int index)
          Find the previous index of the given value in the array.
 int replaceAll(byte[] a, byte[] v, byte[] r)
          Replace all occurrences of the search sequence with the replacement sequence.
 int replaceAll(byte[] a, byte[] v, byte[] r, int from, int to)
          Replace all occurrences of the search sequence with the replacement sequence.
 int replaceAll(byte[] a, byte v, byte r)
          Replace all occurrences of the search value with the replacement value.
 int replaceAll(byte[] a, byte v, byte r, int from, int to)
          Replace all occurrences of the search value with the replacement value.
 

Method Detail

findFirst

int findFirst(byte[] a,
              byte v)
Find the index of the first occurrence of the given value in the array.

Parameters:
a - The array to search.
v - The value to search for.
Returns:
The index of the first occurrence or a negative value if not found.

findLast

int findLast(byte[] a,
             byte v)
Find the index of the last occurrence of the given value in the array.

Parameters:
a - The array to search.
v - The value to search for.
Returns:
The index of the last occurrence or a negative value if not found.

findNext

int findNext(byte[] a,
             byte v,
             int index)
Find the next index of the given value in the array.

Parameters:
a - The array to search.
v - The value to search for.
index - The starting index for the search.
Returns:
The index of the occurrence or a negative value if not found.

findPrevious

int findPrevious(byte[] a,
                 byte v,
                 int index)
Find the previous index of the given value in the array.

Parameters:
a - The array to search.
v - The value to search for.
index - The starting index for the search (exclusive, searching backward).
Returns:
The index of the occurrence or a negative value if not found.

findAny

int findAny(byte[] a,
            byte v)
Find the index of the any occurrence of the given value in the array.

Parameters:
a - The array to search.
v - The value to search for.
Returns:
The index of the an occurrence or a negative value if not found.

findAny

int findAny(byte[] a,
            byte v,
            int from,
            int to)
Find the index of the any occurrence of the given value in an array segment.

Parameters:
a - The array to search.
v - The value to search for.
from - starting index for search (inclusive)
to - ending index for search (exclusive)
Returns:
The index of the an occurrence or a negative value if not found.

findAll

int[] findAll(byte[] a,
              byte v)
Find the indices of all occurrences of the given value in the array.

Parameters:
a - The array to search.
v - The value to search for.
Returns:
The array of indices of occurrences or null if none found.

replaceAll

int replaceAll(byte[] a,
               byte v,
               byte r)
Replace all occurrences of the search value with the replacement value.

Parameters:
a - The array to search.
v - The value to search for.
r - The replacement value.
Returns:
The number of occurrences found and replaced.

findAll

int[] findAll(byte[] a,
              byte v,
              int from,
              int to)
Find the indices of all occurrences of the given value in an array segment.

Parameters:
a - The array to search.
v - The value to search for.
from - starting index for search (inclusive)
to - ending index for search (exclusive)
Returns:
The array of indices of occurrences or null if none found.

replaceAll

int replaceAll(byte[] a,
               byte v,
               byte r,
               int from,
               int to)
Replace all occurrences of the search value with the replacement value.

Parameters:
a - The array to search.
v - The sequence to search for.
r - The replacement sequence.
from - starting index for search (inclusive)
to - ending index for search (exclusive)
Returns:
The number of occurrences found and replaced.

findFirst

int findFirst(byte[] a,
              byte[] v)
Find the index of the first occurrence of the given sequence in the array.

Parameters:
a - The array to search.
v - The sequence to search for.
Returns:
The index of the first occurrence or a negative value if not found.

findLast

int findLast(byte[] a,
             byte[] v)
Find the index of the last occurrence of the given sequence in the array.

Parameters:
a - The array to search.
v - The sequence to search for.
Returns:
The index of the last occurrence or a negative value if not found.

findNext

int findNext(byte[] a,
             byte[] v,
             int index)
Find the next index of the given sequence in the array.

Parameters:
a - The array to search.
v - The sequence to search for.
index - The starting index for the search (inclusive).
Returns:
The index of the occurrence or a negative value if not found.

findPrevious

int findPrevious(byte[] a,
                 byte[] v,
                 int index)
Find the previous index of the given value in the array.

Parameters:
a - The array to search.
v - The value to search for.
index - The starting index for the search (exclusive, searching backward).
Returns:
The index of the occurrence or a negative value if not found.

findAny

int findAny(byte[] a,
            byte[] v)
Find the index of the any occurrence of the given sequence in the array.

Parameters:
a - The array to search.
v - The sequence to search for.
Returns:
The index of the an occurrence or a negative value if not found.

findAny

int findAny(byte[] a,
            byte[] v,
            int from,
            int to)
Find the index of the any occurrence of the given sequence in an array segment.

Parameters:
a - The array to search.
v - The sequence to search for.
from - starting index for search (inclusive)
to - ending index for search (exclusive)
Returns:
The index of the an occurrence or a negative value if not found.

findAll

int[] findAll(byte[] a,
              byte[] v)
Find the index of the any occurrence of the given sequence in the array.

Parameters:
a - The array to search.
v - The sequence to search for.
Returns:
The array of indices of occurrences or null if none found.

replaceAll

int replaceAll(byte[] a,
               byte[] v,
               byte[] r)
Replace all occurrences of the search sequence with the replacement sequence. The search and replacement sequence must be identical in length.

Parameters:
a - The array to search.
v - The sequence to search for.
r - The replacement sequence.
Returns:
The number of occurrences found and replaced.

findAll

int[] findAll(byte[] a,
              byte[] v,
              int from,
              int to)
Find the index of the any occurrence of the given sequence in an array segment.

Parameters:
a - The array to search.
v - The sequence to search for.
from - starting index for search (inclusive)
to - ending index for search (exclusive)
Returns:
The array of indices of occurrences or null if none found.

replaceAll

int replaceAll(byte[] a,
               byte[] v,
               byte[] r,
               int from,
               int to)
Replace all occurrences of the search sequence with the replacement sequence.

Parameters:
a - The array to search.
v - The sequence to search for.
r - The replacement sequence.
from - starting index for search (inclusive)
to - ending index for search (exclusive)
Returns:
The number of occurrences found and replaced.

binarySearch

int binarySearch(byte[] a,
                 byte v)
Parameters:
a - The array to search.
v - The value to search for
Returns:
index of the search value if it succeeds; otherwise, (-(insertion point) - 1)

binarySearch

int binarySearch(byte[] a,
                 int from,
                 int to,
                 byte v)
Search a byte value from byte-array.

Parameters:
a - The array to search.
from - starting index for search (inclusive)
to - ending index for search (exclusive)
v - The value to search for
Returns:
index of the search value if it succeeds; otherwise, (-(insertion point) - 1).


Copyright © 2008. All Rights Reserved.