Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
QueueLoadingStatus |
|
| 0.0;0 |
1 | /* | |
2 | * Licensed under the MIT License | |
3 | * | |
4 | * Copyright 2011 (c) Flávio Silva, flsilva.com | |
5 | * | |
6 | * Permission is hereby granted, free of charge, to any person | |
7 | * obtaining a copy of this software and associated documentation | |
8 | * files (the "Software"), to deal in the Software without | |
9 | * restriction, including without limitation the rights to use, | |
10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell | |
11 | * copies of the Software, and to permit persons to whom the | |
12 | * Software is furnished to do so, subject to the following | |
13 | * conditions: | |
14 | * | |
15 | * The above copyright notice and this permission notice shall be | |
16 | * included in all copies or substantial portions of the Software. | |
17 | * | |
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | |
20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |
23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
25 | * OTHER DEALINGS IN THE SOFTWARE. | |
26 | * | |
27 | * http://www.opensource.org/licenses/mit-license.php | |
28 | */ | |
29 | 1 | package org.vostokframework.domain.loading.states.queueloader |
30 | { | |
31 | import org.as3collections.IList; | |
32 | import org.as3collections.IMap; | |
33 | import org.as3collections.IQueue; | |
34 | import org.as3collections.lists.ArrayList; | |
35 | import org.as3collections.maps.HashMap; | |
36 | import org.as3collections.maps.TypedMap; | |
37 | import org.as3collections.queues.PriorityIndexQueue; | |
38 | import org.as3collections.utils.ListUtil; | |
39 | import org.as3collections.utils.QueueUtil; | |
40 | import org.vostokframework.domain.loading.ILoader; | |
41 | ||
42 | /** | |
43 | * description | |
44 | * | |
45 | * @author Flávio Silva | |
46 | */ | |
47 | public class QueueLoadingStatus | |
48 | { | |
49 | ||
50 | /** | |
51 | * @private | |
52 | */ | |
53 | private var _allLoaders:IMap; | |
54 | private var _completeLoaders:IList; | |
55 | //private var _disposed:Boolean; | |
56 | private var _failedLoaders:IList; | |
57 | private var _loadingLoaders:IList; | |
58 | private var _queuedLoaders:IQueue; | |
59 | private var _stoppedLoaders:IList; | |
60 | ||
61 | public function get allLoaders():IMap { return _allLoaders; } | |
62 | ||
63 | public function get completeLoaders():IList { return _completeLoaders; } | |
64 | ||
65 | public function get failedLoaders():IList { return _failedLoaders; } | |
66 | ||
67 | public function get loadingLoaders():IList { return _loadingLoaders; } | |
68 | ||
69 | public function get queuedLoaders():IQueue { return _queuedLoaders; } | |
70 | ||
71 | public function get stoppedLoaders():IList { return _stoppedLoaders; } | |
72 | ||
73 | /** | |
74 | * description | |
75 | * | |
76 | * @param name | |
77 | * @param ordinal | |
78 | */ | |
79 | public function QueueLoadingStatus() | |
80 | 1 | { |
81 | // IMap<String, ILoader> | |
82 | // VostokIdentification().toString() used for performance optimization | |
83 | 1 | _allLoaders = new TypedMap(new HashMap(null, true), String, ILoader); |
84 | ||
85 | 1 | _completeLoaders = ListUtil.getUniqueTypedList(new ArrayList(), ILoader); |
86 | 1 | _failedLoaders = ListUtil.getUniqueTypedList(new ArrayList(), ILoader); |
87 | 1 | _loadingLoaders = ListUtil.getUniqueTypedList(new ArrayList(), ILoader); |
88 | 1 | _queuedLoaders = QueueUtil.getUniqueTypedQueue(new PriorityIndexQueue(), ILoader); |
89 | 1 | _stoppedLoaders = ListUtil.getUniqueTypedList(new ArrayList(), ILoader); |
90 | 1 | } |
91 | /* | |
92 | public function clone():* | |
93 | { | |
94 | var clone:QueueLoadingStatus = new QueueLoadingStatus(); | |
95 | clone.allLoaders.putAll(_allLoaders); | |
96 | clone.completeLoaders.addAll(_completeLoaders); | |
97 | clone.failedLoaders.addAll(_failedLoaders); | |
98 | clone.loadingLoaders.addAll(_loadingLoaders); | |
99 | clone.queuedLoaders.addAll(_queuedLoaders); | |
100 | clone.stoppedLoaders.addAll(stoppedLoaders); | |
101 | | |
102 | return clone; | |
103 | } | |
104 | | |
105 | public function dispose():void | |
106 | { | |
107 | if (_disposed) return; | |
108 | | |
109 | _allLoaders.clear(); | |
110 | _completeLoaders.clear(); | |
111 | _failedLoaders.clear(); | |
112 | _loadingLoaders.clear(); | |
113 | _queuedLoaders.clear(); | |
114 | _stoppedLoaders.clear(); | |
115 | | |
116 | _disposed = true; | |
117 | _allLoaders = null; | |
118 | _completeLoaders = null; | |
119 | _failedLoaders = null; | |
120 | _loadingLoaders = null; | |
121 | _queuedLoaders = null; | |
122 | _stoppedLoaders = null; | |
123 | } | |
124 | */ | |
125 | } | |
126 | ||
127 | } |