next up previous contents
Next: 3.2.3 Multi-Dimensional Arrays (m Up: 3.2 How to Process Previous: 3.2.1 Vertical Arrays (m   Contents


3.2.2 Horizontal Arrays (1 x n)

A horizontal array is simply an array that is 1 value deep and N values wide. N can be defined in the FSML code or can be read from the input file. In the example below, a loop reads the six values of the engnames array and then another loop reads the six values of the engyears array. The second loop also includes a Separator element so that the integer values for engyears are widely spaced for easier viewing (this could also be accomplished by one String element that was four blank spaces long).

Snippet from the Input Deck

! Engineers
Koundouriotis Li MacDonald Passche Smith Takata
1             3  2         16      4     2

Snippet from the FSML File

<FileData>
  <Array name="engnames" description="Names of Engineering Staff"
         ndims="1" dim="6" baseType="String"/>
  <Array name="engyears" description="Years of Service"
         ndims="1" dim="6" baseType="Integer"/>
</FileData>
 
<FileStructure>
  <StaticText>! Engineers</StaticText>
  <Record ignoreOnRead="false"/>
    <Loop start="1" end="6" incr="1">
      <AddValue target="engnames"/>
    </Loop>
  </Record>
  <Record ignoreOnRead="false"/>
    <Loop start="1" end="6" incr="1">
      <AddValue target="engyears"/>
    <Separator ignoreOnRead="true" string=" " repeat="4"/>
    </Loop>
  </Record>
</FileStructure>


next up previous contents
Next: 3.2.3 Multi-Dimensional Arrays (m Up: 3.2 How to Process Previous: 3.2.1 Vertical Arrays (m   Contents

SAIC Ship Technology Division, Annapolis, Maryland, USA
2004-10-26