com.caucho.quercus.env
Class ArrayValueWrapper

java.lang.Object
  extended by com.caucho.quercus.env.Value
      extended by com.caucho.quercus.env.ArrayValue
          extended by com.caucho.quercus.env.ArrayValueWrapper
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
SessionArrayValue

public class ArrayValueWrapper
extends ArrayValue

Represents a PHP array value.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.caucho.quercus.env.ArrayValue
ArrayValue.AbstractGet, ArrayValue.Entry, ArrayValue.EntryIterator, ArrayValue.EntrySet, ArrayValue.GetKey, ArrayValue.GetValue, ArrayValue.KeyComparator, ArrayValue.KeyIterator, ArrayValue.KeySet, ArrayValue.ValueCollection, ArrayValue.ValueComparator, ArrayValue.ValueIterator
 
Field Summary
 
Fields inherited from class com.caucho.quercus.env.ArrayValue
ARRAY, GET_KEY, GET_VALUE, KEY, VALUE
 
Fields inherited from class com.caucho.quercus.env.Value
L, NULL_ARGS, NULL_VALUE_ARRAY, SCALAR_V
 
Constructor Summary
protected ArrayValueWrapper(ArrayValue array)
           
 
Method Summary
 Value add(Value rValue)
          Returns a union of this array and the rValue as array.
 ArrayValue append(Value key, Value value)
          Adds a new value.
 void clear()
          Clears the array
 Value contains(Value key)
          Returns the corresponding key if this array contains the given value
 Value containsKey(Value key)
          Returns the corresponding value if this array contains the given key
 Value containsStrict(Value key)
          Returns the corresponding key if this array contains the given value
 Value copy()
          Copy for assignment.
 Value copy(Env env, java.util.IdentityHashMap<Value,Value> map)
          Copy for serialization
 Value copySaveFunArg()
          Copy for assignment.
 Value createTailKey()
          Creatse a tail index.
 Value current()
          Returns the current value.
 Value each()
          The each iterator
 Value end()
          Returns the last value.
 Value get(Value key)
          Gets a new value.
 Value getArg(Value index, boolean isTop)
          Returns the value as an argument which may be a reference.
 ArrayValue getArray()
          Returns the wrapped array.
 ArrayValue.Entry getHead()
          Returns the head.
 java.util.Iterator<java.util.Map.Entry<Value,Value>> getIterator(Env env)
          Returns an iterator for the key => value pairs.
 java.util.Iterator<Value> getKeyIterator(Env env)
          Returns an iterator for the field keys.
 int getSize()
          Returns the size.
protected  ArrayValue.Entry getTail()
          Returns the tail.
 java.util.Iterator<Value> getValueIterator(Env env)
          Returns an iterator for the field values.
 Var getVar(Value index)
          Returns the array ref.
 boolean hasCurrent()
          Returns true if there are more elements.
 boolean isset(Value key)
          Returns true if the index isset().
 Value key()
          Returns the current key
 Value next()
          Returns the next value.
 Value pop(Env env)
          Pops the top value.
 Value prev()
          Returns the previous value.
 Value put(Value value)
          Add
 Value put(Value key, Value value)
          Adds a new value.
 Var putVar()
          Sets the array ref.
 Value remove(Value key)
          Removes a value.
 Value reset()
          Returns the first value.
 Value shuffle()
          Shuffles the array
 ArrayValue splice(int start, int end, ArrayValue replace)
          Splices values
 ArrayValue unshift(Value value)
          Add to front.
 
