dk.brics.string.runtime
Class Strings

java.lang.Object
  extended by dk.brics.string.runtime.Strings

public class Strings
extends Object

Runtime system.

Author:
Anders Møller <amoeller@cs.au.dk>

Method Summary
static String analyze(String s, String regexp)
          Instructs the string analyzer to verify that the string is in the regular language specified by the regular expression.
static String analyze(String s, URL url)
          Instructs the string analyzer to verify that the string is in the regular language specified by a serialized Automaton located by a URL.
static void bind(String id, String regexp)
          Binds a regular language to an identifier.
static void bind(String id, URL url)
          Binds a regular language to an identifier.
static String cast(String s, String regexp)
          Casts string to regular language specified by regular expression.
static String cast(String s, URL url)
          Casts string to regular language specified by serialized Automaton located by URL.
static boolean check(String s, String regexp)
          Checks that the given string is in the regular language specified by the given regular expression.
static boolean check(String s, URL url)
          Checks that the given string is in regular language specified by the given serialized Automaton located by URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

analyze

public static String analyze(String s,
                             String regexp)
                      throws IllegalArgumentException
Instructs the string analyzer to verify that the string is in the regular language specified by the regular expression.

Parameters:
s - string
regexp - regular expression written in the full syntax of dk.brics.automaton.RegExp.
Returns:
the string s
Throws:
IllegalArgumentException - if the regular expression uses an unbound identifier

analyze

public static String analyze(String s,
                             URL url)
Instructs the string analyzer to verify that the string is in the regular language specified by a serialized Automaton located by a URL.

Parameters:
s - string
url - URL of serialized automaton
Returns:
the string s
Throws:
IOException - if unserialization errors occurred

bind

public static void bind(String id,
                        String regexp)
                 throws IllegalArgumentException
Binds a regular language to an identifier. Subsequent uses of regular expressions may then use the identifier.

Parameters:
id - identifier
regexp - regular expression written in the full syntax of dk.brics.automaton.RegExp.
Throws:
IllegalArgumentException - if the identifier already has been bound or the regular expression uses an unbound identifier

bind

public static void bind(String id,
                        URL url)
                 throws IOException,
                        IllegalArgumentException
Binds a regular language to an identifier. Subsequent uses of regular expressions may then use the identifier.

Parameters:
id - identifier
url - URL of serialized automaton
Throws:
IOException - if unserialization errors occurred
IllegalArgumentException - if the identifier already has been bound or the regular expression uses an unbound identifier

cast

public static String cast(String s,
                          String regexp)
                   throws IllegalArgumentException
Casts string to regular language specified by regular expression.

Parameters:
s - string
regexp - regular expression written in the full syntax of dk.brics.automaton.RegExp.
Returns:
the string s
Throws:
ClassCastException - if the string is not in the given regular language
IllegalArgumentException - if the regular expression uses an unbound identifier

cast

public static String cast(String s,
                          URL url)
                   throws IOException
Casts string to regular language specified by serialized Automaton located by URL.

Parameters:
s - string
url - URL of serialized automaton
Returns:
the string s
Throws:
IOException - if unserialization errors occurred
ClassCastException - if the string is not in the given regular language

check

public static boolean check(String s,
                            String regexp)
                     throws IllegalArgumentException
Checks that the given string is in the regular language specified by the given regular expression.

Parameters:
s - string
regexp - regular expression written in the full syntax of dk.brics.automaton.RegExp.
Returns:
true if the string is in the given regular language
Throws:
IllegalArgumentException - if the regular expression uses an unbound identifier

check

public static boolean check(String s,
                            URL url)
                     throws IOException
Checks that the given string is in regular language specified by the given serialized Automaton located by URL.

Parameters:
s - string
url - URL of serialized automaton
Returns:
true if the string is in the given regular language
Throws:
IOException - if unserialization errors occurred


Copyright © 2003-2009 Anders Møller, Aske Simon Christensen, Asger Feldthaus.