MarksStoreArray class: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
The <var>MarksStoreArray</var> class was written for [http://en.wikipedia.org/wiki/Marks_%26_Spencer Marks and Spencer] a UK retailer. The index for <var>MarksStoreArray</var> items is a a three-digit Marks and Spencer store code so is not likely to be useful to anyone other than Marks and Spencer. | The <var>MarksStoreArray</var> class was written for [http://en.wikipedia.org/wiki/Marks_%26_Spencer Marks and Spencer] a UK retailer. The index for <var>MarksStoreArray</var> items is a a three-digit Marks and Spencer store code so is not likely to be useful to anyone other than Marks and Spencer. | ||
The <var>MarksStoreArray</var> class is a limited collection class — the declaration of a <var>MarksStoreArray</var> variable requires an <var>Of</var> clause follow by a datatype, where the datatype can only be a <var>String</var>, <var>Float</var>, or <var>Fixed</var> datatype. As such, it is considerably less useful than the [[NamedArraylist class]]. It's main advantage over <var>NamedArraylists</var> is that all collection items are stored in STBL so that the access path for a <var>MarksStoreArray</var> object is very efficient, indeed, and so can be useful in situations where there is heavy access to lots of different string or numeric values, based on frequently changing store codes. | The <var>MarksStoreArray</var> class is a limited collection class — the declaration of a <var>MarksStoreArray</var> variable requires an <var>Of</var> clause follow by a datatype, where the datatype can only be a <var>String</var>, <var>Float</var>, or <var>Fixed</var> datatype. As such, it is considerably less useful than the [[NamedArraylist class]]. It's main advantage over <var>NamedArraylists</var> is that all collection items are stored in STBL so that the access path for a <var>MarksStoreArray</var> object is very efficient, indeed, and so can be useful in situations where there is heavy access to lots of different string or numeric values, based on frequently changing store codes. | ||
However, if the items in a collection are, themselves, objects the <var>MarksStoreArray</var> cannot be used and, instead, a <var>NamedArrayList</var> should be used, with the store codes as the "names" (index values). | |||
===Example=== | ===Example=== | ||
The following example sets the value of an item associated with store code <code>ABC</code> to 22: | The following example sets the value of an item associated with store code <code>ABC</code> to 22: |
Revision as of 16:04, 4 February 2011
The MarksStoreArray class was written for Marks and Spencer a UK retailer. The index for MarksStoreArray items is a a three-digit Marks and Spencer store code so is not likely to be useful to anyone other than Marks and Spencer.
The MarksStoreArray class is a limited collection class — the declaration of a MarksStoreArray variable requires an Of clause follow by a datatype, where the datatype can only be a String, Float, or Fixed datatype. As such, it is considerably less useful than the NamedArraylist class. It's main advantage over NamedArraylists is that all collection items are stored in STBL so that the access path for a MarksStoreArray object is very efficient, indeed, and so can be useful in situations where there is heavy access to lots of different string or numeric values, based on frequently changing store codes.
However, if the items in a collection are, themselves, objects the MarksStoreArray cannot be used and, instead, a NamedArrayList should be used, with the store codes as the "names" (index values).
Example
The following example sets the value of an item associated with store code ABC
to 22:
begin %quantity is collection marksStoreArray of float %quantity = new %quantity('ABC') = 22 end