0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 <p>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 Collection objects serve as merely a wrapper for a cell-array of LTPDA User Objects. The point of this is to provide
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 a way to put together user objects of different classes in to a collection which can be saved/loaded/submitted/retrieved, etc.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 </p>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 <p>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 You can create a <tt>collection</tt> object like:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 <div class="fragment"><pre>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 >> c = collection
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 ---- collection 1 ----
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 name: none
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 num objs: 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 description:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 UUID: a339a156-956b-4657-96ef-9ea4feef8101
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 ----------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 </pre></div>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 You can then add objects to the collection by doing:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 <div class="fragment"><pre>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 >> c.addObjects(ao(1))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 M: running ao/ao
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 M: constructing from values
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 M: running collection/addObjects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 M: running ao/char
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 ---- collection 1 ----
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 name: none
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 num objs: 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 01: ao | None/cdata(Ndata=[1x1])
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 description:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 UUID: c1f0200f-ad98-4fd6-beae-2dcdabb33515
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 ----------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 </pre></div>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 or
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 <div class="fragment"><pre>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 >> c.addObjects(pzmodel(1, 10, 100), mfir())
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 M: running collection/addObjects
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 M: running ao/char
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 ---- collection 1 ----
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 name: none
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 num objs: 3
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 01: ao | None/cdata(Ndata=[1x1])
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 02: pzmodel | pzmodel(None)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 03: mfir | none(fs=, ntaps=0.00, a=[])
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 description:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 UUID: e7f02380-5650-4788-b819-f7fa7ee50a7d
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 ----------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 </pre></div>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 </p>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 <p>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 You can then extract objects from the collection using <tt>getObjectAtIndex</tt> or get an array of all
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 objects of a particular class using <tt>getObjectsOfClass</tt>. Objects can be removed from the collection using
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 <tt>removeObjectAtIndex</tt>.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 </p>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 <p>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 Since a <tt>collection</tt> object is an LTPDA User Object, it has history tracking capabilities. That means that everytime you
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 add or remove an object to/from the collection, a history step is added. For example, the history of our collection above looks like:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 <img src="images/collection_history.png" alt="Collection history" border="3">
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 </p> |