Synergex.SynergyDE.Select.AlphaEnumerator
WTSupported in traditional Synergy on Windows
|
WNSupported in Synergy .NET on Windows
|
USupported on UNIX
|
VSupported on OpenVMS
|
namespace Synergex.SynergyDE.Select public class RestrictedAlphaEnumerator public sealed class AlphaEnumerator extends RestrictedAlphaEnumerator
The AlphaEnumerator class is an enumerator class that is used to access elements of a selection and their attributes. An AlphaEnumerator class object is required to retrieve data from a selection. Initially, following the creation of the enumerator, it is positioned before the first element in the selection. The MoveNext() method is used to position to the next element and retrieve the data, one element per call.
Since AlphaEnumerator extends RestrictedAlphaEnumerator, an AlphaEnumerator object has access to methods and properties in RestricteAlphaEnumerator. In addition, it has the properties and methods below.
public Count
Implements a get method that returns the number of elements currently in the file that match the selection criteria. Note: This property must iterate through the entire file (which may cause extensive I/O local to the file) and finish by calling the Reset() method. (int)
public MoveNext(), boolean
Advances to the next record and returns true if successful and false if there are no more records. This method performs actual I/O based on the selection criteria.
public Reset(), void
Resets the enumerator to its initial position before the first element in the selection.
Discussion
All Select methods use the whole AlphaEnumerator (and not RestrictedAlphaEnumerator) except GetEnum().
The AlphaEnumerator class object and members are not available from within a FOREACH statement. |
The get method of the Current property (see Synergex.SynergyDE.Select.RestrictedAlphaEnumerator) returns the same record until either MoveNext() or Reset() is called. The set method requires the file to be opened for update and the current record to be locked, or else an “Invalid operation for file type” error ($ERR_FILOPT) and “No current record” error ($ERR_NOCURR) will be generated. When Select.SparseRecord() has been used on the Select object, using the set method will generate an “Invalid operation: Using Current method with a sparse record not allowed, use SparseUpdate” error ($ERR_INVOPER).
Both get and set methods (of the Current property) generate a “No current record” error if the enumerator is in its initial position (prior to calling MoveNext() or after calling Reset()) or in its final position (after MoveNext() returns false, indicating EOF).
If automatic record locking is enabled, the MoveNext() method causes the obtained record to be locked and any prior selected record to be unlocked. If the next record that matches the selection criteria is locked, one of the following occurs:
- If locking has not been changed by the From class object, standard record locked behavior will occur: An $ERR_LOCKED error is generated or execution is suspended if DFLAG 3 (wait on lock) is set. (See Synergex.SynergyDE.Select.From.)
- The Event.onLock() method is called, and if it is overridden and returns true, another attempt is made to read the record. (See Synergex.SynergyDE.Select.Event.)
Locked records that do not match the selection criteria are always skipped, so handling a lock in that condition is not necessary.
The CurrentRFA() method returns the same RFA or GRFA until either MoveNext() or Reset() is called. If the enumerator is in its initial position (prior to calling MoveNext() or after calling Reset()) or in its final position (after MoveNext() returns false), a “No current record” error ($ERR_NOCURR) will occur.
Because the enumerator is a snapshot in time, when following the Count property, MoveNext() may encounter more or fewer elements than returned by Count if updates are allowed to occur to the file.
See also
Synergex.SynergyDE.Select.RestrictedAlphaEnumerator class