com.esri.arcgis.system
Class Set

java.lang.Object
  extended by com.esri.arcgis.system.Set
All Implemented Interfaces:
com.esri.arcgis.interop.RemoteObjRef, ISet, Serializable

public class Set
extends Object
implements com.esri.arcgis.interop.RemoteObjRef, ISet

Generic set of objects.

Description

The Set object is used to hold a collection of objects, which do not have to be homogenous. Like the similar Array object, the Set object enables ArcObjects to pass around collections of object references in a cross platform manner; you can store and retrieve a set of object references in the same way regardless of which ArcObjects API you are using.

The Set object offers only sequential access to its members rather than the random access of an Array. It does, however, provide a method to search the set for a particular object. The most important difference between an Array object and a Set object, is that an object reference can only belong to a Set once. If you add the same object to a Set twice, no error occurs but the resulting Set has only one reference to the object. A Set is analogous to a mathematical concept of a set—there is no guaranteed order to its members. The Set object is somewhat slower than an Array for storing references to large amounts of objects. Set objects are used by several interfaces including IRelationshipClass, IFeatureEdit, and IComPropertyPage.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

See Also:
Array, Serialized Form

Constructor Summary
Set()
          Constructs a Set using ArcGIS Engine.
Set(Object obj)
          Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
Set theSet = (Set) obj;
 
Method Summary
 void add(Object unk)
          Adds an object to the set.
 boolean equals(Object o)
          Compare this object with another
 boolean find(Object unk)
          Searches for the object in the set.
static String getClsid()
          getClsid.
 int getCount()
          The element count of the set.
 int hashCode()
          the hashcode for this object
 Object next()
          Obtains the next object in the set.
 void remove(Object unk)
          Removes the object from the set.
 void removeAll()
          Removes all objects from the set.
 void reset()
          Resets the set for enumerating through the objects with Next.
 
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

Set

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

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

Set

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

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

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

add

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

Description

Adds the specified object to the Set. If you add the same object to a Set twice, no error occurs but the resulting Set has only one reference to the object.

Remarks

The order in which objects are added to the Set using Add is not guaranteed to be the same order in which they are returned by the Next method.

When adding an object to a Set, you are merely adding a new reference to the object not copying it. The reference is released when the Set is destroyed or the object is removed. For example, if you add geodatabase features to a Set (or an Array) using a feature cursor, you must use a non-recycling cursor, otherwise the memory location of the previous feature is overwritten.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
add in interface ISet
Parameters:
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(Object unk)
            throws IOException,
                   AutomationException
Removes the object from the set.

Description

Removes the reference to the specified object from the Set.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
remove in interface ISet
Parameters:
unk - A reference to another Object (IUnknown) (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 set.

Description

Removes all references to objects from the Set.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

find

public boolean find(Object unk)
             throws IOException,
                    AutomationException
Searches for the object in the set.

Description

Indicates whether a reference to the specified object has been added to the Set with the Add method.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

next

public Object next()
            throws IOException,
                   AutomationException
Obtains the next object in the set.

Description

The Next method returns the next object in the Set.

Remarks

The order that objects are returned from the Set object using the Next method is not guaranteed to be the same order as they were passed into the Add method. However, the Next method will return the objects in the same order.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

reset

public void reset()
           throws IOException,
                  AutomationException
Resets the set for enumerating through the objects with Next.

Description

The Reset method resets the Set so that the next call to the Next method returns the first object in the Set.

Remarks

The order that objects are returned from the Set object using the Next method is not guaranteed to be the same order as they were passed into the Add method. However, the Next method will return the objects in the same order.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

getCount

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

Description

Returns the number of objects in the Set.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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