Prev Up Next Index
Go backward to 1.2.3 Vector Types: Array, List
Go up to 1.2 The Type Hierarchy
Go forward to 2 Managing Connections

1.2.4 Compound Types: Structure, Sequence, Function, Grid

The compound data types are used to build new types as aggregates of other types, including other compound types. (Note that List and Array are compound types, as well, but contain only a single type of data.) Structure, Sequence and Function all contain a list of BaseType objects. However, they have different semantics; a Structure is a simple aggregate; nothing other than aggregation is implied, while Sequence and Function define templates for relational objects. A Grid combines several Array objects so that nonlinear values may be applied to the indices of an array.

 

Structure
A Structure is an ordered collection of variables that conveys no relational information other than grouping. The variables that are members of a Structure may be of different types. In addition to the (possible) benefit of added organization, Structure may be used to supply information to the system that may be useful in optimizing the access or translation operations.

 

Sequence
A Sequence is similar to a Structure in that it consists of an ordered collection of variables which may be of different types. However, where an instance of a Structure object describes a single set of data variables, an instance of a Sequence object describes a set of data variables, each of which is an entry in an ordered series of similar data variables.

Consider a Sequence named S, where each instance is called s:

s_0 0 s_0 1 . s_0 n
s_1 0 s_1 1 . s_0 n
. . . .
s_i 0 s_i 1 . s_i n
. . .

Every instance s_i of S has the same number, order, and class of variables. A Sequence implies that each of the n variables is related to each other in some logical way. Because a Sequence has several values for each of its variables it has an implied state, or position in the sequence, in addition to the instance data values.

Table of relational data.
 

Name Age Weight
James 32 165
Charlie 7 65.4
Bob 10 80

For example given the the information in Table 1.2.4, s_0 is James, 32, 165, s_1 is Charlie, 7, 65.4, .... The data in the table might have the following Sequence declaration:

Sequence {
    Str name;
    Int32 age;
    Float64 weight;
} people;

 

Grid
A Grid is an association of an N dimensional Array with N named vectors (map vectors), each of which has the same number of elements as the corresponding dimension of the Array. Each vector is used to map indices of one of the Array's dimensions to a set of values which are normally non-integral (e.g., floating point values). Two map vectors may be members of different classes.

 

Grid =

32.0 31.5 31.1 30.8 29.2
32.3 31.8 31.4 30.9 29.8
32.9 32.3 31.8 29.7 30.2
32.3 31.8 31.5 30.7 29.9


M =
1.2 1.4 1.8 3.9 4.5


N =
67.8 68.7 92.3 95.2

A sample Grid.

In figure 1.2.4, the grid element indicated by Grid[2][3] corresponds to N[2] and M[3], or N = 92.3 and M = 3.9 respectively. The element has a value of 29.7.


Tom Sgouros, July 2, 2004

Prev Up Next