Brick
|
A Brick is a vector of rows and each row is a collection of fields. Each row is identical to all other rows in the fields it contains.
(new Brick: rowCount FieldDeclaration ... FieldDeclaration)
Each brick field may store data of a different type and each field may repeat more than once (the field repetition is separate and distinct from the repetition of rows in the Brick). A brick field declaration contains three important elements:
Name:Type:Repeats
An example of a brick field declaration is as follows:
Distance:Number:20
A Brick is a collection of fields as in the following example:
(new Brick: 1
Address:Character:40
State:Character:20
Name:Character:40
City:Character:40
Salary:Number:1)
A picture of this Brick might appear as in the following example:
Address | 184 Anywhere St. |
State | California |
Name | John Doe |
City | Los Angeles |
Salary | $55000 |
The valid brick field type names are as follows:
Boolean
Character
CharPointer
Float
FloatPointer
Integer
IntPointer
JumpPointer
Long
LongPointer
Number
NumPointer
Object
Short
ShortPointer
Word
WordPointer
In Analytic Information Server, a single brick may grow up to 65564 characters in length, and there may be up to two billion rows.
The Brick object is very useful for storing heterogeneous values to be accessed by symbolic keys. Although Records can be used for many purposes, a common use is the creation of user defined data structures of complex design.
While the alternate data types exist (Structures, Dictionaries and object Dictionaries) that support access by key, the Brick data type, does not have the overhead of storing all data fields in the same format. Since Records have the property of being fast and having keyed access, a Brick may be more preferable than a Structure, Dictionary or Directory if it is vital if the data be maintained in different formats.
The Brick object type supports a constant template form. The whole Brick constant is enclosed in parentheses and preceded by the sharp symbol (#). The constant form of the example Brick is as follows:
#(brk| Address:Character:40 State:Character:20 Name:Character:40 City:Character:40 Salary:Number:1)
#(brk[2]| Address:Character:40 State:Character:20 Name:Character:40 City:Character:40 Salary:Number:1)
The Brick object can be created via the new function as follows:
(new Brick: Address:Character:40 State:Character:20 Name:Character:40 City:Character:40 Salary:Number:1)
(new Brick: 2 Address:Character:40 State:Character:20 Name:Character:40 City:Character:40 Salary:Number:1)
The Brick object can be referenced via the ref function, the dot operator, and the bracket [] operator, as follows:
(setq x (new Brick: 2 Address:Character:40 State:Character:20 Name:Character:40 City:Character:40 Salary:Number:10))
x.Salary
x[Salary:]
(ref x Salary:)
(ref x Salary:)
(ref x Salary: 6)
(ref x Salary: 6 0)
x[1]
x[1].Salary
x[1].Salary[3]
x[Salary: 6 1]
x[Salary: 6 1]
x[4 6 1]
The Brick is a Heap Object or an Object Data Type. The Analytic Information Server Object Types are stored in the Heap and are managed by the Heap manager. The Analytic Information Server Heap manager supports object resizing, garbage collection, and anti-fragmentation algorithms so that the user may concentrate on the analysis and modeling of data rather than on memory management. Without exception, all of the Object types are identified by an object id. The object id identifies a block of memory, managed by the Lambda Information Server memory manager, in which the Object's data is stored.
The Analytic Information Server Heap Object and Native Data types can be saved and loaded to and from persistent (disk file) storage at any time. Containers with immediate data are saved on disk in fixed length records equal to the size of the container. Containers with Heap object references are saved in fixed length records, which are automatically expanded to include the contents of the Heap object, and any objects referenced by the Heap object, etc. This feature is called Object Closure Management and is automatic with every Analytic Information Server container database save.
Analytic Information Server containers may be loaded from any database repository record at any time. If the data in the record is immediate, the database load fills the container with the immediate data. If the data in the record is an object closure, the database load fills the container with a Heap object reference, and all of the objects in the record are loaded back into the Heap with the same referential relationships they had when they were saved in the repository.
The Brick object can be demonstrated by the following examples.