com.maryanovsky.gwtutils.client
Class JsMixedArray

java.lang.Object
  extended by com.google.gwt.core.client.JavaScriptObject
      extended by com.maryanovsky.gwtutils.client.JsMixedArray

public final class JsMixedArray
extends JavaScriptObject

An overlay for a non-homogenous JavaScript array. It's up to the user to know the actual types of the elements.

Author:
Maryanovsky Alexander

Constructor Summary
protected JsMixedArray()
          The required no-arg protected constructor.
 
Method Summary
 boolean getBoolean(int index)
          Returns the element at the specified index, as a boolean.
 double getDouble(int index)
          Returns the element at the specified index, as a double.
 int getInt(int index)
          Returns the element at the specified index, as an integer.
 JavaScriptObject getObject(int index)
          Returns the element at the specified index, as a raw JavaScriptObject.
 String getString(int index)
          Returns the element at the specified index, as a String.
 String join()
          Converts each element of the array into a string and joins them together with a comma separator.
 String join(String separator)
          Converts each element of the array into a string and joins them together with the specified separator.
 int length()
          Returns the size of the array.
 void pushBoolean(boolean value)
          Pushes the specified String value onto the end of the array.
 void pushDouble(double value)
          Pushes the specified double value onto the end of the array.
 void pushInt(int value)
          Pushes the specified integer value onto the end of the array.
 void pushObject(JavaScriptObject value)
          Pushes the specified raw JavaScriptObject value onto the end of the array.
 void pushString(String value)
          Pushes the specified String value onto the end of the array.
 void setBoolean(int index, boolean value)
          Sets the value at the specified index to the specified boolean.
 void setDouble(int index, double value)
          Sets the value at the specified index to the specified double.
 void setInt(int index, int value)
          Sets the value at the specified index to the specified integer.
 void setLength(int length)
          Sets the length of the array.
 void setObject(int index, JavaScriptObject value)
          Sets the value at the specified index to the specified raw JavaScriptObject.
 void setString(int index, String value)
          Sets the value at the specified index to the specified String.
 boolean shiftBoolean()
          Removes the first element of the array and returns it, as a boolean.
 double shiftDouble()
          Removes the first element of the array and returns it, as a double.
 int shiftInt()
          Removes the first element of the array and returns it, as an integer.
 JavaScriptObject shiftObject()
          Removes the first element of the array and returns it, as a raw JavaScriptObject.
 String shiftString()
          Removes the first element of the array and returns it, as an String.
 void unshiftBoolean(boolean value)
          Pushes the specified boolean value into the beginning of the array.
 void unshiftDouble(double value)
          Pushes the specified double value into the beginning of the array.
 void unshiftInt(int value)
          Pushes the specified integer value into the beginning of the array.
 void unshiftObject(JavaScriptObject value)
          Pushes the specified raw JavaScriptObject value into the beginning of the array.
 void unshiftString(String value)
          Pushes the specified String value into the beginning of the array.
 
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createFunction, createObject, equals, hashCode, toSource, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JsMixedArray

protected JsMixedArray()
The required no-arg protected constructor.

Method Detail

length

public int length()
Returns the size of the array.


setLength

public void setLength(int length)
Sets the length of the array.


getInt

public int getInt(int index)
Returns the element at the specified index, as an integer.


getString

public String getString(int index)
Returns the element at the specified index, as a String.


getDouble

public double getDouble(int index)
Returns the element at the specified index, as a double.


getBoolean

public boolean getBoolean(int index)
Returns the element at the specified index, as a boolean.


getObject

public JavaScriptObject getObject(int index)
Returns the element at the specified index, as a raw JavaScriptObject.


setInt

public void setInt(int index,
                   int value)
Sets the value at the specified index to the specified integer.


setString

public void setString(int index,
                      String value)
Sets the value at the specified index to the specified String.


setDouble

public void setDouble(int index,
                      double value)
Sets the value at the specified index to the specified double.


setBoolean

public void setBoolean(int index,
                       boolean value)
Sets the value at the specified index to the specified boolean.


setObject

public void setObject(int index,
                      JavaScriptObject value)
Sets the value at the specified index to the specified raw JavaScriptObject.


pushInt

public void pushInt(int value)
Pushes the specified integer value onto the end of the array.


pushString

public void pushString(String value)
Pushes the specified String value onto the end of the array.


pushDouble

public void pushDouble(double value)
Pushes the specified double value onto the end of the array.


pushBoolean

public void pushBoolean(boolean value)
Pushes the specified String value onto the end of the array.


pushObject

public void pushObject(JavaScriptObject value)
Pushes the specified raw JavaScriptObject value onto the end of the array.


shiftInt

public int shiftInt()
Removes the first element of the array and returns it, as an integer.


shiftString

public String shiftString()
Removes the first element of the array and returns it, as an String.


shiftDouble

public double shiftDouble()
Removes the first element of the array and returns it, as a double.


shiftBoolean

public boolean shiftBoolean()
Removes the first element of the array and returns it, as a boolean.


shiftObject

public JavaScriptObject shiftObject()
Removes the first element of the array and returns it, as a raw JavaScriptObject.


unshiftInt

public void unshiftInt(int value)
Pushes the specified integer value into the beginning of the array.


unshiftString

public void unshiftString(String value)
Pushes the specified String value into the beginning of the array.


unshiftDouble

public void unshiftDouble(double value)
Pushes the specified double value into the beginning of the array.


unshiftBoolean

public void unshiftBoolean(boolean value)
Pushes the specified boolean value into the beginning of the array.


unshiftObject

public void unshiftObject(JavaScriptObject value)
Pushes the specified raw JavaScriptObject value into the beginning of the array.


join

public String join()
Converts each element of the array into a string and joins them together with a comma separator.


join

public String join(String separator)
Converts each element of the array into a string and joins them together with the specified separator.