public abstract class ArrayValue extends Value
Modifier and Type | Class and Description |
---|---|
static class |
ArrayValue.AbstractGet |
static class |
ArrayValue.Entry |
static class |
ArrayValue.EntryIterator |
class |
ArrayValue.EntrySet |
static class |
ArrayValue.GetKey |
static class |
ArrayValue.GetValue |
static class |
ArrayValue.KeyComparator |
static class |
ArrayValue.KeyIterator |
class |
ArrayValue.KeySet |
class |
ArrayValue.ValueCollection |
static class |
ArrayValue.ValueComparator |
static class |
ArrayValue.ValueIterator |
Modifier and Type | Field and Description |
---|---|
static StringValue |
ARRAY |
static ArrayValue.GetKey |
GET_KEY |
static ArrayValue.GetValue |
GET_VALUE |
protected static StringValue |
KEY |
protected static StringValue |
VALUE |
L, NULL_ARGS, NULL_VALUE_ARRAY
Modifier | Constructor and Description |
---|---|
protected |
ArrayValue() |
Modifier and Type | Method and Description |
---|---|
Value |
add(Value rValue)
Returns a union of this array and the rValue as array.
|
ArrayValue |
append(Value value)
Appends as an argument - only called from compiled code
XXX: change name to appendArg
|
abstract ArrayValue |
append(Value key,
Value value)
Appends as an argument - only called from compiled code
XXX: change name to appendArg
|
Value |
callCallback(Env env,
Callable callback,
Value key) |
Value |
callCallback(Env env,
Callable callback,
Value key,
Value a2) |
Value |
callCallback(Env env,
Callable callback,
Value key,
Value a2,
Value a3) |
abstract void |
clear()
Clears the array
|
int |
cmp(Value rValue)
Returns a negative/positive integer if this Value is
lessthan/greaterthan rValue.
|
abstract Value |
contains(Value value)
Returns the corresponding key if this array contains the given value
|
abstract Value |
containsKey(Value key)
Returns the corresponding value if this array contains the given key
|
abstract Value |
containsStrict(Value value)
Returns the corresponding key if this array contains the given value
|
abstract Value |
copy()
Copy for assignment.
|
abstract Value |
copy(Env env,
java.util.IdentityHashMap<Value,Value> map)
Copy for serialization
|
Value |
copyReturn()
Copy as a return value
|
abstract Value |
createTailKey()
Creatse a tail index.
|
Value |
current()
Returns the current value.
|
Value |
each()
The each iterator
|
Value |
end()
Returns the last value.
|
java.util.Set<java.util.Map.Entry<Value,Value>> |
entrySet()
Returns a set of all the of the entries.
|
boolean |
eq(Value rValue)
Test for equality
|
boolean |
eql(Value rValue)
Test for ===
|
boolean |
geq(Value rValue)
Returns true for greater than or equal to
|
abstract Value |
get(Value key)
Gets a new value.
|
abstract Value |
getArg(Value index,
boolean isTop)
Returns the value as an argument which may be a reference.
|
Value |
getArray(Value index)
Returns the value as an array.
|
java.util.Iterator<java.util.Map.Entry<Value,Value>> |
getBaseIterator(Env env)
Returns an iterator for the key => value pairs.
|
int |
getCount(Env env)
Returns the count().
|
int |
getCountRecursive(Env env)
Returns the count().
|
protected ArrayValue.Entry |
getCurrent() |
abstract ArrayValue.Entry |
getHead()
Returns the head.
|
java.util.Iterator<java.util.Map.Entry<Value,Value>> |
getIterator() |
Value[] |
getKeyArray(Env env)
Returns the field keys.
|
java.util.Iterator<Value> |
getKeyIterator(Env env)
Returns an iterator for the field keys.
|
Value |
getKeys()
Returns the keys.
|
Value |
getObject(Env env,
Value fieldName)
Returns the field value, creating an object if it's unset.
|
Value |
getRaw(Value key)
Returns the value in the array as-is.
|
abstract int |
getSize()
Returns the size.
|
protected abstract ArrayValue.Entry |
getTail()
Returns the tail.
|
java.lang.String |
getType()
Returns the type.
|
Value[] |
getValueArray(Env env)
Returns the field values.
|
java.util.Iterator<Value> |
getValueIterator(Env env)
Returns an iterator for the field values.
|
Value |
getValues()
Returns the keys.
|
ValueType |
getValueType()
Returns the ValueType.
|
abstract Var |
getVar(Value index)
Returns the array ref.
|
boolean |
gt(Value rValue)
Returns true for greater than
|
boolean |
hasCurrent()
Returns true if there are more elements.
|
boolean |
isArray()
Returns true for an array.
|
boolean |
isCallable(Env env,
boolean isCheckSyntaxOnly,
Value nameRef)
Returns true for a callable object.
|
boolean |
isEmpty()
Returns true if the value is empty
|
boolean |
isEmpty(Env env,
Value key)
Returns true if the value is empty
|
boolean |
isset(Value key)
Returns true if the value is set.
|
void |
jsonEncode(Env env,
JsonEncodeContext context,
StringValue sb)
Encodes the value in JSON.
|
void |
jsonEncodeAssociative(Env env,
JsonEncodeContext context,
StringValue sb) |
Value |
key()
Returns the current key
|
boolean |
keyExists(Value key)
Returns true if the key exists in the array.
|
boolean |
keyReset(long base,
boolean strict)
Resets all numerical keys with the first index as base
|
java.util.Set<Value> |
keySet()
Returns an iterator of the entries.
|
Value[] |
keysToArray()
Takes the values of this array and puts them in a java array
|
boolean |
leq(Value rValue)
Returns true for less than or equal to
|
boolean |
lt(Value rValue)
Returns true for less than
|
Value |
next()
Returns the next value.
|
abstract Value |
pop(Env env)
Pops the top value.
|
Value |
prev()
Returns the previous value.
|
void |
print(Env env)
Prints the value.
|
protected void |
printREntry(Env env,
WriteStream out,
int depth,
java.util.IdentityHashMap<Value,java.lang.String> valueSet,
java.util.Map.Entry<Value,Value> mapEntry) |
protected void |
printRImpl(Env env,
WriteStream out,
int depth,
java.util.IdentityHashMap<Value,java.lang.String> valueSet) |
void |
put(Env env,
java.lang.String key,
boolean value)
Convenience for lib.
|
void |
put(Env env,
java.lang.String key,
long value)
Convenience for lib.
|
void |
put(Env env,
java.lang.String key,
java.lang.String value)
Convenience for lib.
|
void |
put(long value)
Convenience for lib.
|
void |
put(java.lang.String value)
Convenience for lib.
|
void |
put(java.lang.String key,
boolean value)
Convenience for lib.
|
void |
put(java.lang.String key,
char value)
Convenience for lib.
|
void |
put(java.lang.String key,
double value)
Convenience for lib.
|
void |
put(java.lang.String key,
long value)
Convenience for lib.
|
void |
put(java.lang.String key,
java.lang.String value)
Convenience for lib.
|
void |
put(StringValue keyBinary,
StringValue keyUnicode,
Value value,
boolean isUnicode)
Adds a new value.
|
abstract Value |
put(Value value)
Add
|
Value |
put(Value key,
Value value)
Adds a new value.
|
void |
putAll(ArrayValue array)
Puts all of the arg elements into this array.
|
abstract Var |
putVar()
Sets the array ref.
|
abstract Value |
remove(Value key)
Removes a value.
|
Value |
reset()
Returns the first value.
|
void |
serialize(Env env,
java.lang.StringBuilder sb,
SerializeMap serializeMap)
Serializes the value.
|
protected void |
setCurrent(ArrayValue.Entry entry) |
abstract Value |
shuffle()
Shuffles the array
|
ArrayValue |
slice(Env env,
int start,
int end,
boolean isPreserveKeys)
Slices.
|
void |
sort(java.util.Comparator<java.util.Map.Entry<Value,Value>> comparator,
boolean resetKeys,
boolean strict)
Sorts this array based using the passed Comparator
|
abstract ArrayValue |
splice(int begin,
int end,
ArrayValue replace)
Splices.
|
ArrayValue |
toArray()
Converts to an object.
|
static Value |
toArray(Value value)
Convert to an array.
|
ArrayValue |
toArrayValue(Env env)
Converts to an array value
|
Value |
toAutoArray()
Converts to an array if null.
|
int |
toBinaryValueMarshalCost()
Cost to convert to a binary value
|
boolean |
toBoolean()
Converts to a boolean.
|
Callable |
toCallable(Env env,
boolean isOptional)
Converts to a callable object.
|
int |
toCharMarshalCost()
Cost to convert to a character
|
double |
toDouble()
Converts to a double.
|
java.util.Map.Entry<Value,Value>[] |
toEntryArray()
Returns an object array of this array.
|
java.util.Collection |
toJavaCollection(Env env,
java.lang.Class type)
Converts to a java List object.
|
java.util.List |
toJavaList(Env env,
java.lang.Class type)
Converts to a java List object.
|
java.util.Map |
toJavaMap(Env env,
java.lang.Class<?> type)
Converts to a java object.
|
java.lang.Object |
toJavaObject()
Converts to a java object.
|
Value |
toKey()
Converts to a key.
|
Value |
toLocalRef()
Convert to a function argument value, e.g.
|
long |
toLong()
Converts to a long.
|
java.lang.Object |
toObject()
Converts to an object.
|
Value |
toObject(Env env)
Converts to an object.
|
java.lang.String |
toString()
Converts to a string.
|
int |
toStringMarshalCost()
Cost to convert to a string
|
int |
toStringValueMarshalCost()
Cost to convert to a StringValue
|
int |
toUnicodeValueMarshalCost()
Cost to convert to a UnicodeValue
|
abstract ArrayValue |
unshift(Value value)
Add to front.
|
java.util.Collection<Value> |
values()
Returns a collection of the values.
|
Value[] |
valuesToArray()
Takes the values of this array and puts them in a java array
|
java.lang.Object |
valuesToArray(Env env,
java.lang.Class elementType)
Takes the values of this array, unmarshals them to objects of type
elementType, and puts them in a java array.
|
protected void |
varDumpEntry(Env env,
WriteStream out,
int depth,
java.util.IdentityHashMap<Value,java.lang.String> valueSet,
java.util.Map.Entry<Value,Value> mapEntry) |
void |
varDumpImpl(Env env,
WriteStream out,
int depth,
java.util.IdentityHashMap<Value,java.lang.String> valueSet) |
protected void |
varExportImpl(StringValue sb,
int level)
Exports the value.
|
abs, add, addOne, appendTo, appendTo, appendTo, appendTo, bitAnd, bitOr, bitXor, call, call, call, call, call, call, call, callCopy, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callRef, callRef, callRef, callRef, callRef, callRef, callRef, charValueAt, checkPrivate, checkProtected, clone, copy, copyArrayItem, copySaveFunArg, copyStringBuilder, copyTree, div, div, eqValue, findFunction, findQuercusClass, generate, get, getArgTail, getArray, getCallableName, getCalledClass, getClassName, getDirty, getField, getFieldArg, getFieldArgRef, getFieldArray, getFieldObject, getFieldVar, getHashCode, getIterator, getObject, getObjectHash, getQuercusClass, getRef, getResourceType, getStaticFieldValue, getStaticFieldVar, getThisField, getThisFieldArg, getThisFieldArgRef, getThisFieldArray, getThisFieldObject, getThisFieldVar, hashCode, increment, initField, initField, initField, initIncompleteField, isA, isA, isBinary, isBoolean, isDefault, isDouble, isDoubleConvertible, isFieldExists, isFieldInit, isLong, isLongConvertible, isNull, isNumberConvertible, isNumeric, isObject, isResource, isset, issetField, issetThisField, isString, isUnicode, isVar, length, lshift, mod, mul, mul, neg, nextIndex, pos, postdecr, postincr, postincr, predecr, preincr, preincr, print, printDepth, printJavaChar, printJavaString, printR, put, putArray, putField, putField, putField, putObject, putThisField, putThisField, putThisFieldArray, rshift, serialize, set, setCharValueAt, setFieldInit, setJavaObject, setStaticFieldRef, sub_rev, sub, sub, subOne, toArgRef, toAutoObject, toBigDecimal, toBigInteger, toBinaryValue, toBinaryValue, toBinaryValue, toBooleanMarshalCost, toByteArrayMarshalCost, toByteMarshalCost, toChar, toCharArrayMarshalCost, toDebugString, toDouble, toDouble, toDouble, toDouble, toDoubleMarshalCost, toDoubleValue, toException, toFloatMarshalCost, toInputStream, toInt, toIntegerMarshalCost, toInternString, toJavaBoolean, toJavaByte, toJavaCalendar, toJavaCharacter, toJavaDate, toJavaDouble, toJavaEnum, toJavaFloat, toJavaInteger, toJavaLong, toJavaObject, toJavaObjectMarshalCost, toJavaObjectNotNull, toJavaShort, toJavaString, toJavaURL, toLocalThis, toLocalValue, toLocalValueReadOnly, toLocalVar, toLocalVarDeclAsRef, toLong, toLong, toLong, toLong, toLongMarshalCost, toLongValue, toRef, toRefValue, toShortMarshalCost, toString, toStringBuilder, toStringBuilder, toStringBuilder, toStringBuilder, toStringValue, toStringValue, toUnicode, toUnicodeValue, toUnicodeValue, toValue, toVar, unsetArray, unsetField, unsetThisArray, unsetThisField, unsetThisPrivateField, varDump, varExport
protected static final StringValue KEY
protected static final StringValue VALUE
public static final ArrayValue.GetKey GET_KEY
public static final ArrayValue.GetValue GET_VALUE
public static final StringValue ARRAY
public ValueType getValueType()
getValueType
in class Value
public int toCharMarshalCost()
toCharMarshalCost
in class Value
public int toStringMarshalCost()
toStringMarshalCost
in class Value
public int toBinaryValueMarshalCost()
toBinaryValueMarshalCost
in class Value
public int toStringValueMarshalCost()
toStringValueMarshalCost
in class Value
public int toUnicodeValueMarshalCost()
toUnicodeValueMarshalCost
in class Value
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object toObject()
public Value toAutoArray()
toAutoArray
in class Value
public java.lang.Object toJavaObject()
toJavaObject
in class Value
protected ArrayValue.Entry getCurrent()
protected void setCurrent(ArrayValue.Entry entry)
public ArrayValue toArray()
public ArrayValue toArrayValue(Env env)
toArrayValue
in class Value
public java.util.Collection toJavaCollection(Env env, java.lang.Class type)
toJavaCollection
in class Value
public java.util.List toJavaList(Env env, java.lang.Class type)
toJavaList
in class Value
public java.util.Map toJavaMap(Env env, java.lang.Class<?> type)
public boolean isCallable(Env env, boolean isCheckSyntaxOnly, Value nameRef)
Value
isCallable
in class Value
public Callable toCallable(Env env, boolean isOptional)
toCallable
in class Value
public final Value callCallback(Env env, Callable callback, Value key, Value a2, Value a3)
public Value copyReturn()
copyReturn
in class Value
public Value toLocalRef()
Value
toLocalRef
in class Value
public abstract Value copy(Env env, java.util.IdentityHashMap<Value,Value> map)
public int getCountRecursive(Env env)
getCountRecursive
in class Value
public boolean isEmpty()
public boolean isEmpty(Env env, Value key)
Value
public abstract void clear()
public int cmp(Value rValue)
Value
public boolean leq(Value rValue)
public boolean geq(Value rValue)
public final void put(StringValue keyBinary, StringValue keyUnicode, Value value, boolean isUnicode)
public abstract ArrayValue unshift(Value value)
public abstract ArrayValue splice(int begin, int end, ArrayValue replace)
public ArrayValue slice(Env env, int start, int end, boolean isPreserveKeys)
public abstract Value getArg(Value index, boolean isTop)
public Value getObject(Env env, Value fieldName)
public abstract Value createTailKey()
public Value add(Value rValue)
put(Value)
method.public java.util.Iterator<java.util.Map.Entry<Value,Value>> getBaseIterator(Env env)
Value
getBaseIterator
in class Value
public java.util.Iterator<Value> getKeyIterator(Env env)
Value
Value.getIterator(Env)
; derived classes may override and
provide a more efficient implementation.getKeyIterator
in class Value
public java.util.Iterator<Value> getValueIterator(Env env)
Value
Value.getIterator(Env)
; derived classes may override and
provide a more efficient implementation.getValueIterator
in class Value
public Value getRaw(Value key)
public boolean isset(Value key)
public boolean keyExists(Value key)
public java.util.Set<Value> keySet()
public java.util.Set<java.util.Map.Entry<Value,Value>> entrySet()
public java.util.Collection<Value> values()
public void put(java.lang.String key, java.lang.String value)
public void put(Env env, java.lang.String key, java.lang.String value)
public void put(java.lang.String key, char value)
public void put(java.lang.String key, long value)
public void put(Env env, java.lang.String key, long value)
public void put(java.lang.String key, double value)
public void put(java.lang.String key, boolean value)
public void put(Env env, java.lang.String key, boolean value)
public void put(java.lang.String value)
public void put(long value)
public abstract ArrayValue append(Value key, Value value)
public ArrayValue append(Value value)
public void putAll(ArrayValue array)
public void print(Env env)
public abstract ArrayValue.Entry getHead()
protected abstract ArrayValue.Entry getTail()
public boolean hasCurrent()
hasCurrent
in class Value
public Value each()
public abstract Value contains(Value value)
value
- to search for in the arraypublic abstract Value containsStrict(Value value)
value
- to search for in the arraypublic abstract Value containsKey(Value key)
containsKey
in class Value
key
- to search for in the arraypublic java.util.Map.Entry<Value,Value>[] toEntryArray()
public void sort(java.util.Comparator<java.util.Map.Entry<Value,Value>> comparator, boolean resetKeys, boolean strict)
comparator
- the comparator for sorting the arrayresetKeys
- true if the keys should not be preservedstrict
- true if alphabetic keys should not be preservedpublic void serialize(Env env, java.lang.StringBuilder sb, SerializeMap serializeMap)
protected void varExportImpl(StringValue sb, int level)
varExportImpl
in class Value
public void jsonEncode(Env env, JsonEncodeContext context, StringValue sb)
Value
jsonEncode
in class Value
public void jsonEncodeAssociative(Env env, JsonEncodeContext context, StringValue sb)
public boolean keyReset(long base, boolean strict)
base
- the initial indexstrict
- if true, string keys are also resetpublic boolean eq(Value rValue)
public boolean eql(Value rValue)
public void varDumpImpl(Env env, WriteStream out, int depth, java.util.IdentityHashMap<Value,java.lang.String> valueSet) throws java.io.IOException
varDumpImpl
in class Value
java.io.IOException
protected void varDumpEntry(Env env, WriteStream out, int depth, java.util.IdentityHashMap<Value,java.lang.String> valueSet, java.util.Map.Entry<Value,Value> mapEntry) throws java.io.IOException
java.io.IOException
protected void printRImpl(Env env, WriteStream out, int depth, java.util.IdentityHashMap<Value,java.lang.String> valueSet) throws java.io.IOException
printRImpl
in class Value
java.io.IOException
protected void printREntry(Env env, WriteStream out, int depth, java.util.IdentityHashMap<Value,java.lang.String> valueSet, java.util.Map.Entry<Value,Value> mapEntry) throws java.io.IOException
java.io.IOException
public Value[] getKeyArray(Env env)
getKeyArray
in class Value
public Value[] getValueArray(Env env)
getValueArray
in class Value
public Value[] keysToArray()
public Value[] valuesToArray()
public Value getKeys()
public Value getValues()
public java.lang.Object valuesToArray(Env env, java.lang.Class elementType)
valuesToArray
in class Value