Package NetworkEditor :: Module datatypes :: Class AnyArrayType
[hide private]
[frames] | no frames]

Class AnyArrayType

source code

object --+    
         |    
      dict --+
             |
            AnyArrayType
Known Subclasses:
BooleanType, FloatType, IntType, StringType

Base class for defining types of Ports which can handle single values
or arrays of arbitrary shape.

this class must be herited only !!!! get inspired by class IntType below

the construcor arguments are:

    name: string used to identify an instance of a AnyArrayType object
          ex: float
          
          you can add the datashape to the name
          ex: float(0,>=3,4,0)' 
          
Multi dimensional arrays can be specified by passing 
a datashape in parenthesis in the form of a string of comma separated 
expressions.  The number of expressions is the number of dimensions. 
Valid expressions are :
    0  : meaning there is no condition on this dimension.
        (in addition, the leading 0 dimensions are optional)
    x  : length of this dimension must be  x
    >x : length of this dimension must be > x
    <x : length of this dimension must be < x 
    >=x: length of this dimension must be >= x 
    <=x: length of this dimension must be <= x 

for instance a list of vertices can be represented by float(0,3)
    float: describe the smalest elementary datum (one coordinate).
           you can introduce your own elementary type 
           (generaly inheriting basic types), this allow you to easily
           define color and shape for this type (see InstancematType below)
           
    3: because there are 3 coordinates per vertex.
    0: because we don't have any limitation on the number of vertices.
       It is a leading 0, therefore this dimension is optionnal
       (meaning: if you're passing a single vertex [x,y,z], 
       your are not oblige to put it in a list. 
       ex: you can give [x,y,z] or [[x,y,z]])
       



Instance Methods [hide private]
  __init__(self, name='None', datashape=None, klass=None, dataDescr=None, color=None, shape='diamond', width=None, height=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
  validateDims(self, data)
data comes in as a numeric array, and returns True if required shapes pass tests, returns False is tests fail, or returns number of missing dimensions if test pass but optional dims are missing
  _shape(self, datashape)
This function is called by the constructor to return the number of edges used to draw the port icon based on the number of dimensions of the type.
  cast(self, data)
  validate(self, data)

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __hash__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, __setitem__, clear, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values

Inherited from object: __delattr__, __reduce__, __reduce_ex__, __setattr__, __str__


Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, name='None', datashape=None, klass=None, dataDescr=None, color=None, shape='diamond', width=None, height=None)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: dict.__init__
(inherited documentation)

validateDims(self, data)

source code 
data comes in as a numeric array, and returns True if required shapes pass tests, returns False is tests fail, or returns number of missing dimensions if test pass but optional dims are missing

_shape(self, datashape)

source code 
This function is called by the constructor to return the number of edges used to draw the port icon based on the number of dimensions of the type. NOTE: this function is only used if the icon shape is not specified as an argument to the constructor.

cast(self, data)

source code 
None

validate(self, data)

source code 
None