1 19 package gnu.trove; 20 21 import java.io.IOException ; 22 import java.io.ObjectOutput ; 23 24 25 41 42 class SerializationProcedure implements TDoubleDoubleProcedure, 43 TDoubleFloatProcedure, 44 TDoubleIntProcedure, 45 TDoubleLongProcedure, 46 TDoubleShortProcedure, 47 TDoubleByteProcedure, 48 TDoubleObjectProcedure, 49 TDoubleProcedure, 50 TFloatDoubleProcedure, 51 TFloatFloatProcedure, 52 TFloatIntProcedure, 53 TFloatLongProcedure, 54 TFloatShortProcedure, 55 TFloatByteProcedure, 56 TFloatObjectProcedure, 57 TFloatProcedure, 58 TIntDoubleProcedure, 59 TIntFloatProcedure, 60 TIntIntProcedure, 61 TIntLongProcedure, 62 TIntShortProcedure, 63 TIntByteProcedure, 64 TIntObjectProcedure, 65 TIntProcedure, 66 TLongDoubleProcedure, 67 TLongFloatProcedure, 68 TLongIntProcedure, 69 TLongLongProcedure, 70 TLongShortProcedure, 71 TLongByteProcedure, 72 TLongObjectProcedure, 73 TLongProcedure, 74 TShortDoubleProcedure, 75 TShortFloatProcedure, 76 TShortIntProcedure, 77 TShortLongProcedure, 78 TShortShortProcedure, 79 TShortByteProcedure, 80 TShortObjectProcedure, 81 TShortProcedure, 82 TByteDoubleProcedure, 83 TByteFloatProcedure, 84 TByteIntProcedure, 85 TByteLongProcedure, 86 TByteShortProcedure, 87 TByteByteProcedure, 88 TByteObjectProcedure, 89 TByteProcedure, 90 TObjectDoubleProcedure, 91 TObjectFloatProcedure, 92 TObjectIntProcedure, 93 TObjectLongProcedure, 94 TObjectShortProcedure, 95 TObjectByteProcedure, 96 TObjectObjectProcedure, 97 TObjectProcedure { 98 99 private final ObjectOutput stream; 100 IOException exception; 101 102 SerializationProcedure ( ObjectOutput stream) { 103 this.stream = stream; 104 } 105 106 public boolean execute(byte val) { 107 try { 108 stream.writeByte(val); 109 } catch (IOException e) { 110 this.exception = e; 111 return false; 112 } 113 return true; 114 } 115 116 public boolean execute(short val) { 117 try { 118 stream.writeShort(val); 119 } catch (IOException e) { 120 this.exception = e; 121 return false; 122 } 123 return true; 124 } 125 126 public boolean execute(int val) { 127 try { 128 stream.writeInt(val); 129 } catch (IOException e) { 130 this.exception = e; 131 return false; 132 } 133 return true; 134 } 135 136 public boolean execute(double val) { 137 try { 138 stream.writeDouble(val); 139 } catch (IOException e) { 140 this.exception = e; 141 return false; 142 } 143 return true; 144 } 145 146 public boolean execute(long val) { 147 try { 148 stream.writeLong(val); 149 } catch (IOException e) { 150 this.exception = e; 151 return false; 152 } 153 return true; 154 } 155 156 public boolean execute(float val) { 157 try { 158 stream.writeFloat(val); 159 } catch (IOException e) { 160 this.exception = e; 161 return false; 162 } 163 return true; 164 } 165 166 public boolean execute(Object val) { 167 try { 168 stream.writeObject(val); 169 } catch (IOException e) { 170 this.exception = e; 171 return false; 172 } 173 return true; 174 } 175 176 public boolean execute(Object key, Object val) { 177 try { 178 stream.writeObject(key); 179 stream.writeObject(val); 180 } catch (IOException e) { 181 this.exception = e; 182 return false; 183 } 184 return true; 185 } 186 187 public boolean execute(Object key, byte val) { 188 try { 189 stream.writeObject(key); 190 stream.writeByte(val); 191 } catch (IOException e) { 192 this.exception = e; 193 return false; 194 } 195 return true; 196 } 197 198 public boolean execute(Object key, short val) { 199 try { 200 stream.writeObject(key); 201 stream.writeShort(val); 202 } catch (IOException e) { 203 this.exception = e; 204 return false; 205 } 206 return true; 207 } 208 209 public boolean execute(Object key, int val) { 210 try { 211 stream.writeObject(key); 212 stream.writeInt(val); 213 } catch (IOException e) { 214 this.exception = e; 215 return false; 216 } 217 return true; 218 } 219 220 public boolean execute(Object key, long val) { 221 try { 222 stream.writeObject(key); 223 stream.writeLong(val); 224 } catch (IOException e) { 225 this.exception = e; 226 return false; 227 } 228 return true; 229 } 230 231 public boolean execute(Object key, double val) { 232 try { 233 stream.writeObject(key); 234 stream.writeDouble(val); 235 } catch (IOException e) { 236 this.exception = e; 237 return false; 238 } 239 return true; 240 } 241 242 public boolean execute(Object key, float val) { 243 try { 244 stream.writeObject(key); 245 stream.writeFloat(val); 246 } catch (IOException e) { 247 this.exception = e; 248 return false; 249 } 250 return true; 251 } 252 253 public boolean execute(int key, byte val) { 254 try { 255 stream.writeInt(key); 256 stream.writeByte(val); 257 } catch (IOException e) { 258 this.exception = e; 259 return false; 260 } 261 return true; 262 } 263 264 public boolean execute(int key, short val) { 265 try { 266 stream.writeInt(key); 267 stream.writeShort(val); 268 } catch (IOException e) { 269 this.exception = e; 270 return false; 271 } 272 return true; 273 } 274 275 public boolean execute(int key, Object val) { 276 try { 277 stream.writeInt(key); 278 stream.writeObject(val); 279 } catch (IOException e) { 280 this.exception = e; 281 return false; 282 } 283 return true; 284 } 285 286 public boolean execute(int key, int val) { 287 try { 288 stream.writeInt(key); 289 stream.writeInt(val); 290 } catch (IOException e) { 291 this.exception = e; 292 return false; 293 } 294 return true; 295 } 296 297 public boolean execute(int key, long val) { 298 try { 299 stream.writeInt(key); 300 stream.writeLong(val); 301 } catch (IOException e) { 302 this.exception = e; 303 return false; 304 } 305 return true; 306 } 307 308 public boolean execute(int key, double val) { 309 try { 310 stream.writeInt(key); 311 stream.writeDouble(val); 312 } catch (IOException e) { 313 this.exception = e; 314 return false; 315 } 316 return true; 317 } 318 319 public boolean execute(int key, float val) { 320 try { 321 stream.writeInt(key); 322 stream.writeFloat(val); 323 } catch (IOException e) { 324 this.exception = e; 325 return false; 326 } 327 return true; 328 } 329 330 public boolean execute(long key, Object val) { 331 try { 332 stream.writeLong(key); 333 stream.writeObject(val); 334 } catch (IOException e) { 335 this.exception = e; 336 return false; 337 } 338 return true; 339 } 340 341 public boolean execute(long key, byte val) { 342 try { 343 stream.writeLong(key); 344 stream.writeByte(val); 345 } catch (IOException e) { 346 this.exception = e; 347 return false; 348 } 349 return true; 350 } 351 352 public boolean execute(long key, short val) { 353 try { 354 stream.writeLong(key); 355 stream.writeShort(val); 356 } catch (IOException e) { 357 this.exception = e; 358 return false; 359 } 360 return true; 361 } 362 363 public boolean execute(long key, int val) { 364 try { 365 stream.writeLong(key); 366 stream.writeInt(val); 367 } catch (IOException e) { 368 this.exception = e; 369 return false; 370 } 371 return true; 372 } 373 374 public boolean execute(long key, long val) { 375 try { 376 stream.writeLong(key); 377 stream.writeLong(val); 378 } catch (IOException e) { 379 this.exception = e; 380 return false; 381 } 382 return true; 383 } 384 385 public boolean execute(long key, double val) { 386 try { 387 stream.writeLong(key); 388 stream.writeDouble(val); 389 } catch (IOException e) { 390 this.exception = e; 391 return false; 392 } 393 return true; 394 } 395 396 public boolean execute(long key, float val) { 397 try { 398 stream.writeLong(key); 399 stream.writeFloat(val); 400 } catch (IOException e) { 401 this.exception = e; 402 return false; 403 } 404 return true; 405 } 406 407 public boolean execute(double key, Object val) { 408 try { 409 stream.writeDouble(key); 410 stream.writeObject(val); 411 } catch (IOException e) { 412 this.exception = e; 413 return false; 414 } 415 return true; 416 } 417 418 public boolean execute(double key, byte val) { 419 try { 420 stream.writeDouble(key); 421 stream.writeByte(val); 422 } catch (IOException e) { 423 this.exception = e; 424 return false; 425 } 426 return true; 427 } 428 429 public boolean execute(double key, short val) { 430 try { 431 stream.writeDouble(key); 432 stream.writeShort(val); 433 } catch (IOException e) { 434 this.exception = e; 435 return false; 436 } 437 return true; 438 } 439 440 public boolean execute(double key, int val) { 441 try { 442 stream.writeDouble(key); 443 stream.writeInt(val); 444 } catch (IOException e) { 445 this.exception = e; 446 return false; 447 } 448 return true; 449 } 450 451 public boolean execute(double key, long val) { 452 try { 453 stream.writeDouble(key); 454 stream.writeLong(val); 455 } catch (IOException e) { 456 this.exception = e; 457 return false; 458 } 459 return true; 460 } 461 462 public boolean execute(double key, double val) { 463 try { 464 stream.writeDouble(key); 465 stream.writeDouble(val); 466 } catch (IOException e) { 467 this.exception = e; 468 return false; 469 } 470 return true; 471 } 472 473 public boolean execute(double key, float val) { 474 try { 475 stream.writeDouble(key); 476 stream.writeFloat(val); 477 } catch (IOException e) { 478 this.exception = e; 479 return false; 480 } 481 return true; 482 } 483 484 public boolean execute(float key, Object val) { 485 try { 486 stream.writeFloat(key); 487 stream.writeObject(val); 488 } catch (IOException e) { 489 this.exception = e; 490 return false; 491 } 492 return true; 493 } 494 495 public boolean execute(float key, byte val) { 496 try { 497 stream.writeFloat(key); 498 stream.writeByte(val); 499 } catch (IOException e) { 500 this.exception = e; 501 return false; 502 } 503 return true; 504 } 505 506 public boolean execute(float key, short val) { 507 try { 508 stream.writeFloat(key); 509 stream.writeShort(val); 510 } catch (IOException e) { 511 this.exception = e; 512 return false; 513 } 514 return true; 515 } 516 517 public boolean execute(float key, int val) { 518 try { 519 stream.writeFloat(key); 520 stream.writeInt(val); 521 } catch (IOException e) { 522 this.exception = e; 523 return false; 524 } 525 return true; 526 } 527 528 public boolean execute(float key, long val) { 529 try { 530 stream.writeFloat(key); 531 stream.writeLong(val); 532 } catch (IOException e) { 533 this.exception = e; 534 return false; 535 } 536 return true; 537 } 538 539 public boolean execute(float key, double val) { 540 try { 541 stream.writeFloat(key); 542 stream.writeDouble(val); 543 } catch (IOException e) { 544 this.exception = e; 545 return false; 546 } 547 return true; 548 } 549 550 public boolean execute(float key, float val) { 551 try { 552 stream.writeFloat(key); 553 stream.writeFloat(val); 554 } catch (IOException e) { 555 this.exception = e; 556 return false; 557 } 558 return true; 559 } 560 561 public boolean execute(byte key, Object val) { 562 try { 563 stream.writeByte(key); 564 stream.writeObject(val); 565 } catch (IOException e) { 566 this.exception = e; 567 return false; 568 } 569 return true; 570 } 571 572 public boolean execute(byte key, byte val) { 573 try { 574 stream.writeByte(key); 575 stream.writeByte(val); 576 } catch (IOException e) { 577 this.exception = e; 578 return false; 579 } 580 return true; 581 } 582 583 public boolean execute(byte key, short val) { 584 try { 585 stream.writeByte(key); 586 stream.writeShort(val); 587 } catch (IOException e) { 588 this.exception = e; 589 return false; 590 } 591 return true; 592 } 593 594 public boolean execute(byte key, int val) { 595 try { 596 stream.writeByte(key); 597 stream.writeInt(val); 598 } catch (IOException e) { 599 this.exception = e; 600 return false; 601 } 602 return true; 603 } 604 605 public boolean execute(byte key, long val) { 606 try { 607 stream.writeByte(key); 608 stream.writeLong(val); 609 } catch (IOException e) { 610 this.exception = e; 611 return false; 612 } 613 return true; 614 } 615 616 public boolean execute(byte key, double val) { 617 try { 618 stream.writeByte(key); 619 stream.writeDouble(val); 620 } catch (IOException e) { 621 this.exception = e; 622 return false; 623 } 624 return true; 625 } 626 627 public boolean execute(byte key, float val) { 628 try { 629 stream.writeByte(key); 630 stream.writeFloat(val); 631 } catch (IOException e) { 632 this.exception = e; 633 return false; 634 } 635 return true; 636 } 637 638 public boolean execute(short key, Object val) { 639 try { 640 stream.writeShort(key); 641 stream.writeObject(val); 642 } catch (IOException e) { 643 this.exception = e; 644 return false; 645 } 646 return true; 647 } 648 649 public boolean execute(short key, byte val) { 650 try { 651 stream.writeShort(key); 652 stream.writeByte(val); 653 } catch (IOException e) { 654 this.exception = e; 655 return false; 656 } 657 return true; 658 } 659 660 public boolean execute(short key, short val) { 661 try { 662 stream.writeShort(key); 663 stream.writeShort(val); 664 } catch (IOException e) { 665 this.exception = e; 666 return false; 667 } 668 return true; 669 } 670 671 public boolean execute(short key, int val) { 672 try { 673 stream.writeShort(key); 674 stream.writeInt(val); 675 } catch (IOException e) { 676 this.exception = e; 677 return false; 678 } 679 return true; 680 } 681 682 public boolean execute(short key, long val) { 683 try { 684 stream.writeShort(key); 685 stream.writeLong(val); 686 } catch (IOException e) { 687 this.exception = e; 688 return false; 689 } 690 return true; 691 } 692 693 public boolean execute(short key, double val) { 694 try { 695 stream.writeShort(key); 696 stream.writeDouble(val); 697 } catch (IOException e) { 698 this.exception = e; 699 return false; 700 } 701 return true; 702 } 703 704 public boolean execute(short key, float val) { 705 try { 706 stream.writeShort(key); 707 stream.writeFloat(val); 708 } catch (IOException e) { 709 this.exception = e; 710 return false; 711 } 712 return true; 713 } 714 } | Popular Tags |