oscript.data
Class RegExpResult

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

public abstract class RegExpResult
extends OObject

The result of executing a pattern against a string. This object acts both as an object and as an array with the following properties and indicies:

Property/Index Description
property: index the index of the matched string
property: input the original string
index: 0 the last matched characters
index: 1 thru n The parenthesized substring matches, if any
Note 1: this API is modeled after the JavaScript RegExp API, for the benefit of users already familiar with JavaScript.

Note 2: the properties (index, etc) work by bean-access, so they are implemented by getter methods (since they are read-only)

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

Field Summary
static java.lang.String[] MEMBER_NAMES
           
static java.lang.String PARENT_TYPE_NAME
           
static Value TYPE
           
static java.lang.String TYPE_NAME
           
 
Fields inherited from class oscript.data.OObject
EMPTY_EXPR_LIST_EVALUATOR
 
Fields inherited from class oscript.data.Value
DEBUG, NULL, UNDEFINED
 
Constructor Summary
protected RegExpResult(Value input)
          Class Constructor.
 
Method Summary
abstract  Value elementAt(Value idx)
          Get the specified index of this object, if this object is an array.
abstract  Value getIndex()
          The index of the match in the string, or -1 if no match.
 Value getInput()
          Get the original input string.
protected  Value getTypeImpl()
          Get the type of this object.
abstract  int length()
          For types that implement elementAt, this returns the number of elements.
 
Methods inherited from class oscript.data.OObject
castToString, 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, elementsAt, getMember, getMember, getMember, getMember, getMember, getMonitor, getType, getTypeMember, getTypeMember, isA, 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

TYPE

public static final Value TYPE

PARENT_TYPE_NAME

public static final java.lang.String PARENT_TYPE_NAME
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

RegExpResult

protected RegExpResult(Value input)
Class Constructor.

Parameters:
input - the string to match the regular expression against
Method Detail

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

getInput

public Value getInput()
Get the original input string.


getIndex

public abstract Value getIndex()
The index of the match in the string, or -1 if no match.


length

public abstract int length()
                    throws PackagedScriptObjectException
For types that implement elementAt, this returns the number of elements.

Overrides:
length in class Value
Returns:
an integer length
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException
See Also:
elementAt(oscript.data.Value), Value.elementsAt(oscript.data.Value, oscript.data.Value)

elementAt

public abstract Value elementAt(Value idx)
                         throws PackagedScriptObjectException
Get the specified index of this object, if this object is an array. If needed, the array is grown to the appropriate size.

Overrides:
elementAt in class Value
Parameters:
idx - the index to get
Returns:
a reference to the member
Throws:
PackagedScriptObjectException(NoSuchMemberException)
PackagedScriptObjectException
See Also:
length(), Value.elementsAt(oscript.data.Value, oscript.data.Value)