Methods inherited from class com.caucho.quercus.env.ArrayValue
append, callCallback, callCallback, callCallback, cmp, copyReturn, entrySet, eq, eql, geq, getArray, getBaseIterator, getCount, getCountRecursive, getCurrent, getIterator, getKeyArray, getKeys, getObject, getRaw, getType, getValueArray, getValues, getValueType, gt, isArray, isCallable, isEmpty, jsonEncode, keyExists, keyReset, keySet, keysToArray, leq, lt, print, printREntry, printRImpl, put, put, put, put, put, put, put, put, put, put, put, putAll, serialize, setCurrent, slice, sort, toArray, toArray, toArrayValue, toAutoArray, toBinaryValueMarshalCost, toBoolean, toCallable, toCharMarshalCost, toDouble, toEntryArray, toJavaCollection, toJavaList, toJavaMap, toJavaObject, toKey, toLocalRef, toLong, toObject, toObject, toString, toStringMarshalCost, toStringValueMarshalCost, toUnicodeValueMarshalCost, values, valuesToArray, valuesToArray, varDumpEntry, varDumpImpl, varExport
 
Methods inherited from class com.caucho.quercus.env.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, copyStringBuilder, copyTree, div, div, eqValue, findFunction, generate, getCallableName, getCalledClass, getClassName, getDirty, getField, getFieldArg, getFieldArgRef, getFieldArray, getFieldObject, getFieldVar, getHashCode, getObject, getQuercusClass, getRef, getResourceType, getThisField, getThisFieldArg, getThisFieldArgRef, getThisFieldArray, getThisFieldObject, getThisFieldVar, hashCode, increment, initField, isA, isA, isBinary, isBoolean, isDefault, isDouble, isDoubleConvertible, 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, putField, putField, putField, putObject, putThisField, putThisField, rshift, serialize, set, setCharValueAt, setFieldInit, setJavaObject, sub_rev, sub, sub, subOne, toArgRef, toAutoObject, toBigDecimal, toBigInteger, toBinaryValue, toBinaryValue, toBinaryValue, toBooleanMarshalCost, toByteArrayMarshalCost, toByteMarshalCost, toChar, toCharArrayMarshalCost, toDebugString, toDoubleMarshalCost, toDoubleValue, toException, toFloatMarshalCost, toInputStream, toInt, toIntegerMarshalCost, toInternString, toJavaBoolean, toJavaByte, toJavaCalendar, toJavaCharacter, toJavaDate, toJavaDouble, toJavaFloat, toJavaInteger, toJavaLong, toJavaObject, toJavaObjectMarshalCost, toJavaObjectNotNull, toJavaShort, toJavaString, toJavaURL, toLocalThis, toLocalValue, toLocalValueReadOnly, toLocalVar, toLocalVarDeclAsRef, toLongMarshalCost, toLongValue, toRef, toRefValue, toShortMarshalCost, toString, toStringBuilder, toStringBuilder, toStringBuilder, toStringBuilder, toStringValue, toStringValue, toUnicode, toUnicodeValue, toUnicodeValue, toValue, toVar, unsetArray, unsetField, unsetThisArray, unsetThisField, varDump
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArrayValueWrapper

protected ArrayValueWrapper(ArrayValue array)
Method Detail

getArray

public ArrayValue getArray()
Returns the wrapped array.

Overrides:
getArray in class Value

copy

public Value copy()
Copy for assignment.

Specified by:
copy in class ArrayValue

copySaveFunArg

public Value copySaveFunArg()
Copy for assignment.

Overrides:
copySaveFunArg in class Value

copy

public Value copy(Env env,
                  java.util.IdentityHashMap<Value,Value> map)
Copy for serialization

Specified by:
copy in class ArrayValue

getSize

public int getSize()
Returns the size.

Specified by:
getSize in class ArrayValue

clear

public void clear()
Clears the array

Specified by:
clear in class ArrayValue

put

public Value put(Value key,
                 Value value)
Adds a new value.

Overrides:
put in class ArrayValue

append

public ArrayValue append(Value key,
                         Value value)
Adds a new value.

Specified by:
append in class ArrayValue

put

public Value put(Value value)
Add

Specified by:
put in class ArrayValue

unshift

public ArrayValue unshift(Value value)
Add to front.

