├── EjemploRelaciones ├── build.xml ├── manifest.mf ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── private │ │ └── private.properties │ ├── project.properties │ └── project.xml └── src │ ├── ej01 │ ├── Ej01Main.java │ ├── entidades │ │ ├── Perro.java │ │ └── Persona.java │ └── servicios │ │ └── PPServicios.java │ ├── ej02 │ ├── Ej02Main.java │ └── entidades │ │ ├── Juego.java │ │ ├── Jugador.java │ │ └── Revolver.java │ ├── ej03 │ ├── Ej03Main.java │ ├── entidades │ │ ├── Baraja.java │ │ └── Carta.java │ ├── enums │ │ └── Palo.java │ └── servicios │ │ └── BarajaServicio.java │ └── ejC02 │ ├── EjC02Main.java │ ├── entidades │ ├── Asiento.java │ ├── Cine.java │ ├── Espectador.java │ └── Pelicula.java │ ├── enums │ └── Columna.java │ └── servicios │ └── CineServicio.java ├── README.md └── Relaciones ├── build.xml ├── manifest.mf ├── nbproject ├── build-impl.xml ├── genfiles.properties ├── private │ └── private.properties ├── project.properties └── project.xml └── src └── relaciones ├── Relaciones.java ├── agregacion ├── Cliente.java └── Empresa.java ├── composicion ├── Empleado.java └── Empresa.java ├── inversa ├── Auto.java └── Persona.java └── reflexiva ├── Nodo.java └── Persona.java /EjemploRelaciones/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Builds, tests, and runs the project EjemploRelaciones. 12 | 13 | 73 | 74 | -------------------------------------------------------------------------------- /EjemploRelaciones/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /EjemploRelaciones/nbproject/build-impl.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | Must set src.dir 234 | Must set test.src.dir 235 | Must set build.dir 236 | Must set dist.dir 237 | Must set build.classes.dir 238 | Must set dist.javadoc.dir 239 | Must set build.test.classes.dir 240 | Must set build.test.results.dir 241 | Must set build.classes.excludes 242 | Must set dist.jar 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | Must set javac.includes 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | No tests executed. 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | Must set JVM to use for profiling in profiler.info.jvm 723 | Must set profiler agent JVM arguments in profiler.info.jvmargs.agent 724 | 725 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 951 | Must select some files in the IDE or set javac.includes 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | To run this application from the command line without Ant, try: 1002 | 1003 | java -jar "${dist.jar.resolved}" 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1039 | 1040 | 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 | 1048 | 1049 | 1050 | Must select one file in the IDE or set run.class 1051 | 1052 | 1053 | 1054 | Must select one file in the IDE or set run.class 1055 | 1056 | 1057 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | Must select one file in the IDE or set debug.class 1082 | 1083 | 1084 | 1085 | 1086 | Must select one file in the IDE or set debug.class 1087 | 1088 | 1089 | 1090 | 1091 | Must set fix.includes 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1103 | 1106 | 1107 | This target only works when run from inside the NetBeans IDE. 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | Must select one file in the IDE or set profile.class 1117 | This target only works when run from inside the NetBeans IDE. 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | This target only works when run from inside the NetBeans IDE. 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | This target only works when run from inside the NetBeans IDE. 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1152 | 1153 | 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1164 | 1165 | 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | 1175 | 1176 | 1177 | Must select one file in the IDE or set run.class 1178 | 1179 | 1180 | 1181 | 1182 | 1183 | Must select some files in the IDE or set test.includes 1184 | 1185 | 1186 | 1187 | 1188 | Must select one file in the IDE or set run.class 1189 | 1190 | 1191 | 1192 | 1193 | Must select one file in the IDE or set applet.url 1194 | 1195 | 1196 | 1197 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | 1215 | 1216 | 1217 | 1218 | 1219 | 1220 | 1221 | 1222 | 1223 | 1224 | 1225 | 1226 | 1227 | 1228 | 1229 | 1230 | 1231 | 1232 | 1233 | 1234 | 1235 | 1236 | 1237 | 1238 | 1239 | 1240 | 1241 | 1246 | 1247 | 1248 | 1249 | 1250 | 1251 | 1252 | 1253 | 1254 | 1255 | 1256 | 1257 | 1258 | 1259 | 1260 | 1261 | 1262 | 1263 | 1264 | 1265 | 1266 | 1267 | 1268 | 1269 | 1270 | 1271 | 1272 | Must select some files in the IDE or set javac.includes 1273 | 1274 | 1275 | 1276 | 1277 | 1278 | 1279 | 1280 | 1281 | 1282 | 1283 | 1284 | 1289 | 1290 | 1291 | 1292 | 1293 | 1294 | 1295 | 1296 | Some tests failed; see details above. 1297 | 1298 | 1299 | 1300 | 1301 | 1302 | 1303 | 1304 | 1305 | Must select some files in the IDE or set test.includes 1306 | 1307 | 1308 | 1309 | Some tests failed; see details above. 1310 | 1311 | 1312 | 1313 | Must select some files in the IDE or set test.class 1314 | Must select some method in the IDE or set test.method 1315 | 1316 | 1317 | 1318 | Some tests failed; see details above. 1319 | 1320 | 1321 | 1326 | 1327 | Must select one file in the IDE or set test.class 1328 | 1329 | 1330 | 1331 | Must select one file in the IDE or set test.class 1332 | Must select some method in the IDE or set test.method 1333 | 1334 | 1335 | 1336 | 1337 | 1338 | 1339 | 1340 | 1341 | 1342 | 1343 | 1344 | 1349 | 1350 | Must select one file in the IDE or set applet.url 1351 | 1352 | 1353 | 1354 | 1355 | 1356 | 1357 | 1362 | 1363 | Must select one file in the IDE or set applet.url 1364 | 1365 | 1366 | 1367 | 1368 | 1369 | 1370 | 1371 | 1376 | 1377 | 1378 | 1379 | 1380 | 1381 | 1382 | 1383 | 1384 | 1385 | 1386 | 1387 | 1388 | 1389 | 1390 | 1391 | 1392 | 1393 | 1394 | 1395 | 1396 | 1397 | 1398 | 1399 | 1400 | 1401 | 1402 | 1403 | 1404 | 1405 | 1406 | 1407 | 1408 | 1409 | 1410 | 1411 | 1412 | 1413 | 1414 | 1415 | 1416 | 1417 | 1418 | 1419 | 1420 | 1421 | -------------------------------------------------------------------------------- /EjemploRelaciones/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=37a03c42 2 | build.xml.script.CRC32=6598bb72 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=37a03c42 7 | nbproject/build-impl.xml.script.CRC32=4968335c 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /EjemploRelaciones/nbproject/private/private.properties: -------------------------------------------------------------------------------- 1 | compile.on.save=true 2 | user.properties.file=C:\\Users\\AsteriX\\AppData\\Roaming\\NetBeans\\8.2\\build.properties 3 | -------------------------------------------------------------------------------- /EjemploRelaciones/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/EjemploRelaciones.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=ejemplorelaciones.EjemploRelaciones 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /EjemploRelaciones/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | EjemploRelaciones 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ej01/Ej01Main.java: -------------------------------------------------------------------------------- 1 | package ej01; 2 | 3 | import ej01.entidades.Perro; 4 | import ej01.entidades.Persona; 5 | import ej01.servicios.PPServicios; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import java.util.Scanner; 9 | 10 | public class Ej01Main { 11 | 12 | private static Scanner leer = new Scanner(System.in).useDelimiter("\n"); 13 | private static PPServicios pps = new PPServicios(); 14 | 15 | public static void main(String[] args) { 16 | 17 | List personas = new ArrayList(); 18 | List perrosadoptables = new ArrayList(); 19 | 20 | System.out.println("Se procedera a cargar dos personas en el sistema"); 21 | for (int i = 0; i < 2; i++) { 22 | personas.add(pps.crearPersona()); 23 | } 24 | 25 | System.out.println(""); 26 | System.out.println("Se procede a cargar dos perros en el sistema"); 27 | for (int i = 0; i < 2; i++) { 28 | perrosadoptables.add(pps.crearPerro()); 29 | } 30 | 31 | System.out.println(""); 32 | for (Persona aux : personas) { 33 | System.out.println("Para la persona " + aux.getNombre() + " " + aux.getApellido() + " \nseleccione el nombre de uno de los siguientes perros en adopción: "); 34 | for (Perro aux2 : perrosadoptables) { 35 | System.out.println("Nombre: " + aux2.getNombre() + " - Raza: " + aux2.getRaza()); 36 | } 37 | String adoptable = leer.next(); 38 | 39 | int ctrol = 0; 40 | for (int i = 0; i < perrosadoptables.size(); i++) { 41 | if (adoptable.equalsIgnoreCase(perrosadoptables.get(i).getNombre())) { 42 | aux.setPerro(perrosadoptables.get(i)); 43 | ctrol++; 44 | perrosadoptables.remove(i); 45 | } 46 | } 47 | if (ctrol == 0) { 48 | System.out.println("No se ha adoptado un perro válido"); 49 | } 50 | } 51 | 52 | System.out.println(""); 53 | System.out.println("Las siguientes personas han adoptado: "); 54 | for (Persona aux : personas) { 55 | if (aux.getPerro() == null) { 56 | System.out.println(aux.getNombre() + " " + aux.getApellido() + " no ha adoptado a ningun perro"); 57 | } else { 58 | System.out.println(aux.getNombre() + " " + aux.getApellido() + " a adoptado a " + aux.getPerro().getNombre() + " de raza " + aux.getPerro().getRaza()); 59 | } 60 | 61 | } 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ej01/entidades/Perro.java: -------------------------------------------------------------------------------- 1 | package ej01.entidades; 2 | 3 | public class Perro { 4 | 5 | private String nombre; 6 | private String raza; 7 | private Integer edad; 8 | private String tamanio; 9 | 10 | public Perro() { 11 | } 12 | 13 | public Perro(String nombre, String raza, Integer edad, String tamaño) { 14 | this.nombre = nombre; 15 | this.raza = raza; 16 | this.edad = edad; 17 | this.tamanio = tamaño; 18 | } 19 | 20 | public String getNombre() { 21 | return nombre; 22 | } 23 | 24 | public String getRaza() { 25 | return raza; 26 | } 27 | 28 | public Integer getEdad() { 29 | return edad; 30 | } 31 | 32 | public String getTamaño() { 33 | return tamanio; 34 | } 35 | 36 | public void setNombre(String nombre) { 37 | this.nombre = nombre; 38 | } 39 | 40 | public void setRaza(String raza) { 41 | this.raza = raza; 42 | } 43 | 44 | public void setEdad(Integer edad) { 45 | this.edad = edad; 46 | } 47 | 48 | public void setTamaño(String tamaño) { 49 | this.tamanio = tamaño; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | return "Perro{" + "nombre: " + nombre + ", raza: " + raza + ", edad: " + edad + ", tamanio: " + tamanio + '}'; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ej01/entidades/Persona.java: -------------------------------------------------------------------------------- 1 | package ej01.entidades; 2 | 3 | public class Persona { 4 | 5 | private String nombre; 6 | private String apellido; 7 | private Integer edad; 8 | private Integer dni; 9 | private Perro perro; 10 | 11 | public Persona() { 12 | } 13 | 14 | public Persona(String nombre, String apellido, Integer edad, Integer dni, Perro perro) { 15 | this.nombre = nombre; 16 | this.apellido = apellido; 17 | this.edad = edad; 18 | this.dni = dni; 19 | this.perro = perro; 20 | } 21 | 22 | public String getNombre() { 23 | return nombre; 24 | } 25 | 26 | public String getApellido() { 27 | return apellido; 28 | } 29 | 30 | public Integer getEdad() { 31 | return edad; 32 | } 33 | 34 | public Integer getDni() { 35 | return dni; 36 | } 37 | 38 | public Perro getPerro() { 39 | return perro; 40 | } 41 | 42 | public void setNombre(String nombre) { 43 | this.nombre = nombre; 44 | } 45 | 46 | public void setApellido(String apellido) { 47 | this.apellido = apellido; 48 | } 49 | 50 | public void setEdad(Integer edad) { 51 | this.edad = edad; 52 | } 53 | 54 | public void setDni(Integer dni) { 55 | this.dni = dni; 56 | } 57 | 58 | public void setPerro(Perro perro) { 59 | this.perro = perro; 60 | } 61 | 62 | @Override 63 | public String toString() { 64 | return "Persona{" + "nombre: " + nombre + ", apellido: " + apellido + ", edad: " + edad + ", dni: " + dni + ", perro: " + perro + '}'; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ej01/servicios/PPServicios.java: -------------------------------------------------------------------------------- 1 | package ej01.servicios; 2 | 3 | import ej01.entidades.Perro; 4 | import ej01.entidades.Persona; 5 | import java.util.Scanner; 6 | 7 | public class PPServicios { 8 | 9 | private Scanner leer = new Scanner(System.in).useDelimiter("\n"); 10 | 11 | public Persona crearPersona() { 12 | Persona a = new Persona(); 13 | System.out.println("Ingrese el nombre de la persona"); 14 | a.setNombre(leer.next()); 15 | System.out.println("Ingrese apellido"); 16 | a.setApellido(leer.next()); 17 | // de la misma forma se ingresan los demas datos 18 | return a; 19 | 20 | } 21 | 22 | public Perro crearPerro() { 23 | Perro b = new Perro(); 24 | System.out.println("Ingrese el nombre del perro"); 25 | b.setNombre(leer.next()); 26 | System.out.println("Ingrese raza"); 27 | b.setRaza(leer.next()); 28 | // de la misma forma se ingresan los demas datos 29 | return b; 30 | 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ej02/Ej02Main.java: -------------------------------------------------------------------------------- 1 | package ej02; 2 | 3 | import ej02.entidades.Juego; 4 | import ej02.entidades.Jugador; 5 | import ej02.entidades.Revolver; 6 | import java.util.ArrayList; 7 | import java.util.Scanner; 8 | 9 | public class Ej02Main { 10 | 11 | private static Scanner leer = new Scanner(System.in).useDelimiter("\n"); 12 | 13 | public static void main(String[] args) { 14 | 15 | ArrayList jugadores = new ArrayList(); 16 | 17 | System.out.println("Se va a iniciar un juego. Seleccione la cantidad de jugadores:"); 18 | int cantidadJugadores = leer.nextInt(); 19 | if (cantidadJugadores<1||cantidadJugadores>6) { 20 | cantidadJugadores=6; 21 | } 22 | for (int i = 0; i < cantidadJugadores; i++) { 23 | Jugador a = new Jugador(i + 1); 24 | jugadores.add(a); 25 | } 26 | 27 | System.out.println("Se va a preparar el revolver para el juego"); 28 | Revolver r = new Revolver(); 29 | r.llenarRevolver(); 30 | 31 | System.out.println("Revolver cargado. Se da inicio al juego"); 32 | Juego j = new Juego(); 33 | j.llenarJuego(jugadores, r); 34 | 35 | boolean juegoSigue = true; 36 | int turno = 0; 37 | while (juegoSigue) { 38 | if (turno == (cantidadJugadores)){ 39 | turno = 0; 40 | } 41 | System.out.println("El " + j.getJugadores().get(turno).getNombre() + " procede a disparar"); 42 | juegoSigue = j.ronda(turno); 43 | if (juegoSigue) { 44 | System.out.println("El " + j.getJugadores().get(turno).getNombre() + " se salva"); 45 | } else { 46 | System.out.println("El " + j.getJugadores().get(turno).getNombre() + " ha sido mojado"); 47 | System.out.println("Juego finalizado"); 48 | } 49 | turno++; 50 | } 51 | System.out.println(""); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ej02/entidades/Juego.java: -------------------------------------------------------------------------------- 1 | package ej02.entidades; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class Juego { 7 | 8 | private Revolver r; 9 | private List jugadores; 10 | 11 | public Juego() { 12 | } 13 | 14 | public Juego(Revolver r, List jugadores) { 15 | this.r = r; 16 | this.jugadores = jugadores; 17 | } 18 | 19 | public Revolver getR() { 20 | return r; 21 | } 22 | 23 | public List getJugadores() { 24 | return jugadores; 25 | } 26 | 27 | public void setR(Revolver r) { 28 | this.r = r; 29 | } 30 | 31 | public void setJugadores(List jugadores) { 32 | this.jugadores = jugadores; 33 | } 34 | 35 | 36 | // METODOS 37 | 38 | public void llenarJuego(ArrayListjs2,Revolver r2){ 39 | jugadores=js2; 40 | r=r2; 41 | } 42 | 43 | public boolean ronda(int i){ 44 | boolean juegoSigue = true; 45 | jugadores.get(i).disparo(r); 46 | if (jugadores.get(i).isMojado()) { 47 | juegoSigue=false; 48 | } 49 | return juegoSigue; 50 | } 51 | 52 | 53 | @Override 54 | public String toString() { 55 | return "Juego{" + "r=" + r + ", j=" + jugadores + '}'; 56 | } 57 | 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ej02/entidades/Jugador.java: -------------------------------------------------------------------------------- 1 | package ej02.entidades; 2 | 3 | public class Jugador { 4 | 5 | private Integer id; 6 | private String nombre; 7 | private boolean mojado; 8 | 9 | public Jugador() { 10 | } 11 | 12 | public Jugador(Integer id) { 13 | this.id = id; 14 | String ids = id.toString(); 15 | ids = "Jugador ".concat(ids); 16 | this.nombre = ids; 17 | this.mojado = false; 18 | } 19 | 20 | public Integer getId() { 21 | return id; 22 | } 23 | 24 | public String getNombre() { 25 | return nombre; 26 | } 27 | 28 | public boolean isMojado() { 29 | return mojado; 30 | } 31 | 32 | public void setId(Integer id) { 33 | this.id = id; 34 | } 35 | 36 | public void setNombre(String nombre) { 37 | this.nombre = nombre; 38 | } 39 | 40 | public void setMojado(boolean mojado) { 41 | this.mojado = mojado; 42 | } 43 | 44 | 45 | 46 | //METODOS 47 | 48 | public boolean disparo(Revolver r){ 49 | boolean vof=false; 50 | if (r.mojar()) { 51 | mojado = true; 52 | vof = true; 53 | } 54 | r.nextChorro(); 55 | return vof; //da valor de verdadero si el jugador se mojo 56 | } 57 | 58 | 59 | @Override 60 | public String toString() { 61 | return "Jugador{" + "id=" + id + ", nombre=" + nombre + ", mojado=" + mojado + '}'; 62 | } 63 | 64 | 65 | 66 | 67 | } 68 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ej02/entidades/Revolver.java: -------------------------------------------------------------------------------- 1 | package ej02.entidades; 2 | 3 | public class Revolver { 4 | 5 | private Integer posicionActual; 6 | private Integer posicionAgua; 7 | 8 | public Revolver() { 9 | } 10 | 11 | public Revolver(Integer posicionActual, Integer posicionAgua) { 12 | this.posicionActual = posicionActual; 13 | this.posicionAgua = posicionAgua; 14 | } 15 | 16 | public Integer getPosicionActual() { 17 | return posicionActual; 18 | } 19 | 20 | public Integer getPosicionAgua() { 21 | return posicionAgua; 22 | } 23 | 24 | public void setPosicionActual(Integer posicionActual) { 25 | this.posicionActual = posicionActual; 26 | } 27 | 28 | public void setPosicionAgua(Integer posicionAgua) { 29 | this.posicionAgua = posicionAgua; 30 | } 31 | 32 | 33 | 34 | //METODOS 35 | 36 | public void llenarRevolver() { 37 | posicionActual = (int) (Math.random() * 6 + 1); 38 | posicionAgua = (int) (Math.random() * 6 + 1); 39 | } 40 | 41 | public boolean mojar(){ 42 | boolean vof = false; 43 | if (posicionActual==posicionAgua) { 44 | vof=true; 45 | } 46 | return vof; 47 | } 48 | 49 | public void nextChorro(){ 50 | if (posicionActual==6) { 51 | posicionActual=1; 52 | }else 53 | posicionActual++; 54 | } 55 | 56 | @Override 57 | public String toString() { 58 | return "Revolver{" + "posicionActual=" + posicionActual + ", posicionAgua=" + posicionAgua + '}'; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ej03/Ej03Main.java: -------------------------------------------------------------------------------- 1 | package ej03; 2 | 3 | import ej03.servicios.BarajaServicio; 4 | 5 | public class Ej03Main { 6 | 7 | public static void main(String[] args) { 8 | BarajaServicio bs = new BarajaServicio(); 9 | 10 | bs.crearBaraja(); 11 | bs.menu(); 12 | 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ej03/entidades/Baraja.java: -------------------------------------------------------------------------------- 1 | package ej03.entidades; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class Baraja { 6 | 7 | private ArrayList cartas; 8 | 9 | public Baraja() { 10 | } 11 | 12 | public Baraja(ArrayList cartas) { 13 | this.cartas = cartas; 14 | } 15 | 16 | public ArrayList getCartas() { 17 | return cartas; 18 | } 19 | 20 | public void setCartas(ArrayList cartas) { 21 | this.cartas = cartas; 22 | } 23 | 24 | @Override 25 | public String toString() { 26 | return "Baraja{" + "cartas=" + cartas + '}'; 27 | } 28 | 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ej03/entidades/Carta.java: -------------------------------------------------------------------------------- 1 | package ej03.entidades; 2 | 3 | import ej03.enums.Palo; 4 | 5 | public class Carta { 6 | 7 | private Integer numero; 8 | private Palo palo; 9 | 10 | public Carta() { 11 | } 12 | 13 | public Carta(Integer numero, Palo palo) { 14 | this.numero = numero; 15 | this.palo = palo; 16 | } 17 | 18 | public Integer getNumero() { 19 | return numero; 20 | } 21 | 22 | public Palo getPalo() { 23 | return palo; 24 | } 25 | 26 | public void setNumero(Integer numero) { 27 | this.numero = numero; 28 | } 29 | 30 | public void setPalo(Palo palo) { 31 | this.palo = palo; 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | return numero + " de " + palo.getNombre(); 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ej03/enums/Palo.java: -------------------------------------------------------------------------------- 1 | package ej03.enums; 2 | 3 | public enum Palo { 4 | ESPADA("Espada"), BASTO("Basto"), ORO("Oro"), COPA("Copa"); 5 | 6 | private String nombre; 7 | 8 | private Palo() { 9 | } 10 | 11 | private Palo(String nombre) { 12 | this.nombre = nombre; 13 | } 14 | 15 | public String getNombre() { 16 | return nombre; 17 | } 18 | 19 | public void setNombre(String nombre) { 20 | this.nombre = nombre; 21 | } 22 | 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ej03/servicios/BarajaServicio.java: -------------------------------------------------------------------------------- 1 | package ej03.servicios; 2 | 3 | import ej03.entidades.Baraja; 4 | import ej03.entidades.Carta; 5 | import ej03.enums.Palo; 6 | import java.util.ArrayList; 7 | import java.util.Collections; 8 | import java.util.Scanner; 9 | 10 | public class BarajaServicio { 11 | 12 | private Baraja mazoInicial = new Baraja(); 13 | private Baraja cartasEntregadas = new Baraja(); 14 | private Scanner leer = new Scanner(System.in).useDelimiter("\n"); 15 | private Collections c; 16 | 17 | public Baraja crearBaraja() { 18 | System.out.println("Se procede a abrir una baraja"); 19 | 20 | ArrayList cs = new ArrayList(); 21 | ArrayList out = new ArrayList(); 22 | cartasEntregadas.setCartas(out); 23 | 24 | for (Palo aux : Palo.values()) { 25 | String p = aux.getNombre(); 26 | for (int i = 0; i < 12; i++) { 27 | if (i + 1 == 8 || i + 1 == 9) { 28 | //NADA 29 | } else { 30 | Carta c = new Carta(i + 1, aux); 31 | cs.add(c); 32 | } 33 | } 34 | } 35 | mazoInicial.setCartas(cs); 36 | System.out.println("Baraja iniciada"); 37 | 38 | return mazoInicial; 39 | } 40 | 41 | public void barajar() { 42 | c.shuffle(mazoInicial.getCartas()); 43 | } 44 | 45 | public Carta siguienteCarta() { 46 | Carta c = mazoInicial.getCartas().get(0); 47 | System.out.println("La siguiente carta es el " + mazoInicial.getCartas().get(0).toString()); 48 | return c; 49 | } 50 | 51 | public void cartasDisponibles() { 52 | System.out.println("Cartas disponibles: " + mazoInicial.getCartas().size()); 53 | } 54 | 55 | public void darCartas() { 56 | System.out.println("Seleccione la cantidad de cartas a recibir: "); 57 | int cant = leer.nextInt(); 58 | 59 | if (cant <= mazoInicial.getCartas().size()) { 60 | for (int i = 0; i < cant; i++) { 61 | System.out.println("se entrega el " + mazoInicial.getCartas().get(i).toString() + " al jugador"); 62 | } 63 | for (int i = 0; i < cant; i++) { 64 | cartasEntregadas.getCartas().add(mazoInicial.getCartas().get(0)); 65 | mazoInicial.getCartas().remove(0); 66 | } 67 | } else { 68 | System.out.println("Cartas insuficientes. No se entregó ninguna carta al jugador"); 69 | cartasDisponibles(); 70 | } 71 | } 72 | 73 | public void cartasMonton() { 74 | if (cartasEntregadas.getCartas().size() == 0) { 75 | System.out.println("Aún no se han retirado cartas del mazo"); 76 | } else { 77 | System.out.println("Cartas retiradas (del montón): "); 78 | String parrafo = ""; 79 | int ctrol = 0; 80 | for (Object aux : cartasEntregadas.getCartas()) { 81 | parrafo = parrafo.concat(aux.toString()); 82 | parrafo = parrafo.concat(". "); 83 | ctrol++; 84 | if (ctrol == 10) { 85 | System.out.println(parrafo); 86 | parrafo = ""; 87 | ctrol = 0; 88 | } 89 | } 90 | } 91 | } 92 | 93 | public void mostrarBaraja() { 94 | if (mazoInicial.getCartas().size() == 0) { 95 | System.out.println("No quedan cartas en el mazo"); 96 | } else { 97 | System.out.println("Cartas del mazo: "); 98 | String parrafo = ""; 99 | int ctrol = 0; 100 | for (Object aux : mazoInicial.getCartas()) { 101 | parrafo = parrafo.concat(aux.toString()); 102 | parrafo = parrafo.concat(". "); 103 | ctrol++; 104 | if (ctrol == 10) { 105 | System.out.println(parrafo); 106 | parrafo = ""; 107 | ctrol = 0; 108 | } 109 | } 110 | } 111 | } 112 | 113 | public void menu() { 114 | System.out.println(""); 115 | System.out.println("----- MENU -----"); 116 | System.out.println("Seleccione una opción: "); 117 | System.out.println("1. Barajar el mazo"); 118 | System.out.println("2. Ver siguiente carta"); 119 | System.out.println("3. Pedir cartas"); 120 | System.out.println("4. Ver cartas ya usadas"); 121 | System.out.println("5. Ver cartas aún en el mazo"); 122 | System.out.println("6. Salir del programa"); 123 | System.out.println(""); 124 | String opc = leer.next(); 125 | switch (opc) { 126 | case "1": 127 | barajar(); 128 | System.out.println("Mazo barajado"); 129 | menu(); 130 | break; 131 | case "2": 132 | siguienteCarta(); 133 | menu(); 134 | break; 135 | case "3": 136 | darCartas(); 137 | menu(); 138 | break; 139 | case "4": 140 | cartasMonton(); 141 | menu(); 142 | break; 143 | case "5": 144 | mostrarBaraja(); 145 | menu(); 146 | break; 147 | case "6": 148 | System.out.println("Ejecución finalizada"); 149 | break; 150 | default: 151 | System.out.println("Opcion no válida"); 152 | ; 153 | menu(); 154 | } 155 | 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ejC02/EjC02Main.java: -------------------------------------------------------------------------------- 1 | package ejC02; 2 | 3 | import ejC02.entidades.Cine; 4 | import ejC02.entidades.Espectador; 5 | import ejC02.servicios.CineServicio; 6 | import java.util.ArrayList; 7 | 8 | public class EjC02Main { 9 | 10 | public static void main(String[] args) { 11 | 12 | CineServicio cs = new CineServicio(); 13 | 14 | Cine c = cs.abrirCine(); 15 | ArrayList e = cs.crearPosiblesEspectadores(); 16 | cs.recibirPosiblesEspectadores(c, e); 17 | cs.verSala(c); 18 | cs.revisarEspectadores(c); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ejC02/entidades/Asiento.java: -------------------------------------------------------------------------------- 1 | package ejC02.entidades; 2 | 3 | 4 | public class Asiento { 5 | 6 | private String ubicacion; 7 | private Espectador e; 8 | 9 | public Asiento() { 10 | } 11 | 12 | public Asiento(String ubicacion, Espectador e) { 13 | this.ubicacion = ubicacion; 14 | this.e = e; 15 | } 16 | 17 | public String getUbicacion() { 18 | return ubicacion; 19 | } 20 | 21 | public Espectador getE() { 22 | return e; 23 | } 24 | 25 | public void setUbicacion(String ubicacion) { 26 | this.ubicacion = ubicacion; 27 | } 28 | 29 | public void setE(Espectador e) { 30 | this.e = e; 31 | } 32 | 33 | @Override 34 | public String toString() { 35 | String s = ubicacion.toString(); 36 | if (e == null) { 37 | s = s.concat(" |") ; 38 | } else{ 39 | s=s.concat(" X |"); 40 | } 41 | return s; 42 | } 43 | 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ejC02/entidades/Cine.java: -------------------------------------------------------------------------------- 1 | package ejC02.entidades; 2 | 3 | import java.util.List; 4 | 5 | public class Cine { 6 | 7 | private Asiento sala[][]; 8 | private List asientosLibres; 9 | private Pelicula pelicula; 10 | private Integer precio; 11 | 12 | public Cine() { 13 | } 14 | 15 | public Cine(Asiento[][] sala, List asientosLibres, Pelicula pelicula, Integer precio) { 16 | this.sala = sala; 17 | this.asientosLibres = asientosLibres; 18 | this.pelicula = pelicula; 19 | this.precio = precio; 20 | } 21 | 22 | public Asiento[][] getSala() { 23 | return sala; 24 | } 25 | 26 | public List getAsientosLibres() { 27 | return asientosLibres; 28 | } 29 | 30 | public Pelicula getPelicula() { 31 | return pelicula; 32 | } 33 | 34 | public Integer getPrecio() { 35 | return precio; 36 | } 37 | 38 | public void setSala(Asiento[][] sala) { 39 | this.sala = sala; 40 | } 41 | 42 | public void setAsientosLibres(List asientosLibres) { 43 | this.asientosLibres = asientosLibres; 44 | } 45 | 46 | public void setPelicula(Pelicula pelicula) { 47 | this.pelicula = pelicula; 48 | } 49 | 50 | public void setPrecio(Integer precio) { 51 | this.precio = precio; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return "Cine{" + "sala=" + sala + ", asientosLibres=" + asientosLibres + ", pelicula=" + pelicula + ", precio=" + precio ; 57 | } 58 | 59 | 60 | 61 | } 62 | 63 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ejC02/entidades/Espectador.java: -------------------------------------------------------------------------------- 1 | package ejC02.entidades; 2 | 3 | public class Espectador { 4 | 5 | private String nombre; 6 | private Integer edad; 7 | private Integer dinero; 8 | 9 | public Espectador() { 10 | } 11 | 12 | public Espectador(String nombre, Integer edad, Integer dinero) { 13 | this.nombre = nombre; 14 | this.edad = edad; 15 | this.dinero = dinero; 16 | } 17 | 18 | public String getNombre() { 19 | return nombre; 20 | } 21 | 22 | public Integer getEdad() { 23 | return edad; 24 | } 25 | 26 | public Integer getDinero() { 27 | return dinero; 28 | } 29 | 30 | public void setNombre(String nombre) { 31 | this.nombre = nombre; 32 | } 33 | 34 | public void setEdad(Integer edad) { 35 | this.edad = edad; 36 | } 37 | 38 | public void setDinero(Integer dinero) { 39 | this.dinero = dinero; 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return "Nombre: " + nombre + ", edad: " + edad + ", dinero: " + dinero; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ejC02/entidades/Pelicula.java: -------------------------------------------------------------------------------- 1 | package ejC02.entidades; 2 | 3 | public class Pelicula { 4 | private String titulo; 5 | private Integer duracionEnMinutos; 6 | private Integer edadMinima; 7 | private String Director; 8 | 9 | public Pelicula() { 10 | } 11 | 12 | public Pelicula(String titulo, Integer duracionEnMinutos, Integer edadMinima, String Director) { 13 | this.titulo = titulo; 14 | this.duracionEnMinutos = duracionEnMinutos; 15 | this.edadMinima = edadMinima; 16 | this.Director = Director; 17 | } 18 | 19 | public String getTitulo() { 20 | return titulo; 21 | } 22 | 23 | public Integer getDuracionEnMinutos() { 24 | return duracionEnMinutos; 25 | } 26 | 27 | public Integer getEdadMinima() { 28 | return edadMinima; 29 | } 30 | 31 | public String getDirector() { 32 | return Director; 33 | } 34 | 35 | public void setTitulo(String titulo) { 36 | this.titulo = titulo; 37 | } 38 | 39 | public void setDuracionEnMinutos(Integer duracionEnMinutos) { 40 | this.duracionEnMinutos = duracionEnMinutos; 41 | } 42 | 43 | public void setEdadMinima(Integer edadMinima) { 44 | this.edadMinima = edadMinima; 45 | } 46 | 47 | public void setDirector(String Director) { 48 | this.Director = Director; 49 | } 50 | 51 | @Override 52 | public String toString() { 53 | return "Pelicula{" + "titulo=" + titulo + ", duracionEnMinutos=" + duracionEnMinutos + ", edadMinima=" + edadMinima + ", Director=" + Director + '}'; 54 | } 55 | 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ejC02/enums/Columna.java: -------------------------------------------------------------------------------- 1 | package ejC02.enums; 2 | 3 | public enum Columna { 4 | 5 | A(0),B(1),C(2),D(3),E(4),F(5); 6 | 7 | private int posicion; 8 | 9 | private Columna() { 10 | } 11 | 12 | private Columna(int posicion) { 13 | this.posicion = posicion; 14 | } 15 | 16 | public int getPosicion() { 17 | return posicion; 18 | } 19 | 20 | public void setPosicion(int posicion) { 21 | this.posicion = posicion; 22 | } 23 | 24 | 25 | 26 | 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /EjemploRelaciones/src/ejC02/servicios/CineServicio.java: -------------------------------------------------------------------------------- 1 | package ejC02.servicios; 2 | 3 | import ejC02.entidades.Cine; 4 | import ejC02.entidades.Espectador; 5 | import ejC02.entidades.Pelicula; 6 | import ejC02.entidades.Asiento; 7 | import ejC02.enums.Columna; 8 | import java.util.ArrayList; 9 | import java.util.Scanner; 10 | //import java.util.Scanner; 11 | 12 | public class CineServicio { 13 | 14 | private Scanner leer = new Scanner(System.in).useDelimiter("\n"); 15 | // private Scanner leer = new Scanner(System.in).useDelimiter("\n"); 16 | //SE ABRE UN CINE CON UNA PELICULA Y PRECIO PREVIAMENTE ESTABLECIDOS, Y TODOS LOS ASIENTOS VACIOS 17 | 18 | public Cine abrirCine() { 19 | Cine c = new Cine(); 20 | c.setPelicula(new Pelicula("El Hobbit", 185, 18, "Fulano de Tal")); 21 | c.setPrecio(110); 22 | 23 | Asiento s[][] = new Asiento[8][6]; 24 | for (int i = 0; i < 8; i++) { 25 | for (int j = 0; j < 6; j++) { 26 | Integer a = 8 - i; 27 | String b = a.toString(); 28 | switch (j) { 29 | case 0: 30 | b = b.concat("A"); 31 | break; 32 | case 1: 33 | b = b.concat("B"); 34 | break; 35 | case 2: 36 | b = b.concat("C"); 37 | break; 38 | case 3: 39 | b = b.concat("D"); 40 | break; 41 | case 4: 42 | b = b.concat("E"); 43 | break; 44 | case 5: 45 | b = b.concat("F"); 46 | break; 47 | default: 48 | throw new AssertionError(); 49 | } 50 | s[i][j] = new Asiento(b, null); 51 | } 52 | } 53 | c.setSala(s); 54 | 55 | ArrayList a = new ArrayList(); 56 | for (int i = 0; i < 8; i++) { 57 | for (Columna aux : Columna.values()) { 58 | String asiento = (8 - i) + aux.toString(); 59 | a.add(asiento); 60 | } 61 | } 62 | c.setAsientosLibres(a); 63 | 64 | return c; 65 | 66 | } 67 | 68 | // MENU PARA CAMBIAR PELICULA Y PRECIO DEL CINE 69 | public Cine modificarCine(Cine c) { 70 | System.out.println("----- MENU CINE -----"); 71 | System.out.println("en desarrollo"); 72 | //incluir opciones de cambio de pelicula y precio de entrada 73 | return c; 74 | } 75 | 76 | // SE CREA UN UNIVERSO DE POSIBLES ESPECTADORES QUE INTENTARAN INGRESAR AL CINE 77 | public ArrayList crearPosiblesEspectadores() { 78 | ArrayList interesados = new ArrayList(); 79 | int cantidad = 25 + (int) (Math.random() * 60); 80 | for (int i = 0; i < cantidad; i++) { 81 | Espectador e = new Espectador("Interesado " + (i + 1), (int) (Math.random() * 70), (int) (Math.random() * 1000)); 82 | interesados.add(e); 83 | } 84 | System.out.println("Cantidad de posibles espectadores: " + interesados.size()); 85 | return interesados; 86 | 87 | } 88 | 89 | // SE CONTROLAN LOS INTERESADOS Y SE COBRA Y ASIGNA UN ASIENTO DE CORRESPONDER 90 | public Cine recibirPosiblesEspectadores(Cine c, ArrayList interesados) { 91 | int rechazos = 0; 92 | int recibidos = 0; 93 | for (Espectador aux : interesados) { 94 | if (aux.getEdad() >= c.getPelicula().getEdadMinima() && aux.getDinero() >= c.getPrecio() && c.getAsientosLibres().size() > 0) { 95 | //resta dinero al visitante 96 | aux.setDinero(aux.getDinero() - c.getPrecio()); 97 | //selecciona un lugar para ubicarlo 98 | int posicionLista = (int) (Math.random() * c.getAsientosLibres().size()); 99 | String ubicacion = c.getAsientosLibres().get(posicionLista); 100 | c.getAsientosLibres().remove(posicionLista); 101 | 102 | Asiento visual[][] = c.getSala(); 103 | for (int i = 0; i < 8; i++) { 104 | for (int j = 0; j < 6; j++) { 105 | if (visual[i][j].getUbicacion().equalsIgnoreCase(ubicacion)) { 106 | visual[i][j].setE(aux); 107 | } 108 | } 109 | } 110 | recibidos++; 111 | } else { 112 | rechazos++; 113 | } 114 | } 115 | System.out.println("Espectadores recibidos: " + recibidos); 116 | System.out.println("Recaudación de la funcion: " + recibidos * c.getPrecio()); 117 | System.out.println("Ingresos rechazados por falta de edad, dinero o capacidad de sala agotada: " + rechazos); 118 | return c; 119 | } 120 | 121 | // SE VISUALISA EL SUMARIO DE LA FUNCION 122 | public void verSala(Cine c) { 123 | System.out.println(""); 124 | System.out.println("Pelicula: " + c.getPelicula().getTitulo()); 125 | System.out.println("Duración: " + c.getPelicula().getDuracionEnMinutos() + " minutos"); 126 | System.out.println("Estado de la sala durante la función: "); 127 | Asiento visual[][] = c.getSala(); 128 | for (int i = 0; i < 8; i++) { 129 | for (int j = 0; j < 6; j++) { 130 | System.out.print(visual[i][j].toString()); 131 | } 132 | System.out.println(""); 133 | } 134 | System.out.println(""); 135 | } 136 | 137 | public void revisarEspectadores(Cine c) { 138 | Asiento visual[][] = c.getSala(); 139 | int ctrol = 0; 140 | System.out.println("Seleccione un asiento para visualizar la información del espectador: "); 141 | String asientoABuscar = leer.next(); 142 | for (int i = 0; i < 8; i++) { 143 | for (int j = 0; j < 6; j++) { 144 | if (visual[i][j].getUbicacion().equalsIgnoreCase(asientoABuscar)) { 145 | ctrol++; 146 | System.out.println("Información del espectador ubicado en "+visual[i][j].getUbicacion()); 147 | System.out.println(visual[i][j].getE().toString()); 148 | break; 149 | } 150 | } 151 | } 152 | 153 | if (ctrol == 0) { 154 | System.out.println("Asiento invalido. Ingrese una posición válida"); 155 | revisarEspectadores(c); 156 | } 157 | System.out.println("Desea consultar otro asiento? s/n"); 158 | String opc = leer.next(); 159 | if (opc.equalsIgnoreCase("s")) { 160 | revisarEspectadores(c); 161 | } 162 | } 163 | 164 | } 165 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Java-Relaciones 2 | -------------------------------------------------------------------------------- /Relaciones/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Builds, tests, and runs the project Relaciones. 12 | 13 | 73 | 74 | -------------------------------------------------------------------------------- /Relaciones/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /Relaciones/nbproject/build-impl.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | Must set src.dir 234 | Must set test.src.dir 235 | Must set build.dir 236 | Must set dist.dir 237 | Must set build.classes.dir 238 | Must set dist.javadoc.dir 239 | Must set build.test.classes.dir 240 | Must set build.test.results.dir 241 | Must set build.classes.excludes 242 | Must set dist.jar 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | Must set javac.includes 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | No tests executed. 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | Must set JVM to use for profiling in profiler.info.jvm 723 | Must set profiler agent JVM arguments in profiler.info.jvmargs.agent 724 | 725 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 951 | Must select some files in the IDE or set javac.includes 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | To run this application from the command line without Ant, try: 1002 | 1003 | java -jar "${dist.jar.resolved}" 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1039 | 1040 | 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 | 1048 | 1049 | 1050 | Must select one file in the IDE or set run.class 1051 | 1052 | 1053 | 1054 | Must select one file in the IDE or set run.class 1055 | 1056 | 1057 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | Must select one file in the IDE or set debug.class 1082 | 1083 | 1084 | 1085 | 1086 | Must select one file in the IDE or set debug.class 1087 | 1088 | 1089 | 1090 | 1091 | Must set fix.includes 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1103 | 1106 | 1107 | This target only works when run from inside the NetBeans IDE. 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | Must select one file in the IDE or set profile.class 1117 | This target only works when run from inside the NetBeans IDE. 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | This target only works when run from inside the NetBeans IDE. 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | This target only works when run from inside the NetBeans IDE. 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1152 | 1153 | 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1164 | 1165 | 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | 1175 | 1176 | 1177 | Must select one file in the IDE or set run.class 1178 | 1179 | 1180 | 1181 | 1182 | 1183 | Must select some files in the IDE or set test.includes 1184 | 1185 | 1186 | 1187 | 1188 | Must select one file in the IDE or set run.class 1189 | 1190 | 1191 | 1192 | 1193 | Must select one file in the IDE or set applet.url 1194 | 1195 | 1196 | 1197 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | 1215 | 1216 | 1217 | 1218 | 1219 | 1220 | 1221 | 1222 | 1223 | 1224 | 1225 | 1226 | 1227 | 1228 | 1229 | 1230 | 1231 | 1232 | 1233 | 1234 | 1235 | 1236 | 1237 | 1238 | 1239 | 1240 | 1241 | 1246 | 1247 | 1248 | 1249 | 1250 | 1251 | 1252 | 1253 | 1254 | 1255 | 1256 | 1257 | 1258 | 1259 | 1260 | 1261 | 1262 | 1263 | 1264 | 1265 | 1266 | 1267 | 1268 | 1269 | 1270 | 1271 | 1272 | Must select some files in the IDE or set javac.includes 1273 | 1274 | 1275 | 1276 | 1277 | 1278 | 1279 | 1280 | 1281 | 1282 | 1283 | 1284 | 1289 | 1290 | 1291 | 1292 | 1293 | 1294 | 1295 | 1296 | Some tests failed; see details above. 1297 | 1298 | 1299 | 1300 | 1301 | 1302 | 1303 | 1304 | 1305 | Must select some files in the IDE or set test.includes 1306 | 1307 | 1308 | 1309 | Some tests failed; see details above. 1310 | 1311 | 1312 | 1313 | Must select some files in the IDE or set test.class 1314 | Must select some method in the IDE or set test.method 1315 | 1316 | 1317 | 1318 | Some tests failed; see details above. 1319 | 1320 | 1321 | 1326 | 1327 | Must select one file in the IDE or set test.class 1328 | 1329 | 1330 | 1331 | Must select one file in the IDE or set test.class 1332 | Must select some method in the IDE or set test.method 1333 | 1334 | 1335 | 1336 | 1337 | 1338 | 1339 | 1340 | 1341 | 1342 | 1343 | 1344 | 1349 | 1350 | Must select one file in the IDE or set applet.url 1351 | 1352 | 1353 | 1354 | 1355 | 1356 | 1357 | 1362 | 1363 | Must select one file in the IDE or set applet.url 1364 | 1365 | 1366 | 1367 | 1368 | 1369 | 1370 | 1371 | 1376 | 1377 | 1378 | 1379 | 1380 | 1381 | 1382 | 1383 | 1384 | 1385 | 1386 | 1387 | 1388 | 1389 | 1390 | 1391 | 1392 | 1393 | 1394 | 1395 | 1396 | 1397 | 1398 | 1399 | 1400 | 1401 | 1402 | 1403 | 1404 | 1405 | 1406 | 1407 | 1408 | 1409 | 1410 | 1411 | 1412 | 1413 | 1414 | 1415 | 1416 | 1417 | 1418 | 1419 | 1420 | 1421 | -------------------------------------------------------------------------------- /Relaciones/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=49d3423b 2 | build.xml.script.CRC32=7a9d0e19 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=49d3423b 7 | nbproject/build-impl.xml.script.CRC32=d58c3777 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /Relaciones/nbproject/private/private.properties: -------------------------------------------------------------------------------- 1 | compile.on.save=true 2 | user.properties.file=C:\\Users\\AsteriX\\AppData\\Roaming\\NetBeans\\8.2\\build.properties 3 | -------------------------------------------------------------------------------- /Relaciones/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/Relaciones.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=relaciones.Relaciones 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /Relaciones/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | Relaciones 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Relaciones/src/relaciones/Relaciones.java: -------------------------------------------------------------------------------- 1 | package relaciones; 2 | 3 | public class Relaciones { 4 | 5 | public static void main(String[] args) { 6 | // TODO code application logic here 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /Relaciones/src/relaciones/agregacion/Cliente.java: -------------------------------------------------------------------------------- 1 | package relaciones.agregacion; 2 | 3 | public class Cliente { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Relaciones/src/relaciones/agregacion/Empresa.java: -------------------------------------------------------------------------------- 1 | package relaciones.agregacion; 2 | 3 | import relaciones.agregacion.Cliente; 4 | import java.util.List; 5 | 6 | public class Empresa { 7 | 8 | private List clientes; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /Relaciones/src/relaciones/composicion/Empleado.java: -------------------------------------------------------------------------------- 1 | package relaciones.composicion; 2 | 3 | public class Empleado { 4 | 5 | //Attr 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Relaciones/src/relaciones/composicion/Empresa.java: -------------------------------------------------------------------------------- 1 | package relaciones.composicion; 2 | 3 | import java.util.List; 4 | 5 | public class Empresa { 6 | 7 | private List empleados; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /Relaciones/src/relaciones/inversa/Auto.java: -------------------------------------------------------------------------------- 1 | package relaciones.inversa; 2 | 3 | public class Auto { 4 | 5 | private Persona propietario; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Relaciones/src/relaciones/inversa/Persona.java: -------------------------------------------------------------------------------- 1 | package relaciones.inversa; 2 | 3 | import java.util.List; 4 | 5 | public class Persona { 6 | 7 | private List autos; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /Relaciones/src/relaciones/reflexiva/Nodo.java: -------------------------------------------------------------------------------- 1 | package relaciones.reflexiva; 2 | 3 | public class Nodo { 4 | 5 | private String value; 6 | private Nodo next; 7 | 8 | } 9 | -------------------------------------------------------------------------------- /Relaciones/src/relaciones/reflexiva/Persona.java: -------------------------------------------------------------------------------- 1 | package relaciones.reflexiva; 2 | 3 | import java.util.List; 4 | 5 | public class Persona { 6 | 7 | private List amigos; 8 | 9 | } 10 | --------------------------------------------------------------------------------