1 package org.python.modules.sets; 2 3 import org.python.core.Py; 4 import org.python.core.PyException; 5 import org.python.core.PyObject; 6 import org.python.core.PyType; 7 import org.python.core.PyBuiltinFunctionNarrow; 8 import org.python.core.PyBuiltinFunction; 9 import org.python.core.PyMethodDescr; 10 import org.python.core.PyString; 11 import org.python.core.PyBuiltinFunctionWide; 12 import org.python.core.PyNewWrapper; 13 14 import java.util.Iterator ; 15 16 public class PySet extends BaseSet { 17 18 public PySet() { 19 super(); 20 } 21 22 public PySet(PyType type) { 23 super(type); 24 } 25 26 public PySet(PyObject data) { 27 super(data); 28 29 } 30 31 32 33 public static final String exposed_name="Set"; 34 35 public static final Class exposed_base=PyObject.class; 36 37 public static void typeSetup(PyObject dict,PyType.Newstyle marker) { 38 class exposed___ne__ extends PyBuiltinFunctionNarrow { 39 40 private PySet self; 41 42 public PyObject getSelf() { 43 return self; 44 } 45 46 exposed___ne__(PySet self,PyBuiltinFunction.Info info) { 47 super(info); 48 this.self=self; 49 } 50 51 public PyBuiltinFunction makeBound(PyObject self) { 52 return new exposed___ne__((PySet)self,info); 53 } 54 55 public PyObject __call__(PyObject arg0) { 56 PyObject ret=self.baseset___ne__(arg0); 57 if (ret==null) 58 return Py.NotImplemented; 59 return ret; 60 } 61 62 public PyObject inst_call(PyObject gself,PyObject arg0) { 63 PySet self=(PySet)gself; 64 PyObject ret=self.baseset___ne__(arg0); 65 if (ret==null) 66 return Py.NotImplemented; 67 return ret; 68 } 69 70 } 71 dict.__setitem__("__ne__",new PyMethodDescr("__ne__",PySet.class,1,1,new exposed___ne__(null,null))); 72 class exposed___eq__ extends PyBuiltinFunctionNarrow { 73 74 private PySet self; 75 76 public PyObject getSelf() { 77 return self; 78 } 79 80 exposed___eq__(PySet self,PyBuiltinFunction.Info info) { 81 super(info); 82 this.self=self; 83 } 84 85 public PyBuiltinFunction makeBound(PyObject self) { 86 return new exposed___eq__((PySet)self,info); 87 } 88 89 public PyObject __call__(PyObject arg0) { 90 PyObject ret=self.baseset___eq__(arg0); 91 if (ret==null) 92 return Py.NotImplemented; 93 return ret; 94 } 95 96 public PyObject inst_call(PyObject gself,PyObject arg0) { 97 PySet self=(PySet)gself; 98 PyObject ret=self.baseset___eq__(arg0); 99 if (ret==null) 100 return Py.NotImplemented; 101 return ret; 102 } 103 104 } 105 dict.__setitem__("__eq__",new PyMethodDescr("__eq__",PySet.class,1,1,new exposed___eq__(null,null))); 106 class exposed___or__ extends PyBuiltinFunctionNarrow { 107 108 private PySet self; 109 110 public PyObject getSelf() { 111 return self; 112 } 113 114 exposed___or__(PySet self,PyBuiltinFunction.Info info) { 115 super(info); 116 this.self=self; 117 } 118 119 public PyBuiltinFunction makeBound(PyObject self) { 120 return new exposed___or__((PySet)self,info); 121 } 122 123 public PyObject __call__(PyObject arg0) { 124 PyObject ret=self.baseset___or__(arg0); 125 if (ret==null) 126 return Py.NotImplemented; 127 return ret; 128 } 129 130 public PyObject inst_call(PyObject gself,PyObject arg0) { 131 PySet self=(PySet)gself; 132 PyObject ret=self.baseset___or__(arg0); 133 if (ret==null) 134 return Py.NotImplemented; 135 return ret; 136 } 137 138 } 139 dict.__setitem__("__or__",new PyMethodDescr("__or__",PySet.class,1,1,new exposed___or__(null,null))); 140 class exposed___xor__ extends PyBuiltinFunctionNarrow { 141 142 private PySet self; 143 144 public PyObject getSelf() { 145 return self; 146 } 147 148 exposed___xor__(PySet self,PyBuiltinFunction.Info info) { 149 super(info); 150 this.self=self; 151 } 152 153 public PyBuiltinFunction makeBound(PyObject self) { 154 return new exposed___xor__((PySet)self,info); 155 } 156 157 public PyObject __call__(PyObject arg0) { 158 PyObject ret=self.baseset___xor__(arg0); 159 if (ret==null) 160 return Py.NotImplemented; 161 return ret; 162 } 163 164 public PyObject inst_call(PyObject gself,PyObject arg0) { 165 PySet self=(PySet)gself; 166 PyObject ret=self.baseset___xor__(arg0); 167 if (ret==null) 168 return Py.NotImplemented; 169 return ret; 170 } 171 172 } 173 dict.__setitem__("__xor__",new PyMethodDescr("__xor__",PySet.class,1,1,new exposed___xor__(null,null))); 174 class exposed___sub__ extends PyBuiltinFunctionNarrow { 175 176 private PySet self; 177 178 public PyObject getSelf() { 179 return self; 180 } 181 182 exposed___sub__(PySet self,PyBuiltinFunction.Info info) { 183 super(info); 184 this.self=self; 185 } 186 187 public PyBuiltinFunction makeBound(PyObject self) { 188 return new exposed___sub__((PySet)self,info); 189 } 190 191 public PyObject __call__(PyObject arg0) { 192 PyObject ret=self.baseset___sub__(arg0); 193 if (ret==null) 194 return Py.NotImplemented; 195 return ret; 196 } 197 198 public PyObject inst_call(PyObject gself,PyObject arg0) { 199 PySet self=(PySet)gself; 200 PyObject ret=self.baseset___sub__(arg0); 201 if (ret==null) 202 return Py.NotImplemented; 203 return ret; 204 } 205 206 } 207 dict.__setitem__("__sub__",new PyMethodDescr("__sub__",PySet.class,1,1,new exposed___sub__(null,null))); 208 class exposed___and__ extends PyBuiltinFunctionNarrow { 209 210 private PySet self; 211 212 public PyObject getSelf() { 213 return self; 214 } 215 216 exposed___and__(PySet self,PyBuiltinFunction.Info info) { 217 super(info); 218 this.self=self; 219 } 220 221 public PyBuiltinFunction makeBound(PyObject self) { 222 return new exposed___and__((PySet)self,info); 223 } 224 225 public PyObject __call__(PyObject arg0) { 226 PyObject ret=self.baseset___and__(arg0); 227 if (ret==null) 228 return Py.NotImplemented; 229 return ret; 230 } 231 232 public PyObject inst_call(PyObject gself,PyObject arg0) { 233 PySet self=(PySet)gself; 234 PyObject ret=self.baseset___and__(arg0); 235 if (ret==null) 236 return Py.NotImplemented; 237 return ret; 238 } 239 240 } 241 dict.__setitem__("__and__",new PyMethodDescr("__and__",PySet.class,1,1,new exposed___and__(null,null))); 242 class exposed___gt__ extends PyBuiltinFunctionNarrow { 243 244 private PySet self; 245 246 public PyObject getSelf() { 247 return self; 248 } 249 250 exposed___gt__(PySet self,PyBuiltinFunction.Info info) { 251 super(info); 252 this.self=self; 253 } 254 255 public PyBuiltinFunction makeBound(PyObject self) { 256 return new exposed___gt__((PySet)self,info); 257 } 258 259 public PyObject __call__(PyObject arg0) { 260 PyObject ret=self.baseset___gt__(arg0); 261 if (ret==null) 262 return Py.NotImplemented; 263 return ret; 264 } 265 266 public PyObject inst_call(PyObject gself,PyObject arg0) { 267 PySet self=(PySet)gself; 268 PyObject ret=self.baseset___gt__(arg0); 269 if (ret==null) 270 return Py.NotImplemented; 271 return ret; 272 } 273 274 } 275 dict.__setitem__("__gt__",new PyMethodDescr("__gt__",PySet.class,1,1,new exposed___gt__(null,null))); 276 class exposed___ge__ extends PyBuiltinFunctionNarrow { 277 278 private PySet self; 279 280 public PyObject getSelf() { 281 return self; 282 } 283 284 exposed___ge__(PySet self,PyBuiltinFunction.Info info) { 285 super(info); 286 this.self=self; 287 } 288 289 public PyBuiltinFunction makeBound(PyObject self) { 290 return new exposed___ge__((PySet)self,info); 291 } 292 293 public PyObject __call__(PyObject arg0) { 294 PyObject ret=self.baseset___ge__(arg0); 295 if (ret==null) 296 return Py.NotImplemented; 297 return ret; 298 } 299 300 public PyObject inst_call(PyObject gself,PyObject arg0) { 301 PySet self=(PySet)gself; 302 PyObject ret=self.baseset___ge__(arg0); 303 if (ret==null) 304 return Py.NotImplemented; 305 return ret; 306 } 307 308 } 309 dict.__setitem__("__ge__",new PyMethodDescr("__ge__",PySet.class,1,1,new exposed___ge__(null,null))); 310 class exposed___le__ extends PyBuiltinFunctionNarrow { 311 312 private PySet self; 313 314 public PyObject getSelf() { 315 return self; 316 } 317 318 exposed___le__(PySet self,PyBuiltinFunction.Info info) { 319 super(info); 320 this.self=self; 321 } 322 323 public PyBuiltinFunction makeBound(PyObject self) { 324 return new exposed___le__((PySet)self,info); 325 } 326 327 public PyObject __call__(PyObject arg0) { 328 PyObject ret=self.baseset___le__(arg0); 329 if (ret==null) 330 return Py.NotImplemented; 331 return ret; 332 } 333 334 public PyObject inst_call(PyObject gself,PyObject arg0) { 335 PySet self=(PySet)gself; 336 PyObject ret=self.baseset___le__(arg0); 337 if (ret==null) 338 return Py.NotImplemented; 339 return ret; 340 } 341 342 } 343 dict.__setitem__("__le__",new PyMethodDescr("__le__",PySet.class,1,1,new exposed___le__(null,null))); 344 class exposed___lt__ extends PyBuiltinFunctionNarrow { 345 346 private PySet self; 347 348 public PyObject getSelf() { 349 return self; 350 } 351 352 exposed___lt__(PySet self,PyBuiltinFunction.Info info) { 353 super(info); 354 this.self=self; 355 } 356 357 public PyBuiltinFunction makeBound(PyObject self) { 358 return new exposed___lt__((PySet)self,info); 359 } 360 361 public PyObject __call__(PyObject arg0) { 362 PyObject ret=self.baseset___lt__(arg0); 363 if (ret==null) 364 return Py.NotImplemented; 365 return ret; 366 } 367 368 public PyObject inst_call(PyObject gself,PyObject arg0) { 369 PySet self=(PySet)gself; 370 PyObject ret=self.baseset___lt__(arg0); 371 if (ret==null) 372 return Py.NotImplemented; 373 return ret; 374 } 375 376 } 377 dict.__setitem__("__lt__",new PyMethodDescr("__lt__",PySet.class,1,1,new exposed___lt__(null,null))); 378 class exposed___contains__ extends PyBuiltinFunctionNarrow { 379 380 private PySet self; 381 382 public PyObject getSelf() { 383 return self; 384 } 385 386 exposed___contains__(PySet self,PyBuiltinFunction.Info info) { 387 super(info); 388 this.self=self; 389 } 390 391 public PyBuiltinFunction makeBound(PyObject self) { 392 return new exposed___contains__((PySet)self,info); 393 } 394 395 public PyObject __call__(PyObject arg0) { 396 return Py.newBoolean(self.baseset___contains__(arg0)); 397 } 398 399 public PyObject inst_call(PyObject gself,PyObject arg0) { 400 PySet self=(PySet)gself; 401 return Py.newBoolean(self.baseset___contains__(arg0)); 402 } 403 404 } 405 dict.__setitem__("__contains__",new PyMethodDescr("__contains__",PySet.class,1,1,new exposed___contains__(null,null))); 406 class exposed___deepcopy__ extends PyBuiltinFunctionNarrow { 407 408 private PySet self; 409 410 public PyObject getSelf() { 411 return self; 412 } 413 414 exposed___deepcopy__(PySet self,PyBuiltinFunction.Info info) { 415 super(info); 416 this.self=self; 417 } 418 419 public PyBuiltinFunction makeBound(PyObject self) { 420 return new exposed___deepcopy__((PySet)self,info); 421 } 422 423 public PyObject __call__(PyObject arg0) { 424 return self.baseset___deepcopy__(arg0); 425 } 426 427 public PyObject inst_call(PyObject gself,PyObject arg0) { 428 PySet self=(PySet)gself; 429 return self.baseset___deepcopy__(arg0); 430 } 431 432 } 433 dict.__setitem__("__deepcopy__",new PyMethodDescr("__deepcopy__",PySet.class,1,1,new exposed___deepcopy__(null,null))); 434 class exposed___nonzero__ extends PyBuiltinFunctionNarrow { 435 436 private PySet self; 437 438 public PyObject getSelf() { 439 return self; 440 } 441 442 exposed___nonzero__(PySet self,PyBuiltinFunction.Info info) { 443 super(info); 444 this.self=self; 445 } 446 447 public PyBuiltinFunction makeBound(PyObject self) { 448 return new exposed___nonzero__((PySet)self,info); 449 } 450 451 public PyObject __call__() { 452 return Py.newBoolean(self.baseset___nonzero__()); 453 } 454 455 public PyObject inst_call(PyObject gself) { 456 PySet self=(PySet)gself; 457 return Py.newBoolean(self.baseset___nonzero__()); 458 } 459 460 } 461 dict.__setitem__("__nonzero__",new PyMethodDescr("__nonzero__",PySet.class,0,0,new exposed___nonzero__(null,null))); 462 class exposed_copy extends PyBuiltinFunctionNarrow { 463 464 private PySet self; 465 466 public PyObject getSelf() { 467 return self; 468 } 469 470 exposed_copy(PySet self,PyBuiltinFunction.Info info) { 471 super(info); 472 this.self=self; 473 } 474 475 public PyBuiltinFunction makeBound(PyObject self) { 476 return new exposed_copy((PySet)self,info); 477 } 478 479 public PyObject __call__() { 480 return self.baseset_copy(); 481 } 482 483 public PyObject inst_call(PyObject gself) { 484 PySet self=(PySet)gself; 485 return self.baseset_copy(); 486 } 487 488 } 489 dict.__setitem__("copy",new PyMethodDescr("copy",PySet.class,0,0,new exposed_copy(null,null))); 490 class exposed__as_immutable extends PyBuiltinFunctionNarrow { 491 492 private PySet self; 493 494 public PyObject getSelf() { 495 return self; 496 } 497 498 exposed__as_immutable(PySet self,PyBuiltinFunction.Info info) { 499 super(info); 500 this.self=self; 501 } 502 503 public PyBuiltinFunction makeBound(PyObject self) { 504 return new exposed__as_immutable((PySet)self,info); 505 } 506 507 public PyObject __call__() { 508 return self.set__as_immutable(); 509 } 510 511 public PyObject inst_call(PyObject gself) { 512 PySet self=(PySet)gself; 513 return self.set__as_immutable(); 514 } 515 516 } 517 dict.__setitem__("_as_immutable",new PyMethodDescr("_as_immutable",PySet.class,0,0,new exposed__as_immutable(null,null))); 518 class exposed_union extends PyBuiltinFunctionNarrow { 519 520 private PySet self; 521 522 public PyObject getSelf() { 523 return self; 524 } 525 526 exposed_union(PySet self,PyBuiltinFunction.Info info) { 527 super(info); 528 this.self=self; 529 } 530 531 public PyBuiltinFunction makeBound(PyObject self) { 532 return new exposed_union((PySet)self,info); 533 } 534 535 public PyObject __call__(PyObject arg0) { 536 return self.baseset_union(arg0); 537 } 538 539 public PyObject inst_call(PyObject gself,PyObject arg0) { 540 PySet self=(PySet)gself; 541 return self.baseset_union(arg0); 542 } 543 544 } 545 dict.__setitem__("union",new PyMethodDescr("union",PySet.class,1,1,new exposed_union(null,null))); 546 class exposed_difference extends PyBuiltinFunctionNarrow { 547 548 private PySet self; 549 550 public PyObject getSelf() { 551 return self; 552 } 553 554 exposed_difference(PySet self,PyBuiltinFunction.Info info) { 555 super(info); 556 this.self=self; 557 } 558 559 public PyBuiltinFunction makeBound(PyObject self) { 560 return new exposed_difference((PySet)self,info); 561 } 562 563 public PyObject __call__(PyObject arg0) { 564 return self.baseset_difference(arg0); 565 } 566 567 public PyObject inst_call(PyObject gself,PyObject arg0) { 568 PySet self=(PySet)gself; 569 return self.baseset_difference(arg0); 570 } 571 572 } 573 dict.__setitem__("difference",new PyMethodDescr("difference",PySet.class,1,1,new exposed_difference(null,null))); 574 class exposed_symmetric_difference extends PyBuiltinFunctionNarrow { 575 576 private PySet self; 577 578 public PyObject getSelf() { 579 return self; 580 } 581 582 exposed_symmetric_difference(PySet self,PyBuiltinFunction.Info info) { 583 super(info); 584 this.self=self; 585 } 586 587 public PyBuiltinFunction makeBound(PyObject self) { 588 return new exposed_symmetric_difference((PySet)self,info); 589 } 590 591 public PyObject __call__(PyObject arg0) { 592 return self.baseset_symmetric_difference(arg0); 593 } 594 595 public PyObject inst_call(PyObject gself,PyObject arg0) { 596 PySet self=(PySet)gself; 597 return self.baseset_symmetric_difference(arg0); 598 } 599 600 } 601 dict.__setitem__("symmetric_difference",new PyMethodDescr("symmetric_difference",PySet.class,1,1,new exposed_symmetric_difference(null,null))); 602 class exposed_intersection extends PyBuiltinFunctionNarrow { 603 604 private PySet self; 605 606 public PyObject getSelf() { 607 return self; 608 } 609 610 exposed_intersection(PySet self,PyBuiltinFunction.Info info) { 611 super(info); 612 this.self=self; 613 } 614 615 public PyBuiltinFunction makeBound(PyObject self) { 616 return new exposed_intersection((PySet)self,info); 617 } 618 619 public PyObject __call__(PyObject arg0) { 620 return self.baseset_intersection(arg0); 621 } 622 623 public PyObject inst_call(PyObject gself,PyObject arg0) { 624 PySet self=(PySet)gself; 625 return self.baseset_intersection(arg0); 626 } 627 628 } 629 dict.__setitem__("intersection",new PyMethodDescr("intersection",PySet.class,1,1,new exposed_intersection(null,null))); 630 class exposed_issubset extends PyBuiltinFunctionNarrow { 631 632 private PySet self; 633 634 public PyObject getSelf() { 635 return self; 636 } 637 638 exposed_issubset(PySet self,PyBuiltinFunction.Info info) { 639 super(info); 640 this.self=self; 641 } 642 643 public PyBuiltinFunction makeBound(PyObject self) { 644 return new exposed_issubset((PySet)self,info); 645 } 646 647 public PyObject __call__(PyObject arg0) { 648 return self.baseset_issubset(arg0); 649 } 650 651 public PyObject inst_call(PyObject gself,PyObject arg0) { 652 PySet self=(PySet)gself; 653 return self.baseset_issubset(arg0); 654 } 655 656 } 657 dict.__setitem__("issubset",new PyMethodDescr("issubset",PySet.class,1,1,new exposed_issubset(null,null))); 658 class exposed_issuperset extends PyBuiltinFunctionNarrow { 659 660 private PySet self; 661 662 public PyObject getSelf() { 663 return self; 664 } 665 666 exposed_issuperset(PySet self,PyBuiltinFunction.Info info) { 667 super(info); 668 this.self=self; 669 } 670 671 public PyBuiltinFunction makeBound(PyObject self) { 672 return new exposed_issuperset((PySet)self,info); 673 } 674 675 public PyObject __call__(PyObject arg0) { 676 return self.baseset_issuperset(arg0); 677 } 678 679 public PyObject inst_call(PyObject gself,PyObject arg0) { 680 PySet self=(PySet)gself; 681 return self.baseset_issuperset(arg0); 682 } 683 684 } 685 dict.__setitem__("issuperset",new PyMethodDescr("issuperset",PySet.class,1,1,new exposed_issuperset(null,null))); 686 class exposed___hash__ extends PyBuiltinFunctionNarrow { 687 688 private PySet self; 689 690 public PyObject getSelf() { 691 return self; 692 } 693 694 exposed___hash__(PySet self,PyBuiltinFunction.Info info) { 695 super(info); 696 this.self=self; 697 } 698 699 public PyBuiltinFunction makeBound(PyObject self) { 700 return new exposed___hash__((PySet)self,info); 701 } 702 703 public PyObject __call__() { 704 return Py.newInteger(self.set_hashCode()); 705 } 706 707 public PyObject inst_call(PyObject gself) { 708 PySet self=(PySet)gself; 709 return Py.newInteger(self.set_hashCode()); 710 } 711 712 } 713 dict.__setitem__("__hash__",new PyMethodDescr("__hash__",PySet.class,0,0,new exposed___hash__(null,null))); 714 class exposed___repr__ extends PyBuiltinFunctionNarrow { 715 716 private PySet self; 717 718 public PyObject getSelf() { 719 return self; 720 } 721 722 exposed___repr__(PySet self,PyBuiltinFunction.Info info) { 723 super(info); 724 this.self=self; 725 } 726 727 public PyBuiltinFunction makeBound(PyObject self) { 728 return new exposed___repr__((PySet)self,info); 729 } 730 731 public PyObject __call__() { 732 return new PyString(self.baseset_toString()); 733 } 734 735 public PyObject inst_call(PyObject gself) { 736 PySet self=(PySet)gself; 737 return new PyString(self.baseset_toString()); 738 } 739 740 } 741 dict.__setitem__("__repr__",new PyMethodDescr("__repr__",PySet.class,0,0,new exposed___repr__(null,null))); 742 class exposed_add extends PyBuiltinFunctionNarrow { 743 744 private PySet self; 745 746 public PyObject getSelf() { 747 return self; 748 } 749 750 exposed_add(PySet self,PyBuiltinFunction.Info info) { 751 super(info); 752 this.self=self; 753 } 754 755 public PyBuiltinFunction makeBound(PyObject self) { 756 return new exposed_add((PySet)self,info); 757 } 758 759 public PyObject __call__(PyObject arg0) { 760 self.set_add(arg0); 761 return Py.None; 762 } 763 764 public PyObject inst_call(PyObject gself,PyObject arg0) { 765 PySet self=(PySet)gself; 766 self.set_add(arg0); 767 return Py.None; 768 } 769 770 } 771 dict.__setitem__("add",new PyMethodDescr("add",PySet.class,1,1,new exposed_add(null,null))); 772 class exposed_remove extends PyBuiltinFunctionNarrow { 773 774 private PySet self; 775 776 public PyObject getSelf() { 777 return self; 778 } 779 780 exposed_remove(PySet self,PyBuiltinFunction.Info info) { 781 super(info); 782 this.self=self; 783 } 784 785 public PyBuiltinFunction makeBound(PyObject self) { 786 return new exposed_remove((PySet)self,info); 787 } 788 789 public PyObject __call__(PyObject arg0) { 790 self.set_remove(arg0); 791 return Py.None; 792 } 793 794 public PyObject inst_call(PyObject gself,PyObject arg0) { 795 PySet self=(PySet)gself; 796 self.set_remove(arg0); 797 return Py.None; 798 } 799 800 } 801 dict.__setitem__("remove",new PyMethodDescr("remove",PySet.class,1,1,new exposed_remove(null,null))); 802 class exposed_discard extends PyBuiltinFunctionNarrow { 803 804 private PySet self; 805 806 public PyObject getSelf() { 807 return self; 808 } 809 810 exposed_discard(PySet self,PyBuiltinFunction.Info info) { 811 super(info); 812 this.self=self; 813 } 814 815 public PyBuiltinFunction makeBound(PyObject self) { 816 return new exposed_discard((PySet)self,info); 817 } 818 819 public PyObject __call__(PyObject arg0) { 820 self.set_discard(arg0); 821 return Py.None; 822 } 823 824 public PyObject inst_call(PyObject gself,PyObject arg0) { 825 PySet self=(PySet)gself; 826 self.set_discard(arg0); 827 return Py.None; 828 } 829 830 } 831 dict.__setitem__("discard",new PyMethodDescr("discard",PySet.class,1,1,new exposed_discard(null,null))); 832 class exposed_pop extends PyBuiltinFunctionNarrow { 833 834 private PySet self; 835 836 public PyObject getSelf() { 837 return self; 838 } 839 840 exposed_pop(PySet self,PyBuiltinFunction.Info info) { 841 super(info); 842 this.self=self; 843 } 844 845 public PyBuiltinFunction makeBound(PyObject self) { 846 return new exposed_pop((PySet)self,info); 847 } 848 849 public PyObject __call__() { 850 return self.set_pop(); 851 } 852 853 public PyObject inst_call(PyObject gself) { 854 PySet self=(PySet)gself; 855 return self.set_pop(); 856 } 857 858 } 859 dict.__setitem__("pop",new PyMethodDescr("pop",PySet.class,0,0,new exposed_pop(null,null))); 860 class exposed_clear extends PyBuiltinFunctionNarrow { 861 862 private PySet self; 863 864 public PyObject getSelf() { 865 return self; 866 } 867 868 exposed_clear(PySet self,PyBuiltinFunction.Info info) { 869 super(info); 870 this.self=self; 871 } 872 873 public PyBuiltinFunction makeBound(PyObject self) { 874 return new exposed_clear((PySet)self,info); 875 } 876 877 public PyObject __call__() { 878 self.set_clear(); 879 return Py.None; 880 } 881 882 public PyObject inst_call(PyObject gself) { 883 PySet self=(PySet)gself; 884 self.set_clear(); 885 return Py.None; 886 } 887 888 } 889 dict.__setitem__("clear",new PyMethodDescr("clear",PySet.class,0,0,new exposed_clear(null,null))); 890 class exposed_update extends PyBuiltinFunctionNarrow { 891 892 private PySet self; 893 894 public PyObject getSelf() { 895 return self; 896 } 897 898 exposed_update(PySet self,PyBuiltinFunction.Info info) { 899 super(info); 900 this.self=self; 901 } 902 903 public PyBuiltinFunction makeBound(PyObject self) { 904 return new exposed_update((PySet)self,info); 905 } 906 907 public PyObject __call__(PyObject arg0) { 908 self.set_update(arg0); 909 return Py.None; 910 } 911 912 public PyObject inst_call(PyObject gself,PyObject arg0) { 913 PySet self=(PySet)gself; 914 self.set_update(arg0); 915 return Py.None; 916 } 917 918 } 919 dict.__setitem__("update",new PyMethodDescr("update",PySet.class,1,1,new exposed_update(null,null))); 920 class exposed_union_update extends PyBuiltinFunctionNarrow { 921 922 private PySet self; 923 924 public PyObject getSelf() { 925 return self; 926 } 927 928 exposed_union_update(PySet self,PyBuiltinFunction.Info info) { 929 super(info); 930 this.self=self; 931 } 932 933 public PyBuiltinFunction makeBound(PyObject self) { 934 return new exposed_union_update((PySet)self,info); 935 } 936 937 public PyObject __call__(PyObject arg0) { 938 self.set_union_update(arg0); 939 return Py.None; 940 } 941 942 public PyObject inst_call(PyObject gself,PyObject arg0) { 943 PySet self=(PySet)gself; 944 self.set_union_update(arg0); 945 return Py.None; 946 } 947 948 } 949 dict.__setitem__("union_update",new PyMethodDescr("union_update",PySet.class,1,1,new exposed_union_update(null,null))); 950 class exposed_intersection_update extends PyBuiltinFunctionNarrow { 951 952 private PySet self; 953 954 public PyObject getSelf() { 955 return self; 956 } 957 958 exposed_intersection_update(PySet self,PyBuiltinFunction.Info info) { 959 super(info); 960 this.self=self; 961 } 962 963 public PyBuiltinFunction makeBound(PyObject self) { 964 return new exposed_intersection_update((PySet)self,info); 965 } 966 967 public PyObject __call__(PyObject arg0) { 968 self.set_intersection_update(arg0); 969 return Py.None; 970 } 971 972 public PyObject inst_call(PyObject gself,PyObject arg0) { 973 PySet self=(PySet)gself; 974 self.set_intersection_update(arg0); 975 return Py.None; 976 } 977 978 } 979 dict.__setitem__("intersection_update",new PyMethodDescr("intersection_update",PySet.class,1,1,new exposed_intersection_update(null,null))); 980 class exposed_symmetric_difference_update extends PyBuiltinFunctionNarrow { 981 982 private PySet self; 983 984 public PyObject getSelf() { 985 return self; 986 } 987 988 exposed_symmetric_difference_update(PySet self,PyBuiltinFunction.Info info) { 989 super(info); 990 this.self=self; 991 } 992 993 public PyBuiltinFunction makeBound(PyObject self) { 994 return new exposed_symmetric_difference_update((PySet)self,info); 995 } 996 997 public PyObject __call__(PyObject arg0) { 998 self.set_symmetric_difference_update(arg0); 999 return Py.None; 1000 } 1001 1002 public PyObject inst_call(PyObject gself,PyObject arg0) { 1003 PySet self=(PySet)gself; 1004 self.set_symmetric_difference_update(arg0); 1005 return Py.None; 1006 } 1007 1008 } 1009 dict.__setitem__("symmetric_difference_update",new PyMethodDescr("symmetric_difference_update",PySet.class,1,1,new exposed_symmetric_difference_update(null,null))); 1010 class exposed_difference_update extends PyBuiltinFunctionNarrow { 1011 1012 private PySet self; 1013 1014 public PyObject getSelf() { 1015 return self; 1016 } 1017 1018 exposed_difference_update(PySet self,PyBuiltinFunction.Info info) { 1019 super(info); 1020 this.self=self; 1021 } 1022 1023 public PyBuiltinFunction makeBound(PyObject self) { 1024 return new exposed_difference_update((PySet)self,info); 1025 } 1026 1027 public PyObject __call__(PyObject arg0) { 1028 self.set_difference_update(arg0); 1029 return Py.None; 1030 } 1031 1032 public PyObject inst_call(PyObject gself,PyObject arg0) { 1033 PySet self=(PySet)gself; 1034 self.set_difference_update(arg0); 1035 return Py.None; 1036 } 1037 1038 } 1039 dict.__setitem__("difference_update",new PyMethodDescr("difference_update",PySet.class,1,1,new exposed_difference_update(null,null))); 1040 class exposed___init__ extends PyBuiltinFunctionWide { 1041 1042 private PySet self; 1043 1044 public PyObject getSelf() { 1045 return self; 1046 } 1047 1048 exposed___init__(PySet self,PyBuiltinFunction.Info info) { 1049 super(info); 1050 this.self=self; 1051 } 1052 1053 public PyBuiltinFunction makeBound(PyObject self) { 1054 return new exposed___init__((PySet)self,info); 1055 } 1056 1057 public PyObject inst_call(PyObject self,PyObject[]args) { 1058 return inst_call(self,args,Py.NoKeywords); 1059 } 1060 1061 public PyObject __call__(PyObject[]args) { 1062 return __call__(args,Py.NoKeywords); 1063 } 1064 1065 public PyObject __call__(PyObject[]args,String []keywords) { 1066 self.set_init(args,keywords); 1067 return Py.None; 1068 } 1069 1070 public PyObject inst_call(PyObject gself,PyObject[]args,String []keywords) { 1071 PySet self=(PySet)gself; 1072 self.set_init(args,keywords); 1073 return Py.None; 1074 } 1075 1076 } 1077 dict.__setitem__("__init__",new PyMethodDescr("__init__",PySet.class,-1,-1,new exposed___init__(null,null))); 1078 dict.__setitem__("__new__",new PyNewWrapper(PySet.class,"__new__",-1,-1) { 1079 1080 public PyObject new_impl(boolean init,PyType subtype,PyObject[]args,String []keywords) { 1081 PySet newobj; 1082 if (for_type==subtype) { 1083 newobj=new PySet(); 1084 if (init) 1085 newobj.set_init(args,keywords); 1086 } else { 1087 newobj=new PySetDerived(subtype); 1088 } 1089 return newobj; 1090 } 1091 1092 }); 1093 } 1094 1095 final void set_init(PyObject[] args, String [] kwds) { 1096 int nargs = args.length - kwds.length; 1097 if (nargs > 1) { 1098 throw PyBuiltinFunction.DefaultInfo.unexpectedCall(nargs, false, exposed_name, 0, 1); 1099 } 1100 if (nargs == 0) { 1101 return; 1102 } 1103 1104 PyObject o = args[0]; 1105 _update(o); 1106 } 1107 1108 public PyObject __ior__(PyObject other) { 1109 return set___ior__(other); 1110 } 1111 1112 final PyObject set___ior__(PyObject other) { 1113 BaseSet bs = this._binary_sanity_check(other); 1114 this._set.addAll(bs._set); 1115 return this; 1116 } 1117 1118 public PyObject __ixor__(PyObject other) { 1119 return set___ixor__(other); 1120 } 1121 1122 final PyObject set___ixor__(PyObject other) { 1123 this._binary_sanity_check(other); 1124 set_symmetric_difference_update(other); 1125 return this; 1126 } 1127 1128 public PyObject __iand__(PyObject other) { 1129 return set___iand__(other); 1130 } 1131 1132 final PyObject set___iand__(PyObject other) { 1133 BaseSet bs = this._binary_sanity_check(other); 1134 this._set = ((BaseSet) this.__and__(bs))._set; 1135 return this; 1136 } 1137 1138 public PyObject __isub__(PyObject other) { 1139 return set___isub__(other); 1140 } 1141 1142 final PyObject set___isub__(PyObject other) { 1143 BaseSet bs = this._binary_sanity_check(other); 1144 this._set.removeAll(bs._set); 1145 return this; 1146 } 1147 1148 public int hashCode() { 1149 return set_hashCode(); 1150 } 1151 1152 final int set_hashCode() { 1153 throw Py.TypeError("Can't hash a Set, only an ImmutableSet."); 1154 } 1155 1156 final void set_add(PyObject o) { 1157 try { 1158 this._set.add(o); 1159 } catch (PyException e) { 1160 PyObject immutable = this.asImmutable(e, o); 1161 this._set.add(immutable); 1162 } 1163 } 1164 1165 final void set_remove(PyObject o) { 1166 boolean b = false; 1167 try { 1168 b = this._set.remove(o); 1169 } catch (PyException e) { 1170 PyObject immutable = this.asImmutable(e, o); 1171 b = this._set.remove(immutable); 1172 } 1173 if (!b) { 1174 throw new PyException(Py.LookupError, o.toString()); 1175 } 1176 } 1177 1178 final void set_discard(PyObject o) { 1179 try { 1180 this._set.remove(o); 1181 } catch (PyException e) { 1182 PyObject immutable = this.asImmutable(e, o); 1183 this._set.remove(immutable); 1184 } 1185 } 1186 1187 final PyObject set_pop() { 1188 Iterator iterator = this._set.iterator(); 1189 Object first = iterator.next(); 1190 this._set.remove(first); 1191 return (PyObject) first; 1192 } 1193 1194 final void set_clear() { 1195 this._set.clear(); 1196 } 1197 1198 final void set_update(PyObject data) { 1199 this._update(data); 1200 } 1201 1202 final void set_union_update(PyObject other) { 1203 this._update(other); 1204 } 1205 1206 final void set_intersection_update(PyObject other) { 1207 if (other instanceof BaseSet) { 1208 this.__iand__(other); 1209 } else { 1210 BaseSet set = (BaseSet) baseset_intersection(other); 1211 this._set = set._set; 1212 } 1213 } 1214 1215 final void set_symmetric_difference_update(PyObject other) { 1216 BaseSet bs = (other instanceof BaseSet) ? (BaseSet) other : new PySet(other); 1217 for (Iterator iterator = bs._set.iterator(); iterator.hasNext();) { 1218 Object o = iterator.next(); 1219 if (this._set.contains(o)) { 1220 this._set.remove(o); 1221 } else { 1222 this._set.add(o); 1223 } 1224 } 1225 } 1226 1227 final void set_difference_update(PyObject other) { 1228 if (other instanceof BaseSet) { 1229 this.__isub__(other); 1230 return; 1231 } 1232 PyObject iter = other.__iter__(); 1233 for (PyObject o; (o = iter.__iternext__()) != null;) { 1234 if (this.__contains__(o)) { 1235 this._set.remove(o); 1236 } 1237 } 1238 } 1239 1240 final PyObject set__as_immutable() { 1241 return new PyImmutableSet(this); 1242 } 1243} 1244 | Popular Tags |