Share via


Set Class

The Set class is used for the storage and retrieval of data from a collection in which the values of the elements contained are unique and serve as the key values according to which the data is automatically ordered.

Syntax

class Set extends Object

Run On

Called

Methods

  Method Description
Gg957720.pubmethod(en-us,AX.60).gif add Adds an element to the set.
Gg957720.pubmethod(en-us,AX.60).gif cancelTimeOut Cancels a previous method call to the setTimeOut method. (Inherited from Object.)
Gg957720.pubmethod(en-us,AX.60).gif definitionString Returns a description of the type of the elements in the set.
Gg957720.pubmethod(en-us,AX.60).gif elements Returns the number of elements in the set.
Gg957720.pubmethod(en-us,AX.60).gif empty Determines whether the set is empty.
Gg957720.pubmethod(en-us,AX.60).gif equal Determines whether a set is identical to the current set. (Overrides the equal Method.)
Gg957720.pubmethod(en-us,AX.60).gif getEnumerator Creates an enumerator for a set, which allows you to traverse the set.
Gg957720.pubmethod(en-us,AX.60).gif getTimeOutTimerHandle Returns the timer handle for the object. (Inherited from Object.)
Gg957720.pubmethod(en-us,AX.60).gif handle Retrieves the handle of the class of the object. (Inherited from Object.)
Gg957720.pubmethod(en-us,AX.60).gif in Determines whether a specified element is a member of the set.
Gg957720.pubmethod(en-us,AX.60).gif new Creates a set that can contain elements of the specified type. (Overrides the new Method.)
Gg957720.pubmethod(en-us,AX.60).gif notify Releases the hold on an object that has called the wait method on this object. (Inherited from Object.)
Gg957720.pubmethod(en-us,AX.60).gif notifyAll Releases a lock on the object that was issued by the wait method on this object. (Inherited from Object.)
Gg957720.pubmethod(en-us,AX.60).gif objectOnServer Determines whether the object is on a server. (Inherited from Object.)
Gg957720.pubmethod(en-us,AX.60).gif owner Returns the instance that owns the object. (Inherited from Object.)
Gg957720.pubmethod(en-us,AX.60).gif pack Serializes the current instance of the Set class.
Gg957720.pubmethod(en-us,AX.60).gif remove Removes an element from the set.
Gg957720.pubmethod(en-us,AX.60).gif setTimeOut Sets up the scheduled execution of a specified method. (Inherited from Object.)
Gg957720.pubmethod(en-us,AX.60).gif toString Returns a string describing the contents of the set. (Overrides the toString Method.)
Gg957720.pubmethod(en-us,AX.60).gif typeId Returns the type of the values in the set.
Gg957720.pubmethod(en-us,AX.60).gif usageCount Returns the current number of references, that is, the value of the reference counter, that the object has. (Inherited from Object.)
Gg957720.pubmethod(en-us,AX.60).gif wait Pauses a process. (Inherited from Object.)
Gg957720.pubmethod(en-us,AX.60).gif xml Returns an XML string that represents the current object. (Overrides the xml Method.)
Gg957720.pubmethod(en-us,AX.60).gif Gg957720.static(en-us,AX.60).gif ::create Creates a set from the container obtained from a prior call to the Set.pack method.
Gg957720.pubmethod(en-us,AX.60).gif Gg957720.static(en-us,AX.60).gif ::createFromXML
Gg957720.pubmethod(en-us,AX.60).gif Gg957720.static(en-us,AX.60).gif ::difference Calculates and retrieves the set containing the elements from set1 that are not found in set2.
Gg957720.pubmethod(en-us,AX.60).gif Gg957720.static(en-us,AX.60).gif ::intersection Calculates and returns the identical values found in two sets.
Gg957720.pubmethod(en-us,AX.60).gif Gg957720.static(en-us,AX.60).gif ::union Calculates and retrieves the union of two given sets. This is the set that contains the values found in at least one of the sets.

Top

Remarks

The values may be of any X++ type. All values in the set must have the same type.

When a value that is already stored in the set is added, it is ignored and does not increase the number of elements in the set. The values stored in the set can be traversed by using objects of type SetEnumerator. The contents of a set are stored in a way that facilitates efficient look up of the elements.

Examples

The following example checks whether any of the values in one set, the noConfigs set, are found in a second set, the yesConfigs set. If they are, they are removed from the yesConfigs set.

Set             noConfigs; 
Set             yesConfigs; 
ConfigId        configId; 
SetEnumerator   se; 
; 
  
se = noConfigs.getEnumerator(); 
while (se.moveNext()) 
{ 
    configId    = se.current(); 
    if (yesConfigs.in(configId)) 
    { 
        yesConfigs.remove(configId); 
    } 
}

Inheritance Hierarchy

Object Class
  Set Class
    InventDimOnHand Class

See Also

SetEnumerator Class