/IF NOT DEFINED (VECTOR_QRPGLEH) /DEFINE VECTOR_QRPGLEH /*===================================================================*/ /* Vector */ /* inspirated by java.util.Vector */ /*-------------------------------------------------------------------*/ /* add(int handle, blob element) */ /* adds element at the end */ /* sets current position to the end of the vector */ /* stores copy of element and length of element */ /* add(int handle, blob element, int position) */ /* adds element at position and shifts element currently */ /* at this position (if any) and any subsequent elements */ /* to the right */ /* sets current position of the vector to position */ /*-------------------------------------------------------------------*/ d add PR EXTPROC('VECTOR_add') d handle 10i 0 d element 65535a VALUE d VARYING d position 10i 0 OPTIONS(*NOPASS) d value /*-------------------------------------------------------------------*/ /* blob get(int handle) */ /* returns element from the next position */ /* returns *blank at end of vector */ /* sets current position to next position until end of vector */ /* blob get(int handle, int position) */ /* returns element from position */ /* throws exception if position is out of range of the vector */ /*-------------------------------------------------------------------*/ d get PR 65535a EXTPROC('VECTOR_get') d VARYING d handle 10i 0 d position 10i 0 OPTIONS(*NOPASS) d value /*-------------------------------------------------------------------*/ /* blob set(int handle, blob element, int position) */ /* inserts element at position */ /* shifts all following entries one position */ /* if position exceeds size entry is put to the end */ /* returns old entry from position */ /* current position is set to position */ /*-------------------------------------------------------------------*/ d set PR 65535a EXTPROC('VECTOR_set') d handle 10i 0 d element 65535a VALUE d VARYING d position 10i 0 value /*-------------------------------------------------------------------*/ /* blob remove(int handle, int position) */ /* removes element from position */ /* following entries are shifted one position down */ /* returns old entry from position */ /* current position is set to position */ /* throws exception if position is out of range */ /*-------------------------------------------------------------------*/ d remove PR 65535a EXTPROC('VECTOR_remove') d handle 10i 0 d position 10i 0 OPTIONS(*NOPASS) d VALUE /*-------------------------------------------------------------------*/ /* boolean isEmpty(int handle) */ /* returns TRUE if Vector has no entries */ /* else FALSE */ /*-------------------------------------------------------------------*/ d isEmpty PR n EXTPROC('VECTOR_isEmpty') d handle 10i 0 /*-------------------------------------------------------------------*/ /* void clear(int handle) */ /* clear Vector (if needed) and frees storage */ /*-------------------------------------------------------------------*/ d clear PR EXTPROC('VECTOR_clear') d handle 10i 0 /*-------------------------------------------------------------------*/ /* int size(int handle) */ /* returns size (used Entries) of Vector */ /*-------------------------------------------------------------------*/ d size PR 10i 0 EXTPROC('VECTOR_size') d handle 10i 0 /*-------------------------------------------------------------------*/ /* int VECTOR_getHandle() */ /* Constructor of Vector */ /* returns Handle (used as Pointer to instance) */ /*-------------------------------------------------------------------*/ d VECTOR_getHandle... d PR 10i 0 EXTPROC('VECTOR_getHandle') /*-------------------------------------------------------------------*/ /* void VECTOR_finalize(int handle) */ /* Destructor Vector */ /* frees all storage of this Vector, represented by handle */ /*-------------------------------------------------------------------*/ d VECTOR_finalize... d PR EXTPROC('VECTOR_finalize') d handle 10i 0 /*-------------------------------------------------------------------*/ /ENDIF