Mercurial > projects > dwt-addons
comparison dwtx/core/commands/common/HandleObjectManager.d @ 104:04b47443bb01
Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
These new wrappers now use the tango.util.containers instead of the tango.util.collections.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 07 Aug 2008 15:01:33 +0200 |
parents | 6518c18a01f7 |
children |
comparison
equal
deleted
inserted
replaced
103:2d6540440fe6 | 104:04b47443bb01 |
---|---|
14 module dwtx.core.commands.common.HandleObjectManager; | 14 module dwtx.core.commands.common.HandleObjectManager; |
15 | 15 |
16 import dwtx.core.commands.common.HandleObject; | 16 import dwtx.core.commands.common.HandleObject; |
17 import dwtx.core.commands.common.EventManager; | 17 import dwtx.core.commands.common.EventManager; |
18 import dwt.dwthelper.utils; | 18 import dwt.dwthelper.utils; |
19 import dwtx.dwtxhelper.Collection; | |
19 | 20 |
20 import tango.util.collection.HashSet; | |
21 import tango.util.collection.HashMap; | |
22 import tango.util.collection.model.Set; | |
23 import tango.util.collection.model.Map; | |
24 | 21 |
25 // import java.util.HashMap; | 22 // import java.util.HashMap; |
26 // import java.util.HashSet; | 23 // import java.util.HashSet; |
27 // import java.util.Iterator; | 24 // import java.util.Iterator; |
28 // import java.util.Map; | 25 // import java.util.Map; |
43 | 40 |
44 /** | 41 /** |
45 * The set of handle objects that are defined. This value may be empty, but | 42 * The set of handle objects that are defined. This value may be empty, but |
46 * it is never <code>null</code>. | 43 * it is never <code>null</code>. |
47 */ | 44 */ |
48 protected const Set!(Object) definedHandleObjects; | 45 protected const Set definedHandleObjects; |
49 | 46 |
50 /** | 47 /** |
51 * The map of identifiers (<code>String</code>) to handle objects ( | 48 * The map of identifiers (<code>String</code>) to handle objects ( |
52 * <code>HandleObject</code>). This collection may be empty, but it is | 49 * <code>HandleObject</code>). This collection may be empty, but it is |
53 * never <code>null</code>. | 50 * never <code>null</code>. |
54 */ | 51 */ |
55 protected const Map!( String, Object ) handleObjectsById; | 52 protected const Map handleObjectsById; |
56 | 53 |
57 public this(){ | 54 public this(){ |
58 definedHandleObjects = new HashSet!(Object)(); | 55 definedHandleObjects = new HashSet(); |
59 handleObjectsById = new HashMap!( String, Object )(); | 56 handleObjectsById = new HashMap(); |
60 } | 57 } |
61 | 58 |
62 /** | 59 /** |
63 * Verifies that the identifier is valid. Exceptions will be thrown if the | 60 * Verifies that the identifier is valid. Exceptions will be thrown if the |
64 * identifier is invalid in some way. | 61 * identifier is invalid in some way. |
82 * Returns the set of identifiers for those handle objects that are defined. | 79 * Returns the set of identifiers for those handle objects that are defined. |
83 * | 80 * |
84 * @return The set of defined handle object identifiers; this value may be | 81 * @return The set of defined handle object identifiers; this value may be |
85 * empty, but it is never <code>null</code>. | 82 * empty, but it is never <code>null</code>. |
86 */ | 83 */ |
87 protected final HashSet!(String) getDefinedHandleObjectIds() { | 84 protected final HashSet getDefinedHandleObjectIds() { |
88 HashSet!(String) definedHandleObjectIds = new HashSet!(String)(/+definedHandleObjects | 85 HashSet definedHandleObjectIds = new HashSet(definedHandleObjects |
89 .size()+/); | 86 .size()); |
90 foreach ( v; definedHandleObjects.elements() ) { | 87 Iterator handleObjectItr = definedHandleObjects.iterator(); |
91 auto handleObject = cast(HandleObject)v; | 88 while (handleObjectItr.hasNext()) { |
89 HandleObject handleObject = cast(HandleObject) handleObjectItr | |
90 .next(); | |
92 String id = handleObject.getId(); | 91 String id = handleObject.getId(); |
93 definedHandleObjectIds.add(id); | 92 definedHandleObjectIds.add(id); |
94 } | 93 } |
95 return definedHandleObjectIds; | 94 return definedHandleObjectIds; |
96 } | 95 } |