com.esri.arcgis.system
Class Array

java.lang.Object
  extended by com.esri.arcgis.system.Array
All Implemented Interfaces:
com.esri.arcgis.interop.RemoteObjRef, IArray, IArray2, IXMLSerialize, Serializable

public class Array
extends Object
implements com.esri.arcgis.interop.RemoteObjRef, IArray, IArray2, IXMLSerialize

Generic array of objects.

Description

The Array object enables ArcObjects to pass around arrays of object references in a cross platform manner; you can store and retrieve an array of object references in the same way regardless of which ArcObjects API you are using. Unlike the similar Set object, Arrays offer random access by indexed lookup. You can also insert, remove, or replace objects at any position in the Array. The array is heterogeneous, that is the objects in it do not need to be of the same type.

Array objects are used by several interfaces including IIdentify and IMapControl2.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

See Also:
Set, Serialized Form

Constructor Summary
Array()
          Constructs a Array using ArcGIS Engine.
Array(Object obj)
          Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
Array theArray = (Array) obj;
 
Method Summary
 void add(Object unk)
          Adds an object to the array.
 void deserialize(IXMLSerializeData data)
          Deserializes an object from XML.
 boolean equals(Object o)
          Compare this object with another
static String getClsid()
          getClsid.
 int getCount()
          The element count of the array.
 Object getElement(int index)
          Searches for the object in the array.
 int hashCode()
          the hashcode for this object
 void insert(int index, Object unk)
          Adds an object to the array at the specified index.
 void remove(int index)
          Removes an object from the array.
 void removeAll()
          Removes all objects from the array.
 void replace(int index, Object unk)
          Replaces an object in the array.
 void serialize(IXMLSerializeData data)
          Serializes an object to XML.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.esri.arcgis.interop.RemoteObjRef
getJintegraDispatch, release
 

Constructor Detail

Array

public Array()
      throws IOException,
             UnknownHostException
Constructs a Array using ArcGIS Engine.

Throws:
IOException - if there are interop problems
UnknownHostException - if there are interop problems

Array

public Array(Object obj)
      throws IOException
Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
Array theArray = (Array) obj;

Construct a Array using a reference to such an object returned from ArcGIS Engine or Server. This is semantically equivalent to casting obj to Array.

Parameters:
obj - an object returned from ArcGIS Engine or Server
Throws:
IOException - if there are interop problems
Method Detail

getClsid

public static String getClsid()
getClsid.


equals

public boolean equals(Object o)
Compare this object with another

Overrides:
equals in class Object

hashCode

public int hashCode()
the hashcode for this object

Overrides:
hashCode in class Object

getCount

public int getCount()
             throws IOException,
                    AutomationException
The element count of the array.

Description

Returns the number of elements in the array.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
getCount in interface IArray
Returns:
The count
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getElement

public Object getElement(int index)
                  throws IOException,
                         AutomationException
Searches for the object in the array.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getElement in interface IArray
Parameters:
index - The index (in)
Returns:
A reference to another Object (IUnknown)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

add

public void add(Object unk)
         throws IOException,
                AutomationException
Adds an object to the array.

Description

Adds the element to the end of the array.

Remarks

When adding an object to an Array, you are merely adding a new reference to the object not copying it. The reference is released when the Array is destroyed or the object is removed.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
add in interface IArray
Parameters:
unk - A reference to another Object (IUnknown) (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

insert

public void insert(int index,
                   Object unk)
            throws IOException,
                   AutomationException
Adds an object to the array at the specified index.

Description

Adds the element to the array at the specified index. The element at the beginning or the array has an index of 0, and the element at the end of the array has in index of Count - 1.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
insert in interface IArray
Parameters:
index - The index (in)
unk - A reference to another Object (IUnknown) (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

remove

public void remove(int index)
            throws IOException,
                   AutomationException
Removes an object from the array.

Description

Removes the element at the specified index from the array. The element at the beginning or the array has an index of 0, and the element at the end of the array has in index of Count - 1.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
remove in interface IArray
Parameters:
index - The index (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

removeAll

public void removeAll()
               throws IOException,
                      AutomationException
Removes all objects from the array.

Description

Removes all of the elements from the array.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
removeAll in interface IArray
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

replace

public void replace(int index,
                    Object unk)
             throws IOException,
                    AutomationException
Replaces an object in the array.

Description

Replaces the element at the specified index in the array with the specified element. The element at the beginning or the array has an index of 0, and the element at the end of the array has in index of Count - 1.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
replace in interface IArray2
Parameters:
index - The index (in)
unk - A reference to another Object (IUnknown) (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

serialize

public void serialize(IXMLSerializeData data)
               throws IOException,
                      AutomationException
Serializes an object to XML.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
serialize in interface IXMLSerialize
Parameters:
data - A reference to a com.esri.arcgis.system.IXMLSerializeData (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

deserialize

public void deserialize(IXMLSerializeData data)
                 throws IOException,
                        AutomationException
Deserializes an object from XML.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
deserialize in interface IXMLSerialize
Parameters:
data - A reference to a com.esri.arcgis.system.IXMLSerializeData (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.