| java.lang.Object oscript.data.Value oscript.data.OObject oscript.data.OArray
Inner Class :public static class OJavaArray extends OArray | |
Field Summary | |
final public static String[] | MEMBER_NAMES | final public static String | PARENT_TYPE_NAME | final public static Value | TYPE The type object for an instance of Array. | final public static String | TYPE_NAME | final public Value | concat Join this array object with one or more additional arrays. | final public Value | push Add one or more elements to the end of the array, returning the new
length. | final public Value | splice Add and remove elements from an array
Parameters: idx - the index to begin removing from Parameters: num - the number of elements to remove (optional, defaults toeverything after idx ) args... | final public Value | unshift Add one or more elements to the beginning of the array, returning the
new length. |
Method Summary | |
public Object | castToJavaObject() Convert this object to a native java Object value. | public String | castToString() Convert this object to a native java String value. | public Value | elementAt(Value idx) Get the specified index of this object, if this object is an array. | public synchronized Value | elementAt(int idx) | public Value | elementsAt(Value idx1, Value idx2) Get the specified range of this object, if this object is an array. | public Value | elementsAt(int idx1, int idx2) | final public void | ensureCapacity(int sz) | public Value | every(Value fxn) Executes the provided function fxn once for each element
present in the array until it finds one where callback returns
false . | public static void | fillByteArray(byte[] arr) | public static void | fillCharacterArray(char[] arr) | public static void | fillDoubleArray(double[] arr) | public static void | fillFloatArray(float[] arr) | public static void | fillIntegerArray(int[] arr) | public static void | fillLongArray(long[] arr) | public static void | fillShortArray(short[] arr) | public Value | filter(Value fxn) Create a new array with all elements that pass the test implemented
by the provided function. | public void | forEach(Value fxn) Executes a provided function once per array element. | public void | free() | protected Value | getTypeImpl() Get the type of this object. | public java.util.Iterator | iterator() Get an iterator of all the elements of this array. | public Value | join() | public Value | join(Value separator) Join all elements in the array into a single string, separated by the
specified separator. | public int | length() For types that implement elementAt , this returns the
number of elements. | final public static OArray | makeArray(Object arrObject) | public Value | map(Value fxn) Creates a new array with the results of calling a provided function
on every element in this array. | public synchronized Value | pop() Remove and return the last element of the array. | public void | push1(Value val) | public void | push2(Value val1, Value val2) | public void | push3(Value val1, Value val2, Value val3) | public void | push4(Value val1, Value val2, Value val3, Value val4) | public void | readExternal(java.io.ObjectInput in) Derived class that implements
java.io.Externalizable must
call this if it overrides it. | final public Reference | referenceAt(int idx) | final public Reference | referenceAt(int idx, int attr) | public void | reset() | public synchronized Value | reverse() Reverse the order of elements in this array, returning this array. | public MemberTable | safeCopy() | public synchronized Value | shift() Remove and return the first element of the array. | public Value | slice(Value begin) Slice out a section of the array. | public Value | slice(Value begin, Value end) Slice out a section of the array. | public Value | some(Value fxn) Tests whether some element in the array passes the test implemented by
the provided function. | public Value | sort() Sort the elements in the array, by converting each element to string,
and sorting in ascending order. | public synchronized Value | sort(Value fxn) Sort the elements in the array, by using the specified comparision
function. | public void | writeExternal(java.io.ObjectOutput out) Derived class that implements
java.io.Externalizable must
call this if it overrides it. |
PARENT_TYPE_NAME | final public static String PARENT_TYPE_NAME(Code) | | |
TYPE | final public static Value TYPE(Code) | | The type object for an instance of Array.
|
concat | final public Value concat(Code) | | Join this array object with one or more additional arrays. This
performs a shallow copy, so the original arrays are unmodified, but
for mutable objects there may be side effects.
|
push | final public Value push(Code) | | Add one or more elements to the end of the array, returning the new
length.
|
splice | final public Value splice(Code) | | Add and remove elements from an array
Parameters: idx - the index to begin removing from Parameters: num - the number of elements to remove (optional, defaults toeverything after idx ) args... optional additional arguments to replace the removedelements the removed elements |
unshift | final public Value unshift(Code) | | Add one or more elements to the beginning of the array, returning the
new length.
|
OArray | public OArray()(Code) | | Class Constructor.
|
OArray | public OArray(int initialLength)(Code) | | private constructor, used internally and by compiler...
initialLength == -1 is used to create arrays
that wrap native java arrays, rather than having to do a copy when
an array is passed from java to script. For java arrays, arr should
equal null, so methods that don't work for java arrays know to throw
an exception... ugly, but it works
|
OArray | public OArray(Reference[] arr, int size)(Code) | | Class Constructor. This constructor is not intended for public
consumption... it is just used by StackFrame$StackFrameArray for
quickly making a safe-copy when already copied out of the stack
|
OArray | public OArray(Value[] args)(Code) | | Class Constructor. This is the constructor that is called via a
BuiltinType instance.
Parameters: args - arguments to this constructor throws: PackagedScriptObjectException - (Exception) if wrong number of args |
elementAt | public synchronized Value elementAt(int idx)(Code) | | |
elementsAt | public Value elementsAt(int idx1, int idx2)(Code) | | |
ensureCapacity | final public void ensureCapacity(int sz)(Code) | | |
every | public Value every(Value fxn)(Code) | | Executes the provided function fxn once for each element
present in the array until it finds one where callback returns
false . If such an element is found, the test aborts and
false is returned, otherwise (callback returned
true for each of the elements) every will return
true . This array is not mutated.
Parameters: fxn - invoked with three arguments: the value of the element, the index of the element, and the array object containing theelement; should return true or false true if every element passes the test, otherwisefalse |
fillByteArray | public static void fillByteArray(byte[] arr)(Code) | | |
fillCharacterArray | public static void fillCharacterArray(char[] arr)(Code) | | |
fillDoubleArray | public static void fillDoubleArray(double[] arr)(Code) | | |
fillFloatArray | public static void fillFloatArray(float[] arr)(Code) | | |
fillIntegerArray | public static void fillIntegerArray(int[] arr)(Code) | | |
fillLongArray | public static void fillLongArray(long[] arr)(Code) | | |
fillShortArray | public static void fillShortArray(short[] arr)(Code) | | |
filter | public Value filter(Value fxn)(Code) | | Create a new array with all elements that pass the test implemented
by the provided function. The provided callback is invoked for each
element in the array, and a new array is constructed containing (in
the same order) the elements for which the callback returned
true . Elements for which the callback returns
false are skipped. This array is not mutated.
Parameters: fxn - invoked with three arguments: the value of the element, the index of the element, and the array object containing theelement; should return true or false the filtered array. |
forEach | public void forEach(Value fxn)(Code) | | Executes a provided function once per array element. This array is
not mutated.
Parameters: fxn - invoked with three arguments: the value of the element, the index of the element, and the array object containing theelement |
getTypeImpl | protected Value getTypeImpl()(Code) | | 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
OArray.getType .
the object's type |
iterator | public java.util.Iterator iterator()(Code) | | Get an iterator of all the elements of this array. This makes arrays
useful in the "for( var item : set )" syntx.
an iterator of elements of the array |
join | public Value join()(Code) | | Join all elements in the array into a single string, separated by
commas
the resulting string |
join | public Value join(Value separator)(Code) | | Join all elements in the array into a single string, separated by the
specified separator.
Parameters: separator - the separator string the resulting string |
map | public Value map(Value fxn)(Code) | | Creates a new array with the results of calling a provided function
on every element in this array. This array is not mutated.
Parameters: fxn - invoked with three arguments: the value of the element, the index of the element, and the array object containing theelement the new array |
pop | public synchronized Value pop()(Code) | | Remove and return the last element of the array.
|
reset | public void reset()(Code) | | |
reverse | public synchronized Value reverse()(Code) | | Reverse the order of elements in this array, returning this array. The
array is reversed in order.
this array object itself |
shift | public synchronized Value shift()(Code) | | Remove and return the first element of the array.
|
slice | public Value slice(Value begin)(Code) | | Slice out a section of the array. This works like arr[begin..
arr.length()-1] . The index can be negative, in which case it
will count from the end of the array.
Parameters: begin - the begin index, inclusive the resulting array |
slice | public Value slice(Value begin, Value end)(Code) | | Slice out a section of the array. This works like arr[begin..
end-1] . Either index can be negative, in which case it
will count from the end of the array.
Parameters: begin - the begin index, inclusive Parameters: end - the end index, exclusive the resulting array |
some | public Value some(Value fxn)(Code) | | Tests whether some element in the array passes the test implemented by
the provided function. Executes the provided function once for each
element present in the array until it finds one where callback returns
true . If such an element is found, the test aborts and
true is returned, otherwise (callback returned
false for each of the elements) return false .
Parameters: fxn - invoked with three arguments: the value of the element, the index of the element, and the array object containing theelement; should return true or false true if some element passes the test, otherwisefalse |
sort | public Value sort()(Code) | | Sort the elements in the array, by converting each element to string,
and sorting in ascending order. The array is sorted in place.
this array object itself |
sort | public synchronized Value sort(Value fxn)(Code) | | Sort the elements in the array, by using the specified comparision
function. The comparision function(a,b) should return
less than zero if a is less than b, zero if they
are equal, and greater than zero if a is greater than
b. The array is sorted in place.
Parameters: fxn - the comparasion function this array object itself |
Methods inherited from oscript.data.Value | public static Value _getTypeMember(Value type, Value obj, int id)(Code)(Java Doc) public static void _populateTypeMemberSet(Value type, java.util.Set s, boolean d)(Code)(Java Doc) public Value bopBitwiseAnd(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopBitwiseAndR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopBitwiseOr(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopBitwiseOrR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopBitwiseXor(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopBitwiseXorR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopCast(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopCastR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopDivide(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopDivideR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopEquals(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopEqualsR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopGreaterThan(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopGreaterThanOrEquals(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopGreaterThanOrEqualsR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopGreaterThanR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopInstanceOf(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopInstanceOfR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLeftShift(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLeftShiftR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLessThan(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLessThanOrEquals(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLessThanOrEqualsR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLessThanR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLogicalAnd(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLogicalAndR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLogicalOr(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopLogicalOrR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopMinus(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopMinusR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopMultiply(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopMultiplyR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopNotEquals(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopNotEqualsR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopPlus(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopPlusR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopRemainder(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopRemainderR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopSignedRightShift(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopSignedRightShiftR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopUnsignedRightShift(Value val) throws PackagedScriptObjectException(Code)(Java Doc) public Value bopUnsignedRightShiftR(Value val, PackagedScriptObjectException e) throws PackagedScriptObjectException(Code)(Java Doc) public Value callAsConstructor(StackFrame sf, MemberTable args) throws PackagedScriptObjectException(Code)(Java Doc) final public Value callAsConstructor(Value[] args) throws PackagedScriptObjectException(Code)(Java Doc) final public Value callAsConstructor(StackFrame sf, Value[] args)(Code)(Java Doc) public Value callAsExtends(StackFrame sf, Scope scope, MemberTable args) throws PackagedScriptObjectException(Code)(Java Doc) final public Value callAsExtends(Scope scope, MemberTable args) throws PackagedScriptObjectException(Code)(Java Doc) final public Value callAsExtends(StackFrame sf, Scope scope, Value[] args)(Code)(Java Doc) public Value callAsFunction(StackFrame sf, MemberTable args) throws PackagedScriptObjectException(Code)(Java Doc) final public Value callAsFunction(Value[] args) throws PackagedScriptObjectException(Code)(Java Doc) final public Value callAsFunction(StackFrame sf, Value[] args)(Code)(Java Doc) public boolean castToBoolean() throws PackagedScriptObjectException(Code)(Java Doc) public long castToExactNumber() throws PackagedScriptObjectException(Code)(Java Doc) public double castToInexactNumber() throws PackagedScriptObjectException(Code)(Java Doc) public Object castToJavaObject() throws PackagedScriptObjectException(Code)(Java Doc) public String castToString() throws PackagedScriptObjectException(Code)(Java Doc) public Value elementAt(Value idx) throws PackagedScriptObjectException(Code)(Java Doc) public Value elementsAt(Value idx1, Value idx2) throws PackagedScriptObjectException(Code)(Java Doc) final public Value getMember(String name) throws PackagedScriptObjectException(Code)(Java Doc) public Value getMember(Value name) throws PackagedScriptObjectException(Code)(Java Doc) final public Value getMember(int id) throws PackagedScriptObjectException(Code)(Java Doc) final public Value getMember(String name, boolean exception) throws PackagedScriptObjectException(Code)(Java Doc) final public Value getMember(Value name, boolean exception) throws PackagedScriptObjectException(Code)(Java Doc) public Value getMember(int id, boolean exception) throws PackagedScriptObjectException(Code)(Java Doc) public Object getMonitor()(Code)(Java Doc) public Value getType()(Code)(Java Doc) abstract protected Value getTypeImpl()(Code)(Java Doc) protected Value getTypeMember(Value obj, int id)(Code)(Java Doc) final protected Value getTypeMember(Value obj, Value name)(Code)(Java Doc) public boolean isA(Value type)(Code)(Java Doc) public int length() throws PackagedScriptObjectException(Code)(Java Doc) public java.util.Set memberSet()(Code)(Java Doc) protected PackagedScriptObjectException noSuchMember(String member)(Code)(Java Doc) public void opAssign(Value val) throws PackagedScriptObjectException(Code)(Java Doc) protected void populateMemberSet(java.util.Set s, boolean debugger)(Code)(Java Doc) protected void populateTypeMemberSet(java.util.Set s, boolean debugger)(Code)(Java Doc) public void readExternal(java.io.ObjectInput in) throws ClassNotFoundException, java.io.IOException(Code)(Java Doc) public String toString()(Code)(Java Doc) public Value unhand()(Code)(Java Doc) public Value uopBitwiseNot() throws PackagedScriptObjectException(Code)(Java Doc) public Value uopDecrement() throws PackagedScriptObjectException(Code)(Java Doc) public Value uopIncrement() throws PackagedScriptObjectException(Code)(Java Doc) public Value uopLogicalNot() throws PackagedScriptObjectException(Code)(Java Doc) public Value uopMinus() throws PackagedScriptObjectException(Code)(Java Doc) public Value uopPlus() throws PackagedScriptObjectException(Code)(Java Doc) public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException(Code)(Java Doc)
|
|
|