view m-toolbox/html_help/help/ug/collection_objects_content.html @ 4:e3c5468b1bfe database-connection-manager

Integrate with LTPDAPreferences
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

<p>
  Collection objects serve as merely a wrapper for a cell-array of LTPDA User Objects. The point of this is to provide 
  a way to put together user objects of different classes in to a collection which can be saved/loaded/submitted/retrieved, etc.
</p>
<p>
  You can create a <tt>collection</tt> object like:
  <div class="fragment"><pre>
      >> c = collection
      ---- collection 1 ----
      name: none
      num objs: 0
      description: 
      UUID: a339a156-956b-4657-96ef-9ea4feef8101
      ----------------------
      
  </pre></div>
  You can then add objects to the collection by doing:
  <div class="fragment"><pre>
      >> c.addObjects(ao(1))
      M: running ao/ao
      M:   constructing from values
      M: running collection/addObjects
      M: running ao/char
      ---- collection 1 ----
      name: none
      num objs: 1
      01: ao | None/cdata(Ndata=[1x1])
      description: 
      UUID: c1f0200f-ad98-4fd6-beae-2dcdabb33515
      ----------------------
      
  </pre></div>
  or
  <div class="fragment"><pre>
      >> c.addObjects(pzmodel(1, 10, 100), mfir())
      M: running collection/addObjects
      M: running ao/char
      ---- collection 1 ----
      name: none
      num objs: 3
      01: ao | None/cdata(Ndata=[1x1])
      02: pzmodel | pzmodel(None)
      03: mfir | none(fs=, ntaps=0.00, a=[])
      description: 
      UUID: e7f02380-5650-4788-b819-f7fa7ee50a7d
      ----------------------
      
  </pre></div>
</p>
<p>
  You can then extract objects from the collection using <tt>getObjectAtIndex</tt> or get an array of all 
  objects of a particular class using <tt>getObjectsOfClass</tt>. Objects can be removed from the collection using
  <tt>removeObjectAtIndex</tt>.
</p>
<p>
  Since a <tt>collection</tt> object is an LTPDA User Object, it has history tracking capabilities. That means that everytime you
  add or remove an object to/from the collection, a history step is added. For example, the history of our collection above looks like:
  <img src="images/collection_history.png" alt="Collection history" border="3">
</p>