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