completed some javadoc on compile and constructor methods
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
809aee129e
commit
bfbe52754b
|
@ -41,19 +41,31 @@ public class SearchPattern
|
||||||
private int[] table;
|
private int[] table;
|
||||||
private byte[] pattern;
|
private byte[] pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Produces a SearchPattern instance which can be used
|
||||||
|
* to find matches of the pattern in data
|
||||||
|
* @param pattern byte array containing the pattern
|
||||||
|
* @return a new SearchPattern instance using the given pattern
|
||||||
|
*/
|
||||||
public static SearchPattern compile(byte[] pattern)
|
public static SearchPattern compile(byte[] pattern)
|
||||||
{
|
{
|
||||||
return new SearchPattern(Arrays.copyOf(pattern, pattern.length));
|
return new SearchPattern(Arrays.copyOf(pattern, pattern.length));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Produces a SearchPattern instance which can be used
|
||||||
|
* to find matches of the pattern in data
|
||||||
|
* @param pattern string containing the pattern
|
||||||
|
* @return a new SearchPattern instance using the given pattern
|
||||||
|
*/
|
||||||
public static SearchPattern compile(String pattern)
|
public static SearchPattern compile(String pattern)
|
||||||
{
|
{
|
||||||
return new SearchPattern(pattern.getBytes(StandardCharsets.UTF_8));
|
return new SearchPattern(pattern.getBytes(StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param pattern byte array containing the pattern used for matching
|
||||||
|
*/
|
||||||
private SearchPattern(byte[] pattern)
|
private SearchPattern(byte[] pattern)
|
||||||
{
|
{
|
||||||
this.pattern = pattern;
|
this.pattern = pattern;
|
||||||
|
|
|
@ -25,7 +25,8 @@ import java.nio.charset.StandardCharsets;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class SearchPatternTest
|
public class
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue