Discrete2d

Name

Discrete2d --  Root class of all 2d discrete spaces.

Description

A Discrete2d is basically a 2d array of ids. Subclasses add particular space semantics onto this. Currently Discrete2d grids are accessed by integer pairs of X and Y coordinates.

Protocols adopted by Discrete2d

SwarmObject GridData CREATABLE

Methods

Phase: Creating

Phase: Setting

Phase: Using

Examples

Example space/Discrete2d/1.

 Discrete2d instances can now serialize themselves (without needing
 additional classes such as Int2dFiler).

 The result of value (shallow) Lisp serialization of a 4x3 Discrete2d 
 consisting of long values might be:
 
 (list
   (cons 'myDiscrete2d
     (make-instance 'Discrete2d 
      #:xsize 4 #:ysize 3 #:lattice 
       (parse 
        #2((1000 1000 1000 1000)
           (1000 1000 1000 1000)
           (1000 1000 10 1000))))))

 For object (deep) Lisp serialization of the same 4x3 lattice with 
 identical instances of MyClass at each point (except at (2,2) which
 has an instance of MyClassOther) would look like:

 (list
   (cons 'myDiscrete2d
     (make-instance 'Discrete2d 
       #:xsize 4 #:ysize 3 #:lattice 
        (parse
        (cons '(0 . 0)
         (make-instance 'MyClass #:strVal "Hello World"))
        (cons '(0 . 1)
         (make-instance 'MyClass #:strVal "Hello World"))
        (cons '(0 . 2)
         (make-instance 'MyClass #:strVal "Hello World"))
        (cons '(1 . 0)
         (make-instance 'MyClass #:strVal "Hello World"))
        (cons '(1 . 1)
         (make-instance 'MyClass #:strVal "Hello World"))
        (cons '(1 . 2)
         (make-instance 'MyClass #:strVal "Hello World"))
        (cons '(2 . 0)
         (make-instance 'MyClass #:strVal "Hello World"))
        (cons '(2 . 1)
         (make-instance 'MyClass #:strVal "Hello World"))
        (cons '(2 . 2)
         (make-instance 'MyClassOther #:strVal "Other World"))
        (cons '(3 . 0)
         (make-instance 'MyClass #:strVal "Hello World"))
        (cons '(3 . 1)
         (make-instance 'MyClass #:strVal "Hello World"))
        (cons '(3 . 2)
         (make-instance 'MyClass #:strVal "Hello World"))))))

Rabisu Mirror Service We provide mirrors to support Open source communities. Our mirror server is located in Istanbul/Turkey region.

Please do not hesitate to contact mirror@rabisu.com for new open source mirror submissions.