KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mckoi > database > RegexLibrary


1 /**
2  * com.mckoi.database.RegexLibrary 13 Oct 2000
3  *
4  * Mckoi SQL Database ( http://www.mckoi.com/database )
5  * Copyright (C) 2000, 2001, 2002 Diehl and Associates, Inc.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * Version 2 as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License Version 2 for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * Version 2 along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  *
20  * Change Log:
21  *
22  *
23  */

24
25 package com.mckoi.database;
26
27 import com.mckoi.util.IntegerVector;
28
29 /**
30  * An interface that links with a Regex library. This interface allows
31  * the database engine to use any regular expression library that this
32  * interface can be implemented for.
33  *
34  * @author Tobias Downer
35  */

36
37 public interface RegexLibrary {
38
39   /**
40    * Matches a regular expression against a string value. If the value is
41    * a match against the expression then it returns true.
42    *
43    * @param regular_expression the expression to match (eg. "[0-9]+").
44    * @param expression_ops expression operator string that specifies various
45    * flags. For example, "im" is like '/[expression]/im' in Perl.
46    * @param value the string to test.
47    */

48   boolean regexMatch(String JavaDoc regular_expression, String JavaDoc expression_ops,
49                      String JavaDoc value);
50
51   /**
52    * Performs a regular expression search on the given column of the table.
53    * Returns an IntegerVector that contains the list of rows in the table that
54    * matched the expression. Returns an empty list if the expression matched
55    * no rows in the column.
56    *
57    * @param table the table to search for matching values.
58    * @param column the column of the table to search for matching values.
59    * @param regular_expression the expression to match (eg. "[0-9]+").
60    * @param expression_ops expression operator string that specifies various
61    * flags. For example, "im" is like '/[expression]/im' in Perl.
62    */

63   IntegerVector regexSearch(Table table, int column,
64                             String JavaDoc regular_expression, String JavaDoc expression_ops);
65
66 }
67
Popular Tags