fr.umlv.corosol.component.impl
Class DefaultJArray

java.lang.Object
  extended by fr.umlv.corosol.component.impl.DefaultJArray
All Implemented Interfaces:
JAllocatable, JArray, JHeapObject, JObject

public class DefaultJArray
extends java.lang.Object
implements JArray

The default implementation of the JArray interface representing an array allocated into the Corosol heap.

Author:
Christophe Deleray

Field Summary
 
Fields inherited from interface fr.umlv.corosol.component.JArray
T_BOOLEAN, T_BYTE, T_CHAR, T_DOUBLE, T_FLOAT, T_INT, T_LONG, T_SHORT
 
Constructor Summary
DefaultJArray(int length)
          Creates a new DefaultJArray object representing a new array of length element.
 
Method Summary
 boolean getBoolean(int index)
          Returns the boolean value stored at the specified index.
 byte getByte(int index)
          Returns the byte value stored at the specified index.
 char getChar(int index)
          Returns the char value stored at the specified index.
 JClass getComponentType()
          Returns the component type of this array.
 double getDouble(int index)
          Returns the double value stored at the specified index.
 float getFloat(int index)
          Returns the float value stored at the specified index.
 int getInt(int index)
          Returns the int value stored at the specified index.
 long getLong(int index)
          Returns the long value stored at the specified index.
 java.lang.Object getNativeObject()
          Returns a proxy of the class instance represented by this JClassInstance object.
 JHeapObject getObject(int index)
          Returns the object whose the reference value is stored at the specified index.
 int getPosition()
          Returns the position of the first byte of the memory allocated for the array representing by this JArray object into the Corosol heap memory.
 short getShort(int index)
          Returns the short value stored at the specified index.
 int getSize()
          Returns the size in bytes of this object into the Corosol memory heap.
 JClass getType()
          Returns the dynamic type of the array represented by the DefaultJArray object.
 boolean isNative()
          Determines if the class instance represented by this JClassInstance object is allocated into the underlaying JVM heap and not into the Corosol JVM heap.
 int length()
          Returns the length of this array.
 void setBoolean(boolean value, int index)
          Sets the specified entry with a specified boolean value.
 void setByte(byte value, int index)
          Sets the specified entry with a specified byte value.
 void setChar(char value, int index)
          Sets the specified entry with a specified char value.
 void setDouble(double value, int index)
          Sets the specified entry with a specified double value.
 void setFloat(float value, int index)
          Sets the specified entry with a specified float value.
 void setInt(int value, int index)
          Sets the specified entry with a specified int value.
 void setLayout(JArrayLayout layout)
          Sets the layout of the array representing by this JArray object.
 void setLong(long value, int index)
          Sets the specified entry with a specified long value.
 void setObject(JHeapObject object, int index)
          Sets the specified entry with the reference of the specified object.
 void setPosition(int index)
          Sets the position of the first byte of the memory allocated for the array representing by this JArray object into the Corosol heap memory.
 void setShort(short value, int index)
          Sets the specified entry with a specified short value.
 java.lang.String toString()
          Returns a String representation of the class instance represented by this JClassInstance object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultJArray

public DefaultJArray(int length)
Creates a new DefaultJArray object representing a new array of length element.

Parameters:
length - the length of this array
Method Detail

length

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

Specified by:
length in interface JArray

getComponentType

public JClass getComponentType()
Returns the component type of this array.

Specified by:
getComponentType in interface JArray

getBoolean

public boolean getBoolean(int index)
Returns the boolean value stored at the specified index.

Specified by:
getBoolean in interface JArray
Parameters:
index - an index of an entry
Returns:
the value stored at the specified index

getByte

public byte getByte(int index)
Returns the byte value stored at the specified index.

Specified by:
getByte in interface JArray
Parameters:
index - an index of an entry
Returns:
the value stored at the specified index

getChar

public char getChar(int index)
Returns the char value stored at the specified index.

Specified by:
getChar in interface JArray
Parameters:
index - an index of an entry
Returns:
the value stored at the specified index

getDouble

public double getDouble(int index)
Returns the double value stored at the specified index.

Specified by:
getDouble in interface JArray
Parameters:
index - an index of an entry
Returns:
the value stored at the specified index

getFloat

public float getFloat(int index)
Returns the float value stored at the specified index.

Specified by:
getFloat in interface JArray
Parameters:
index - an index of an entry
Returns:
the value stored at the specified index