Specified by:
unshift in class ArrayValue

splice

public ArrayValue splice(int start,
                         int end,
                         ArrayValue replace)
Splices values

Specified by:
splice in class ArrayValue

getArg

public Value getArg(Value index,
                    boolean isTop)
Returns the value as an argument which may be a reference.

Specified by:
getArg in class ArrayValue

putVar

public Var putVar()
Sets the array ref.

Specified by:
putVar in class ArrayValue

createTailKey

public Value createTailKey()
Creatse a tail index.

Specified by:
createTailKey in class ArrayValue

get

public Value get(Value key)
Gets a new value.

Specified by:
get in class ArrayValue

remove

public Value remove(Value key)
Removes a value.

Specified by:
remove in class ArrayValue

isset

public boolean isset(Value key)
Returns true if the index isset().

Overrides:
isset in class ArrayValue

getVar

public Var getVar(Value index)
Returns the array ref.

Specified by:
getVar in class ArrayValue

pop

public Value pop(Env env)
Pops the top value.

Specified by:
pop in class ArrayValue

shuffle

public Value shuffle()
Shuffles the array

Specified by:
shuffle in class ArrayValue

getHead

public ArrayValue.Entry getHead()
Returns the head.

Specified by:
getHead in class ArrayValue

getTail

protected ArrayValue.Entry getTail()
Returns the tail.

Specified by:
getTail in class ArrayValue

current

public Value current()
Returns the current value.

Overrides:
current in class ArrayValue

key

public Value key()
Returns the current key

Overrides:
key in class ArrayValue

hasCurrent

public boolean hasCurrent()
Returns true if there are more elements.

Overrides:
hasCurrent in class ArrayValue

next

public Value next()
Returns the next value.

Overrides:
next in class ArrayValue

prev

public Value prev()
Returns the previous value.

Overrides:
prev in class ArrayValue

each

public Value each()
The each iterator

Overrides:
each in class ArrayValue

reset

public Value reset()
Returns the first value.

Overrides:
reset in class ArrayValue

end

public Value end()
Returns the last value.

Overrides:
end in class ArrayValue

contains

public Value contains(Value key)
Returns the corresponding key if this array contains the given value

Specified by:
contains in class ArrayValue
Parameters:
value - to search for in the array
Returns:
the key if it is found in the array, NULL otherwise

containsStrict

public Value containsStrict(Value key)
Returns the corresponding key if this array contains the given value

Specified by:
containsStrict in class ArrayValue
Parameters:
value - to search for in the array
Returns:
the key if it is found in the array, NULL otherwise

containsKey

public Value containsKey(Value key)
Returns the corresponding value if this array contains the given key

Specified by:
containsKey in class ArrayValue
Parameters:
key - to search for in the array
Returns:
the value if it is found in the array, NULL otherwise

add

public Value add(Value rValue)
Description copied from class: ArrayValue
Returns a union of this array and the rValue as array. If the rValue is not an array, the returned union contains the elements of this array only. To append a value to this ArrayValue use the ArrayValue.put(Value) method.

Overrides:
add in class ArrayValue

getIterator

public java.util.Iterator<java.util.Map.Entry<Value,Value>> getIterator(Env env)
Description copied from class: Value
Returns an iterator for the key => value pairs.

Overrides:
getIterator in class Value

getKeyIterator

public java.util.Iterator<Value> getKeyIterator(Env env)
Description copied from class: Value
Returns an iterator for the field keys. The default implementation uses the Iterator returned by Value.getIterator(Env); derived classes may override and provide a more efficient implementation.

Overrides:
getKeyIterator in class ArrayValue

getValueIterator

public java.util.Iterator<Value> getValueIterator(Env env)
Description copied from class: Value
Returns an iterator for the field values. The default implementation uses the Iterator returned by Value.getIterator(Env); derived classes may override and provide a more efficient implementation.

Overrides:
getValueIterator in class ArrayValue