oscript.data
Class RegExp

java.lang.Object
  extended byoscript.data.Value
      extended byoscript.data.OObject
          extended byoscript.data.RegExp
All Implemented Interfaces:
java.io.Serializable

public abstract class RegExp
extends OObject

A regular expression object.

Author:
Rob Clark (rob@ti.com)
See Also:
Serialized Form

Nested Class Summary
protected static interface RegExp.RegExpFactory
          Interface to be implemented by regular-expression factory
 
Field Summary
static java.lang.String[] MEMBER_NAMES
           
static java.lang.String PARENT_TYPE_NAME
          The type object for an instance of RegExp...
static java.lang.String TYPE_NAME
           
 
Fields inherited from class oscript.data.OObject
EMPTY_EXPR_LIST_EVALUATOR, TYPE
 
Fields inherited from class oscript.data.Value
DEBUG, NULL, UNDEFINED
 
Constructor Summary
protected RegExp(Value exp, Value flags)
          Class Constructor.
 
Method Summary
 java.lang.String castToString()
          Convert this object to a native java String value.
static RegExp createRegExp(Value ostr)
          Create a regular expression.
abstract  RegExpResult exec(Value str)
          Execute the search for a match against a string.
protected  Value getTypeImpl()
          Get the type of this object.
static void register(RegExp.RegExpFactory factory)
          Used by implementations of RegExp to register themselves as being able to implement RegExp.
 boolean test(Value str)
          Executes the search for a match between a regular expression and a specified string.
 
Methods inherited from class oscript.data.OObject
getMember, populateMemberSet
 
Methods inherited from class oscript.data.Value
_getTypeMember, _populateTypeMemberSet, bopBitwiseAnd, bopBitwiseAndR, bopBitwiseOr, bopBitwiseOrR, bopBitwiseXor, bopBitwiseXorR, bopCast, bopCastR, bopDivide, bopDivideR, bopEquals, bopEqualsR, bopGreaterThan, bopGreaterThanOrEquals, bopGreaterThanOrEqualsR, bopGreaterThanR, bopInstanceOf, bopInstanceOfR, bopLeftShift, bopLeftShiftR, bopLessThan, bopLessThanOrEquals, bopLessThanOrEqualsR, bopLessThanR, bopLogicalAnd, bopLogicalAndR, bopLogicalOr, bopLogicalOrR, bopMinus, bopMinusR, bopMultiply, bopMultiplyR, bopNotEquals, bopNotEqualsR, bopPlus, bopPlusR, bopRemainder, bopRemainderR, bopSignedRightShift, bopSignedRightShiftR, bopUnsignedRightShift, bopUnsignedRightShiftR, callAsConstructor, callAsConstructor, callAsConstructor, callAsExtends, callAsExtends, callAsExtends, callAsFunction, callAsFunction, callAsFunction, castToBoolean, castToExactNumber, castToInexactNumber, castToJavaObject, elementAt, elementsAt, getMember, getMember, getMember, getMember, getMember, getMonitor, getType, getTypeMember, getTypeMember, isA, length, memberSet, noSuchMember, opAssign, populateTypeMemberSet, readExternal, toString, unhand, uopBitwiseNot, uopDecrement, uopIncrement, uopLogicalNot, uopMinus, uopPlus, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PARENT_TYPE_NAME

public static final java.lang.String PARENT_TYPE_NAME
The type object for an instance of RegExp... implementing class should use these values in the class used to construct the BuiltinType:
   public final static Value TYPE = BuiltinType.makeBuiltinType("oscript.data.???RegExp");
   public final static String PARENT_TYPE_NAME = RegExp.PARENT_TYPE_NAME;
   public final static String TYPE_NAME        = RegExp.TYPE_NAME;
   public final static String[] MEMBER_NAMES   = RegExp.MEMBER_NAMES;
 

See Also:
Constant Field Values

TYPE_NAME

public static final java.lang.String TYPE_NAME
See Also:
Constant Field Values

MEMBER_NAMES

public static final java.lang.String[] MEMBER_NAMES
Constructor Detail

RegExp

protected RegExp(Value exp,
                 Value flags)
Class Constructor.

Method Detail

register

public static void register(RegExp.RegExpFactory factory)
Used by implementations of RegExp to register themselves as being able to implement RegExp. This will also create a global variable RegExp which is set to the value returned by factory's RegExp.RegExpFactory.getType() method.

Parameters:
factory - the factory that can construct a regular expression object

createRegExp

public static RegExp createRegExp(Value ostr)
Create a regular expression.


getTypeImpl

protected Value getTypeImpl()
Get the type of this object. The returned type doesn't have to take into account the possibility of a script type extending a built-in type, since that is handled by Value.getType().

Overrides:
getTypeImpl in class OObject
Returns:
the object's type

exec

public abstract RegExpResult exec(Value str)
Execute the search for a match against a string.

Note that this API is modeled after the JavaScript RegExp API, for the benefit of users already familiar with JavaScript.

Parameters:
str - the string to match
Returns:
the result object

test

public boolean test(Value str)
Executes the search for a match between a regular expression and a specified string.

Parameters:
str - the string to match
Returns:
true if match was found

castToString

public java.lang.String castToString()
                              throws PackagedScriptObjectException
Convert this object to a native java String value.

Overrides:
castToString in class OObject
Returns:
a String value
Throws:
PackagedObjectException(NoSuchMethodException)
PackagedScriptObjectException