Debian Codegraph @

net/sf/saxon/lib/SubstringMatcher.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.lib;
9
10 /**
11 * This interface is implemented by a collation that is capable of supporting
12 * the XPath functions that require matching of a substring: namely contains(),
13 * starts-with, ends-with, substring-before, and substring-after. For sorting
14 * and comparing strings, a collation needs to implement only the {@link StringCollator}
15 * interface; for matching of substrings, it must also implement this interface.
16 */
17 public interface SubstringMatcher extends StringCollator {
18
19 /**
20 * Test whether one string contains another, according to the rules
21 * of the XPath contains() function
22 *
23 * @param s1 the containing string
24 * @param s2 the contained string
25 * @return true iff s1 contains s2
26 */
27
28 boolean contains(String s1, String s2);
29
30 /**
31 * Test whether one string starts with another, according to the rules
32 * of the XPath starts-with() function
33 *
34 * @param s1 the containing string
35 * @param s2 the contained string
36 * @return true iff s1 starts with s2
37 */
38
39 boolean startsWith(String s1, String s2);
40
41 /**
42 * Test whether one string ends with another, according to the rules
43 * of the XPath ends-with() function
44 *
45 * @param s1 the containing string
46 * @param s2 the contained string
47 * @return true iff s1 ends with s2
48 */
49
50 boolean endsWith(String s1, String s2);
51
52 /**
53 * Return the part of a string before a given substring, according to the rules
54 * of the XPath substring-before() function
55 *
56 * @param s1 the containing string
57 * @param s2 the contained string
58 * @return the part of s1 that precedes the first occurrence of s2
59 */
60
61 String substringBefore(String s1, String s2);
62
63 /**
64 * Return the part of a string after a given substring, according to the rules
65 * of the XPath substring-after() function
66 *
67 * @param s1 the containing string
68 * @param s2 the contained string
69 * @return the part of s1 that follows the first occurrence of s2
70 */
71
72 String substringAfter(String s1, String s2);
73
74 }
75