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
_current, 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.
 void clear()
          Clears the array
 Value containsKey(Value key)
          Returns the corresponding valeu if this array contains the given key
 Value copy()
          Copy for assignment.
 Value copy(Env env, java.util.IdentityHashMap<Value,Value> map)
          Copy for serialization
 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)
          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.
 Var getRef(Value index)
          Returns the array ref.
 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.
 boolean hasCurrent()
          Returns true if there are more elements.
 Value key()
          Returns the current key
 Value next()
          Returns the next value.
 Value pop()
          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.
 Value putRef()
          Sets the array ref.
 Value remove(Value key)
          Removes a value.
 Value reset()
          Returns the first value.
 void 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, append, cmp, contains, containsStrict, copyReturn, entrySet, eq, eql, geq, getArray, getCount, getCountRecursive, getKeyArray, getObject, getRaw, getType, getValueArray, getValueType, gt, isArray, isEmpty, keyReset, keySet, leq, lt, print, printREntry, printRImpl, put, put, put, put, put, put, put, put, put, put, putAll, serialize, sort, toArray, toArray, toArrayValue, toBoolean, toEntryArray, toJavaCollection, toJavaList, toJavaMap, toJavaObject, toObject, toObject, toString, values, valuesToArray, valuesToArray, varDumpEntry, varDumpImpl, varExport
 
Methods inherited from class com.caucho.quercus.env.Value
add, appendTo, appendTo, appendTo, appendTo, bitAnd, bitOr, bitXor, callClassMethod, callMethod, callMethod, 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, callMethodRef, callMethodRef, charValueAt, checkPrivate, checkProtected, clone, copy, copyArrayItem, copyTree, div, div, eqValue, findFunction, generate, getClassName, getDirty, getField, getFieldArg, getFieldArgRef, getFieldArray, getFieldObject, getFieldRef, getObject, getResourceType, getThisField, getThisFieldArg, getThisFieldArgRef, getThisFieldArray, getThisFieldObject, getThisFieldRef, isA, isBinary, isBoolean, isDefault, isDoubleConvertible, isLongConvertible, isNull, isNumberConvertible, isNumeric, isObject, isResource, isset, isset, issetField, issetThisField, isString, isUnicode, length, lshift, mod, mul, mul, neg, nextIndex, pos, postincr, preincr, print, printDepth, printJavaString, printR, putArray, putField, putField, putObject, putThisField, rshift, serialize, set, setCharValueAt, sub_rev, sub, sub, toArgValue, toArgValueReadOnly, toAutoArray, toAutoObject, toBigDecimal, toBigInteger, toBinaryValue, toBinaryValue, toChar, toDebugString, toDouble, toDoubleValue, toException, toInputStream, toInt, toInternString, toJavaBoolean, toJavaByte, toJavaCalendar, toJavaCharacter, toJavaDate, toJavaDouble, toJavaFloat, toJavaInteger, toJavaLong, toJavaObject, toJavaObjectNotNull, toJavaShort, toJavaString, toJavaURL, toKey, toLong, toLongValue, toRef, toRefValue, toRefVar, toString, toStringBuilder, toStringBuilder, toStringValue, toUnicodeValue, toUnicodeValue, toValue, toVar, unsetField, unsetThisField, varDump
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, 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

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.

Specified by:
put 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)
Returns the value as an argument which may be a reference.

Specified by:
getArg in class ArrayValue

putRef

public Value putRef()
Sets the array ref.

Specified by:
putRef 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

getRef

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

Specified by:
getRef in class ArrayValue

pop

public Value pop()
Pops the top value.

Specified by:
pop in class ArrayValue

shuffle

public void 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

containsKey

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

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

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 ArrayValue

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