getInt

public int getInt(int index)
Returns the int value stored at the specified index.

Specified by:
getInt in interface JArray
Parameters:
index - an index of an entry
Returns:
the value stored at the specified index

getLong

public long getLong(int index)
Returns the long value stored at the specified index.

Specified by:
getLong in interface JArray
Parameters:
index - an index of an entry
Returns:
the value stored at the specified index

getShort

public short getShort(int index)
Returns the short value stored at the specified index.

Specified by:
getShort in interface JArray
Parameters:
index - an index of an entry
Returns:
the value stored at the specified index

getObject

public JHeapObject getObject(int index)
Returns the object whose the reference value is stored at the specified index.

Specified by:
getObject in interface JArray
Parameters:
index - an index of an entry
Returns:
the object whose the reference value is stored at the specified index

setBoolean

public void setBoolean(boolean value,
                       int index)
Sets the specified entry with a specified boolean value.

Specified by:
setBoolean in interface JArray
Parameters:
value - the value to be stored
index - an index of an entry

setByte

public void setByte(byte value,
                    int index)
Sets the specified entry with a specified byte value.

Specified by:
setByte in interface JArray
Parameters:
value - the value to be stored
index - an index of an entry

setChar

public void setChar(char value,
                    int index)
Sets the specified entry with a specified char value.

Specified by:
setChar in interface JArray
Parameters:
value - the value to be stored
index - an index of an entry

setDouble

public void setDouble(double value,
                      int index)
Sets the specified entry with a specified double value.

Specified by:
setDouble in interface JArray
Parameters:
value - the value to be stored
index - an index of an entry

setFloat

public void setFloat(float value,
                     int index)
Sets the specified entry with a specified float value.

Specified by:
setFloat in interface JArray
Parameters:
value - the value to be stored
index - an index of an entry

setInt

public void setInt(int value,
                   int index)
Sets the specified entry with a specified int value.

Specified by:
setInt in interface JArray
Parameters:
value - the value to be stored
index - an index of an entry

setLong

public void setLong(long value,
                    int index)
Sets the specified entry with a specified long value.

Specified by:
setLong in interface JArray
Parameters:
value - the value to be stored
index - an index of an entry

setShort

public void setShort(short value,
                     int index)
Sets the specified entry with a specified short value.

Specified by:
setShort in interface JArray
Parameters:
value - the value to be stored
index - an index of an entry

setObject

public void setObject(JHeapObject object,
                      int index)
Sets the specified entry with the reference of the specified object.

Specified by:
setObject in interface JArray
Parameters:
object - the object whose the reference value will be stored
index - an index of an entry

setLayout

public void setLayout(JArrayLayout layout)
Sets the layout of the array representing by this JArray object. layout describes the relative position of each entry of this array into the memory allocated for it.

Specified by:
setLayout in interface JArray
Parameters:
layout - the layout describing the entry positions of this array

getPosition

public int getPosition()
Returns the position of the first byte of the memory allocated for the array representing by this JArray object into the Corosol heap memory.

Specified by:
getPosition in interface JAllocatable
Returns:
the position of the first byte of the memory allocated for this object into the Corosol heap memory

setPosition

public void setPosition(int index)
Sets the position of the first byte of the memory allocated for the array representing by this JArray object into the Corosol heap memory.

Specified by:
setPosition in interface JAllocatable
Parameters:
index - the position of the first byte of the memory allocated for this array into the Corosol heap memory.

getSize

public int getSize()
Returns the size in bytes of this object into the Corosol memory heap.

Specified by:
getSize in interface JAllocatable

getNativeObject

public java.lang.Object getNativeObject()
Returns a proxy of the class instance represented by this JClassInstance object.

Specified by:
getNativeObject in interface JHeapObject

getType

public JClass getType()
Returns the dynamic type of the array represented by the DefaultJArray object.

Specified by:
getType in interface JHeapObject
Returns:
the JClass object representing the dynamic type of this class instance

isNative

public boolean isNative()
Determines if the class instance represented by this JClassInstance object is allocated into the underlaying JVM heap and not into the Corosol JVM heap.

Specified by:
isNative in interface JHeapObject
Returns:
true if this class instance is allocated into the underlaying JVM heap; false otherwise.

toString

public java.lang.String toString()
Returns a String representation of the class instance represented by this JClassInstance object.

Overrides:
toString in class java.lang.Object