jsdai.lang
Class SdaiIterator

java.lang.Object
  extended byjsdai.lang.SdaiIterator

public class SdaiIterator
extends java.lang.Object

The instances of the class SdaiIterator are used to iterate through the members of an Aggregate. For aggregates of the EXPRESS type SET or BAG, the only possible access procedure is to start from the beginning of the aggregate and go through all aggregate members using next method. For aggregates of the EXPRESS type LIST or ARRAY, examination of their members is possible in both directions: forward, using methods beginning and next and backward, using methods end and previous.

See Also:
"ISO 10303-22::9.4.1 iterator"

Method Summary
 void beginning()
          Positions this SdaiIterator before the first member of the aggregate to which this SdaiIterator is attached.
 void end()
          Positions this SdaiIterator after the last member of the aggregate to which this SdaiIterator is attached.
 int getValueBound()
          This method is not implemented in current JSDAI version.
 boolean next()
          Positions this SdaiIterator to reference the next member of the aggregate to which this SdaiIterator is attached.
 boolean previous()
          Positions this SdaiIterator to reference the preceding member of the aggregate to which this SdaiIterator is attached.
 boolean remove()
          Removes the member referenced by this SdaiIterator from the aggregate to which this SdaiIterator is attached.
 void unset()
          Changes the value of a member of the attached aggregate at the position specified by this SdaiIterator so that this aggregate has no value at that position.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

beginning

public void beginning()
               throws SdaiException
Positions this SdaiIterator before the first member of the aggregate to which this SdaiIterator is attached.

Throws:
SdaiException - SS_NOPN, session is not open.
SdaiException - MX_NDEF, SdaiModel access not defined.
SdaiException - EI_NEXS, entity instance does not exist.
SdaiException - AI_NEXS, aggregate instance does not exist.
SdaiException - AI_NVLD, aggregate instance invalid.
SdaiException - MO_NEXS, SDAI-model does not exist.
See Also:
"ISO 10303-22::10.12.5 Beginning"

next

public boolean next()
             throws SdaiException
Positions this SdaiIterator to reference the next member of the aggregate to which this SdaiIterator is attached. If the iterator currently references the last element, or is at the end of the related aggregate and thus has no current member, or this aggregate is empty, then the iterator is positioned to the end of the aggregate without referencing any aggregate member. This method is valid for aggregates of any EXPRESS type: ARRAY, LIST, SET, BAG.

Returns:
true if iterator has a new current member, false otherwise.
Throws:
SdaiException - SS_NOPN, session is not open.
SdaiException - MX_NDEF, SdaiModel access not defined.
SdaiException - EI_NEXS, entity instance does not exist.
SdaiException - AI_NEXS, aggregate instance does not exist.
SdaiException - AI_NVLD, aggregate instance invalid.
SdaiException - MO_NEXS, SDAI-model does not exist.
See Also:
previous(), "ISO 10303-22::10.12.6 Next"

getValueBound

public int getValueBound()
                  throws SdaiException
This method is not implemented in current JSDAI version.

SdaiException EX_NSUP will be thrown if this method is invoked.

Returns:
the value bound for the aggregate member at the position specified by this SdaiIterator.
Throws:
SdaiException - EX_NSUP, expression evaluation not supported.
See Also:
"ISO 10303-22::10.12.8 Get value bound by iterator"

remove

public boolean remove()
               throws SdaiException
Removes the member referenced by this SdaiIterator from the aggregate to which this SdaiIterator is attached. If the specified member is an aggregate instance, then that aggregate instance is deleted along with all nested aggregate instances contained by it. After execution of this method the iterator is positioned as if next method was applied. The method is valid for aggregates of only EXPRESS types different than ARRAY.

The list of cases when SdaiException is thrown contains the following items:

Throws:
SdaiException - MX_NRW, SDAI-model access not read-write.
SdaiException - EI_NEXS, entity instance does not exist.
SdaiException - AI_NEXS, aggregate instance does not exist.
SdaiException - AI_NVLD, aggregate instance invalid.
SdaiException - AI_NSET, aggregate instance is empty.
SdaiException - IR_NSET, current member is not defined.
SdaiException - FN_NAVL, function not available.
See Also:
next(), "ISO 10303-22::10.13.3 Remove current member"

end

public void end()
         throws SdaiException
Positions this SdaiIterator after the last member of the aggregate to which this SdaiIterator is attached. The method is valid only when the EXPRESS type of the attached aggregate is either ARRAY or LIST.

Throws:
SdaiException - SS_NOPN, session is not open.
SdaiException - MX_NDEF, SdaiModel access not defined.
SdaiException - EI_NEXS, entity instance does not exist.
SdaiException - AI_NEXS, aggregate instance does not exist.
SdaiException - AI_NVLD, aggregate instance invalid.
See Also:
"ISO 10303-22::10.15.2 end"

previous

public boolean previous()
                 throws SdaiException
Positions this SdaiIterator to reference the preceding member of the aggregate to which this SdaiIterator is attached. If the iterator currently references the first element, or is at the beginning of the related aggregate and thus has no current member, or this aggregate is empty, then the iterator is positioned to the beginning of the aggregate without referencing any aggregate member. The method is valid only when the EXPRESS type of the attached aggregate is either ARRAY or LIST.

Returns:
true if iterator has a new current member, false otherwise.
Throws:
SdaiException - SS_NOPN, session is not open.
SdaiException - MX_NDEF, SdaiModel access not defined.
SdaiException - EI_NEXS, entity instance does not exist.
SdaiException - AI_NEXS, aggregate instance does not exist.
SdaiException - AI_NVLD, aggregate instance invalid.
See Also:
next(), "ISO 10303-22::10.15.3 Previous"

unset

public void unset()
           throws SdaiException
Changes the value of a member of the attached aggregate at the position specified by this SdaiIterator so that this aggregate has no value at that position. A subsequent application of testByIndex methods at this index position will return value 0. If the old value is an aggregate instance, then it is deleted along with any nested aggregate instances contained by it. The method is valid only if the type of the aggregate attached to this SdaiIterator is ARRAY. If this condition is violated, then SdaiException AI_NVLD is thrown.

Throws:
SdaiException - MX_NRW, SDAI-model access not read-write.
SdaiException - EI_NEXS, entity instance does not exist.
SdaiException - AI_NEXS, aggregate instance does not exist.
SdaiException - AI_NVLD, aggregate instance invalid.
SdaiException - IR_NSET, current member is not defined.
SdaiException - FN_NAVL, function not available.
See Also:
"ISO 10303-22::10.18.2 Unset value current member"

Copyright © LKSoftWare GmbH, 1999-2008