/Frameworks/Foundation/objj.platform/CPSet.j

http://github.com/jfahrenkrug/MapKit-HelloWorld · Unknown · 259 lines · 259 code · 0 blank · 0 comment · 0 complexity · 2593eb4b150c3ed2eab5b291f76808fa MD5 · raw file

  1. i;10;CPObject.ji;9;CPArray.ji;10;CPNumber.ji;14;CPEnumerator.jc;7585;
  2. var _1=objj_allocateClassPair(CPObject,"CPSet"),_2=_1.isa;
  3. class_addIvars(_1,[new objj_ivar("_contents"),new objj_ivar("_count")]);
  4. objj_registerClassPair(_1);
  5. objj_addClassForBundle(_1,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  6. class_addMethods(_1,[new objj_method(sel_getUid("init"),function(_3,_4){
  7. with(_3){
  8. if(_3=objj_msgSendSuper({receiver:_3,super_class:objj_getClass("CPObject")},"init")){
  9. _count=0;
  10. _contents={};
  11. }
  12. return _3;
  13. }
  14. }),new objj_method(sel_getUid("initWithArray:"),function(_5,_6,_7){
  15. with(_5){
  16. if(_5=objj_msgSend(_5,"init")){
  17. var _8=_7.length;
  18. while(_8--){
  19. objj_msgSend(_5,"addObject:",_7[_8]);
  20. }
  21. }
  22. return _5;
  23. }
  24. }),new objj_method(sel_getUid("initWithObjects:count:"),function(_9,_a,_b,_c){
  25. with(_9){
  26. return objj_msgSend(_9,"initWithArray:",_b.splice(0,_c));
  27. }
  28. }),new objj_method(sel_getUid("initWithObjects:"),function(_d,_e,_f){
  29. with(_d){
  30. if(_d=objj_msgSend(_d,"init")){
  31. var _10=arguments.length,i=2;
  32. for(;i<_10&&(argument=arguments[i])!=nil;++i){
  33. objj_msgSend(_d,"addObject:",argument);
  34. }
  35. }
  36. return _d;
  37. }
  38. }),new objj_method(sel_getUid("initWithSet:"),function(_12,_13,_14){
  39. with(_12){
  40. return objj_msgSend(_12,"initWithSet:copyItems:",_14,NO);
  41. }
  42. }),new objj_method(sel_getUid("initWithSet:copyItems:"),function(_15,_16,_17,_18){
  43. with(_15){
  44. _15=objj_msgSend(_15,"init");
  45. if(!_17){
  46. return _15;
  47. }
  48. var _19=_17._contents;
  49. for(var _1a in _19){
  50. if(_19.hasOwnProperty(_1a)){
  51. if(_18){
  52. objj_msgSend(_15,"addObject:",objj_msgSend(_19[_1a],"copy"));
  53. }else{
  54. objj_msgSend(_15,"addObject:",_19[_1a]);
  55. }
  56. }
  57. }
  58. return _15;
  59. }
  60. }),new objj_method(sel_getUid("allObjects"),function(_1b,_1c){
  61. with(_1b){
  62. var _1d=[];
  63. for(var _1e in _contents){
  64. if(_contents.hasOwnProperty(_1e)){
  65. _1d.push(_contents[_1e]);
  66. }
  67. }
  68. return _1d;
  69. }
  70. }),new objj_method(sel_getUid("anyObject"),function(_1f,_20){
  71. with(_1f){
  72. for(var _21 in _contents){
  73. if(_contents.hasOwnProperty(_21)){
  74. return _contents[_21];
  75. }
  76. }
  77. return nil;
  78. }
  79. }),new objj_method(sel_getUid("containsObject:"),function(_22,_23,_24){
  80. with(_22){
  81. if(_contents[objj_msgSend(_24,"hash")]&&objj_msgSend(_contents[objj_msgSend(_24,"hash")],"isEqual:",_24)){
  82. return YES;
  83. }
  84. return NO;
  85. }
  86. }),new objj_method(sel_getUid("count"),function(_25,_26){
  87. with(_25){
  88. return _count;
  89. }
  90. }),new objj_method(sel_getUid("intersectsSet:"),function(_27,_28,set){
  91. with(_27){
  92. var _2a=objj_msgSend(set,"allObjects");
  93. for(var i=_2a.length;i>0;i--){
  94. if(objj_msgSend(_27,"containsObject:",_2a[i])){
  95. return YES;
  96. }
  97. }
  98. return NO;
  99. }
  100. }),new objj_method(sel_getUid("isEqualToSet:"),function(_2c,_2d,set){
  101. with(_2c){
  102. return _2c===set||(objj_msgSend(_2c,"count")===objj_msgSend(set,"count")&&objj_msgSend(set,"isSubsetOfSet:",_2c));
  103. }
  104. }),new objj_method(sel_getUid("isSubsetOfSet:"),function(_2f,_30,set){
  105. with(_2f){
  106. var _32=objj_msgSend(_2f,"allObjects");
  107. for(var i=0;i<_32.length;i++){
  108. if(!objj_msgSend(set,"containsObject:",_32[i])){
  109. return NO;
  110. }
  111. }
  112. return YES;
  113. }
  114. }),new objj_method(sel_getUid("makeObjectsPerformSelector:"),function(_34,_35,_36){
  115. with(_34){
  116. objj_msgSend(_34,"makeObjectsPerformSelector:withObject:",_36,nil);
  117. }
  118. }),new objj_method(sel_getUid("makeObjectsPerformSelector:withObject:"),function(_37,_38,_39,_3a){
  119. with(_37){
  120. var _3b=objj_msgSend(_37,"allObjects");
  121. for(var i=0;i<_3b.length;i++){
  122. objj_msgSend(_3b[i],"performSelector:withObject:",_39,_3a);
  123. }
  124. }
  125. }),new objj_method(sel_getUid("member:"),function(_3d,_3e,_3f){
  126. with(_3d){
  127. if(objj_msgSend(_3d,"containsObject:",_3f)){
  128. return _3f;
  129. }
  130. return nil;
  131. }
  132. }),new objj_method(sel_getUid("objectEnumerator"),function(_40,_41){
  133. with(_40){
  134. return objj_msgSend(objj_msgSend(_40,"allObjects"),"objectEnumerator");
  135. }
  136. }),new objj_method(sel_getUid("initWithCapacity:"),function(_42,_43,_44){
  137. with(_42){
  138. _42=objj_msgSend(_42,"init");
  139. return _42;
  140. }
  141. }),new objj_method(sel_getUid("setSet:"),function(_45,_46,set){
  142. with(_45){
  143. objj_msgSend(_45,"removeAllObjects");
  144. objj_msgSend(_45,"addObjectsFromArray:",objj_msgSend(set,"allObjects"));
  145. }
  146. }),new objj_method(sel_getUid("addObject:"),function(_48,_49,_4a){
  147. with(_48){
  148. _contents[objj_msgSend(_4a,"hash")]=_4a;
  149. _count++;
  150. }
  151. }),new objj_method(sel_getUid("addObjectsFromArray:"),function(_4b,_4c,_4d){
  152. with(_4b){
  153. for(var i=0,_4f=_4d.length;i<_4f;i++){
  154. objj_msgSend(_4b,"addObject:",_4d[i]);
  155. }
  156. }
  157. }),new objj_method(sel_getUid("removeObject:"),function(_50,_51,_52){
  158. with(_50){
  159. if(objj_msgSend(_50,"containsObject:",_52)){
  160. delete _contents[objj_msgSend(_52,"hash")];
  161. _count--;
  162. }
  163. }
  164. }),new objj_method(sel_getUid("removeAllObjects"),function(_53,_54){
  165. with(_53){
  166. _contents={};
  167. _count=0;
  168. }
  169. }),new objj_method(sel_getUid("intersectSet:"),function(_55,_56,set){
  170. with(_55){
  171. var _58=objj_msgSend(_55,"allObjects");
  172. for(var i=0,_5a=_58.length;i<_5a;i++){
  173. if(!objj_msgSend(set,"containsObject:",_58[i])){
  174. objj_msgSend(_55,"removeObject:",_58[i]);
  175. }
  176. }
  177. }
  178. }),new objj_method(sel_getUid("minusSet:"),function(_5b,_5c,set){
  179. with(_5b){
  180. var _5e=objj_msgSend(set,"allObjects");
  181. for(var i=0;i<_5e.length;i++){
  182. if(objj_msgSend(_5b,"containsObject:",_5e[i])){
  183. objj_msgSend(_5b,"removeObject:",_5e[i]);
  184. }
  185. }
  186. }
  187. }),new objj_method(sel_getUid("unionSet:"),function(_60,_61,set){
  188. with(_60){
  189. var _63=objj_msgSend(set,"allObjects");
  190. for(var i=0,_65=_63.length;i<_65;i++){
  191. objj_msgSend(_60,"addObject:",_63[i]);
  192. }
  193. }
  194. })]);
  195. class_addMethods(_2,[new objj_method(sel_getUid("set"),function(_66,_67){
  196. with(_66){
  197. return objj_msgSend(objj_msgSend(_66,"alloc"),"init");
  198. }
  199. }),new objj_method(sel_getUid("setWithArray:"),function(_68,_69,_6a){
  200. with(_68){
  201. return objj_msgSend(objj_msgSend(_68,"alloc"),"initWithArray:",_6a);
  202. }
  203. }),new objj_method(sel_getUid("setWithObject:"),function(_6b,_6c,_6d){
  204. with(_6b){
  205. return objj_msgSend(objj_msgSend(_6b,"alloc"),"initWithArray:",[_6d]);
  206. }
  207. }),new objj_method(sel_getUid("setWithObjects:count:"),function(_6e,_6f,_70,_71){
  208. with(_6e){
  209. return objj_msgSend(objj_msgSend(_6e,"alloc"),"initWithObjects:count:",_70,_71);
  210. }
  211. }),new objj_method(sel_getUid("setWithObjects:"),function(_72,_73,_74){
  212. with(_72){
  213. var set=objj_msgSend(objj_msgSend(_72,"alloc"),"init"),_76=arguments.length,i=2;
  214. for(;i<_76&&((argument=arguments[i])!==nil);++i){
  215. objj_msgSend(set,"addObject:",argument);
  216. }
  217. return set;
  218. }
  219. }),new objj_method(sel_getUid("setWithSet:"),function(_78,_79,set){
  220. with(_78){
  221. return objj_msgSend(objj_msgSend(_78,"alloc"),"initWithSet:",set);
  222. }
  223. }),new objj_method(sel_getUid("setWithCapacity:"),function(_7b,_7c,_7d){
  224. with(_7b){
  225. return objj_msgSend(objj_msgSend(_7b,"alloc"),"initWithCapacity:",_7d);
  226. }
  227. })]);
  228. var _1=objj_getClass("CPSet");
  229. if(!_1){
  230. objj_exception_throw(new objj_exception(OBJJClassNotFoundException,"*** Could not find definition for class \"CPSet\""));
  231. }
  232. var _2=_1.isa;
  233. class_addMethods(_1,[new objj_method(sel_getUid("copy"),function(_7e,_7f){
  234. with(_7e){
  235. return objj_msgSend(objj_msgSend(CPSet,"alloc"),"initWithSet:",_7e);
  236. }
  237. }),new objj_method(sel_getUid("mutableCopy"),function(_80,_81){
  238. with(_80){
  239. return objj_msgSend(_80,"copy");
  240. }
  241. })]);
  242. var _82="CPSetObjectsKey";
  243. var _1=objj_getClass("CPSet");
  244. if(!_1){
  245. objj_exception_throw(new objj_exception(OBJJClassNotFoundException,"*** Could not find definition for class \"CPSet\""));
  246. }
  247. var _2=_1.isa;
  248. class_addMethods(_1,[new objj_method(sel_getUid("initWithCoder:"),function(_83,_84,_85){
  249. with(_83){
  250. return objj_msgSend(_83,"initWithArray:",objj_msgSend(_85,"decodeObjectForKey:",_82));
  251. }
  252. }),new objj_method(sel_getUid("encodeWithCoder:"),function(_86,_87,_88){
  253. with(_86){
  254. objj_msgSend(_88,"encodeObject:forKey:",objj_msgSend(_86,"allObjects"),_82);
  255. }
  256. })]);
  257. var _1=objj_allocateClassPair(CPSet,"CPMutableSet"),_2=_1.isa;
  258. objj_registerClassPair(_1);
  259. objj_addClassForBundle(_1,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));