001 package edu.nrao.sss.model.resource; 002 003 import static edu.nrao.sss.measure.FrequencyUnits.GIGAHERTZ; 004 import static edu.nrao.sss.measure.FrequencyUnits.MEGAHERTZ; 005 import static edu.nrao.sss.model.resource.TelescopeType.*; 006 007 import java.util.ArrayList; 008 import java.util.List; 009 010 import edu.nrao.sss.measure.Frequency; 011 import edu.nrao.sss.measure.FrequencyRange; 012 import edu.nrao.sss.util.EnumerationUtility; 013 014 /** 015 * The receiver bands of NRAO (and other) telescopes. 016 * <p> 017 * <b>Version Info:</b> 018 * <table style="margin-left:2em"> 019 * <tr><td>$Revision: 1995 $</td></tr> 020 * <tr><td>$Date: 2009-02-23 09:18:41 -0700 (Mon, 23 Feb 2009) $</td></tr> 021 * <tr><td>$Author: dharland $ (last person to modify)</td></tr> 022 * </table></p> 023 * 024 * @author David M. Harland 025 * @since 2007-09-07 026 */ 027 public enum ReceiverBand 028 { 029 //The reason we have the initFreqRange methods, as opposed to just 030 //initializing the elements at construction, is to keep from 031 //unnecessarily creating a FrequencyRange and two Frequency 032 //objects for each element. Most use cases will involve only 033 //one or two telescopes at a time, so this is just a way of 034 //keeping the memory footprint from growing unnecessarily. 035 036 /** ALMA Receiver band 01. */ 037 ALMA_RB_01(null, null, ALMA) 038 { 039 void initFreqRanges() 040 { 041 frequencyRange = new FrequencyRange(); //TODO real values 042 extendedRanges = new ArrayList<NamedRangeImpl>(); 043 } 044 }, 045 046 /** ALMA Receiver band 02. */ 047 ALMA_RB_02(null, null, ALMA) 048 { 049 void initFreqRanges() 050 { 051 frequencyRange = new FrequencyRange(); //TODO real values 052 extendedRanges = new ArrayList<NamedRangeImpl>(); 053 } 054 }, 055 056 /** ALMA Receiver band 03. */ 057 ALMA_RB_03(null, null, ALMA) 058 { 059 void initFreqRanges() 060 { 061 frequencyRange = new FrequencyRange(); //TODO real values 062 extendedRanges = new ArrayList<NamedRangeImpl>(); 063 } 064 }, 065 066 /** ALMA Receiver band 04. */ 067 ALMA_RB_04(null, null, ALMA) 068 { 069 void initFreqRanges() 070 { 071 frequencyRange = new FrequencyRange(); //TODO real values 072 extendedRanges = new ArrayList<NamedRangeImpl>(); 073 } 074 }, 075 076 /** ALMA Receiver band 05. */ 077 ALMA_RB_05(null, null, ALMA) 078 { 079 void initFreqRanges() 080 { 081 frequencyRange = new FrequencyRange(); //TODO real values 082 extendedRanges = new ArrayList<NamedRangeImpl>(); 083 } 084 }, 085 086 /** ALMA Receiver band 06. */ 087 ALMA_RB_06(null, null, ALMA) 088 { 089 void initFreqRanges() 090 { 091 frequencyRange = new FrequencyRange(); //TODO real values 092 extendedRanges = new ArrayList<NamedRangeImpl>(); 093 } 094 }, 095 096 /** ALMA Receiver band 07. */ 097 ALMA_RB_07(null, null, ALMA) 098 { 099 void initFreqRanges() 100 { 101 frequencyRange = new FrequencyRange(); //TODO real values 102 extendedRanges = new ArrayList<NamedRangeImpl>(); 103 } 104 }, 105 106 /** ALMA Receiver band 08. */ 107 ALMA_RB_08(null, null, ALMA) 108 { 109 void initFreqRanges() 110 { 111 frequencyRange = new FrequencyRange(); //TODO real values 112 extendedRanges = new ArrayList<NamedRangeImpl>(); 113 } 114 }, 115 116 /** ALMA Receiver band 09. */ 117 ALMA_RB_09(null, null, ALMA) 118 { 119 void initFreqRanges() 120 { 121 frequencyRange = new FrequencyRange(); //TODO real values 122 extendedRanges = new ArrayList<NamedRangeImpl>(); 123 } 124 }, 125 126 /** ALMA Receiver band 10. */ 127 ALMA_RB_10(null, null, ALMA) 128 { 129 void initFreqRanges() 130 { 131 frequencyRange = new FrequencyRange(); //TODO real values 132 extendedRanges = new ArrayList<NamedRangeImpl>(); 133 } 134 }, 135 136 /** Alma transmitter Holography receiver. */ 137 ALMA_HOLOGRAPHY_RECEIVER(null, null, ALMA) 138 { 139 void initFreqRanges() 140 { 141 frequencyRange = new FrequencyRange(); //TODO real values 142 extendedRanges = new ArrayList<NamedRangeImpl>(); 143 } 144 }, 145 146 /** Plateau de Bure receiver band #1. */ 147 BURE_01(null, null, OTHER) 148 { 149 void initFreqRanges() 150 { 151 frequencyRange = new FrequencyRange(); //TODO real values 152 extendedRanges = new ArrayList<NamedRangeImpl>(); 153 } 154 }, 155 156 /** Plateau de Bure receiver band #2. */ 157 BURE_02(null, null, OTHER) 158 { 159 void initFreqRanges() 160 { 161 frequencyRange = new FrequencyRange(); //TODO real values 162 extendedRanges = new ArrayList<NamedRangeImpl>(); 163 } 164 }, 165 166 /** Plateau de Bure receiver band #3. */ 167 BURE_03(null, null, OTHER) 168 { 169 void initFreqRanges() 170 { 171 frequencyRange = new FrequencyRange(); //TODO real values 172 extendedRanges = new ArrayList<NamedRangeImpl>(); 173 } 174 }, 175 176 /** Plateau de Bure receiver band #4. */ 177 BURE_04(null, null, OTHER) 178 { 179 void initFreqRanges() 180 { 181 frequencyRange = new FrequencyRange(); //TODO real values 182 extendedRanges = new ArrayList<NamedRangeImpl>(); 183 } 184 }, 185 186 /** EVLA's 4 Band receiver; 73.0 - 74.5 MHz. */ 187 EVLA_4("4", "75MHz", EVLA) 188 { 189 void initFreqRanges() 190 { 191 frequencyRange = new FrequencyRange(new Frequency("73.0", MEGAHERTZ), 192 new Frequency("74.5", MEGAHERTZ)); 193 extendedRanges = new ArrayList<NamedRangeImpl>(); 194 } 195 }, 196 197 /** EVLA's P Band receiver; 300.0 - 340.5 MHz. */ 198 EVLA_P("P", "300MHz", EVLA) 199 { 200 void initFreqRanges() 201 { 202 frequencyRange = new FrequencyRange(new Frequency("300.0", MEGAHERTZ), 203 new Frequency("340.5", MEGAHERTZ)); 204 extendedRanges = new ArrayList<NamedRangeImpl>(); 205 } 206 }, 207 208 /** EVLA's L Band receiver; 1.2 - 2.0 GHz. */ 209 EVLA_L("L", "1.5GHz", EVLA) 210 { 211 void initFreqRanges() 212 { 213 frequencyRange = new FrequencyRange(new Frequency("1.2", GIGAHERTZ), 214 new Frequency("2.0", GIGAHERTZ)); 215 216 extendedRanges = new ArrayList<NamedRangeImpl>(); 217 218 extendedRanges.add(new NamedRangeImpl("1-dB", 219 new FrequencyRange(new Frequency("0.90", GIGAHERTZ), 220 new Frequency("2.00", GIGAHERTZ)))); 221 222 extendedRanges.add(new NamedRangeImpl("3-dB", 223 new FrequencyRange(new Frequency("0.80", GIGAHERTZ), 224 new Frequency("2.10", GIGAHERTZ)))); 225 } 226 }, 227 228 /** EVLA's S Band receiver; 2.0 - 4.0 GHz. */ 229 EVLA_S("S", "3GHz", EVLA) 230 { 231 void initFreqRanges() 232 { 233 frequencyRange = new FrequencyRange(new Frequency("2.0", GIGAHERTZ), 234 new Frequency("4.0", GIGAHERTZ)); 235 236 extendedRanges = new ArrayList<NamedRangeImpl>(); 237 /* 238 extendedRanges.add(new NamedRangeImpl("1-dB", 239 new FrequencyRange(new Frequency("2.00", GIGAHERTZ), 240 new Frequency("4.00", GIGAHERTZ)))); 241 */ 242 extendedRanges.add(new NamedRangeImpl("3-dB", 243 new FrequencyRange(new Frequency("1.85", GIGAHERTZ), 244 new Frequency("4.15", GIGAHERTZ)))); 245 } 246 }, 247 248 /** EVLA's C Band receiver; 4.0 - 8.0 GHz. */ 249 EVLA_C("C", "6GHz", EVLA) 250 { 251 void initFreqRanges() 252 { 253 frequencyRange = new FrequencyRange(new Frequency("4.0", GIGAHERTZ), 254 new Frequency("8.0", GIGAHERTZ)); 255 256 extendedRanges = new ArrayList<NamedRangeImpl>(); 257 /* 258 extendedRanges.add(new NamedRangeImpl("1-dB", 259 new FrequencyRange(new Frequency("4.00", GIGAHERTZ), 260 new Frequency("8.00", GIGAHERTZ)))); 261 */ 262 extendedRanges.add(new NamedRangeImpl("3-dB", 263 new FrequencyRange(new Frequency("3.80", GIGAHERTZ), 264 new Frequency("8.20", GIGAHERTZ)))); 265 } 266 }, 267 268 /** EVLA's X Band receiver; 8.0 - 12.0 GHz. */ 269 EVLA_X("X", "10GHz", EVLA) 270 { 271 void initFreqRanges() 272 { 273 frequencyRange = new FrequencyRange(new Frequency( "8.0", GIGAHERTZ), 274 new Frequency("12.0", GIGAHERTZ)); 275 276 extendedRanges = new ArrayList<NamedRangeImpl>(); 277 278 extendedRanges.add(new NamedRangeImpl("1-dB", 279 new FrequencyRange(new Frequency( "8.00", GIGAHERTZ), 280 new Frequency("12.40", GIGAHERTZ)))); 281 282 extendedRanges.add(new NamedRangeImpl("3-dB", 283 new FrequencyRange(new Frequency( "7.70", GIGAHERTZ), 284 new Frequency("12.60", GIGAHERTZ)))); 285 } 286 }, 287 288 /** EVLA's Ku Band receiver; 12.0 - 18.0 GHz. */ 289 EVLA_Ku("Ku", "15GHz", EVLA) 290 { 291 void initFreqRanges() 292 { 293 frequencyRange = new FrequencyRange(new Frequency("12.0", GIGAHERTZ), 294 new Frequency("18.0", GIGAHERTZ)); 295 296 extendedRanges = new ArrayList<NamedRangeImpl>(); 297 /* 298 extendedRanges.add(new NamedRangeImpl("1-dB", 299 new FrequencyRange(new Frequency("12.00", GIGAHERTZ), 300 new Frequency("18.00", GIGAHERTZ)))); 301 */ 302 extendedRanges.add(new NamedRangeImpl("3-dB", 303 new FrequencyRange(new Frequency("11.65", GIGAHERTZ), 304 new Frequency("18.35", GIGAHERTZ)))); 305 } 306 }, 307 308 /** EVLA's K Band receiver; 18.0 - 26.5 GHz. */ 309 EVLA_K("K", "22GHz", EVLA) 310 { 311 void initFreqRanges() 312 { 313 frequencyRange = new FrequencyRange(new Frequency("18.0", GIGAHERTZ), 314 new Frequency("26.5", GIGAHERTZ)); 315 316 extendedRanges = new ArrayList<NamedRangeImpl>(); 317 /* 318 extendedRanges.add(new NamedRangeImpl("1-dB", 319 new FrequencyRange(new Frequency("18.00", GIGAHERTZ), 320 new Frequency("26.50", GIGAHERTZ)))); 321 */ 322 extendedRanges.add(new NamedRangeImpl("3-dB", 323 new FrequencyRange(new Frequency("17.70", GIGAHERTZ), 324 new Frequency("26.80", GIGAHERTZ)))); 325 } 326 }, 327 328 /** EVLA's K Band receiver; 26.5 - 40.0 GHz. */ 329 EVLA_Ka("Ka", "33GHz", EVLA) 330 { 331 void initFreqRanges() 332 { 333 frequencyRange = new FrequencyRange(new Frequency("26.5", GIGAHERTZ), 334 new Frequency("40.0", GIGAHERTZ)); 335 336 extendedRanges = new ArrayList<NamedRangeImpl>(); 337 338 extendedRanges.add(new NamedRangeImpl("1-dB", 339 new FrequencyRange(new Frequency("26.00", GIGAHERTZ), 340 new Frequency("40.00", GIGAHERTZ)))); 341 342 extendedRanges.add(new NamedRangeImpl("3-dB", 343 new FrequencyRange(new Frequency("25.00", GIGAHERTZ), 344 new Frequency("41.00", GIGAHERTZ)))); 345 } 346 }, 347 348 /** EVLA's Q Band receiver; 40.0 - 50.0GHz. */ 349 EVLA_Q("Q", "45GHz", EVLA) 350 { 351 void initFreqRanges() 352 { 353 frequencyRange = new FrequencyRange(new Frequency("40.0", GIGAHERTZ), 354 new Frequency("50.0", GIGAHERTZ)); 355 356 extendedRanges = new ArrayList<NamedRangeImpl>(); 357 /* 358 extendedRanges.add(new NamedRangeImpl("1-dB", 359 new FrequencyRange(new Frequency("40.00", GIGAHERTZ), 360 new Frequency("50.00", GIGAHERTZ)))); 361 */ 362 extendedRanges.add(new NamedRangeImpl("3-dB", 363 new FrequencyRange(new Frequency("39.00", GIGAHERTZ), 364 new Frequency("51.00", GIGAHERTZ)))); 365 } 366 }, 367 368 /** GBT's PF1 receiver; 290.0 - 395.0 MHz. */ 369 GBT_PF1_342("PF1 342.5 MHz", null, GBT) 370 { 371 void initFreqRanges() 372 { 373 frequencyRange = new FrequencyRange(new Frequency("290.0", MEGAHERTZ), 374 new Frequency("395.0", MEGAHERTZ)); 375 extendedRanges = new ArrayList<NamedRangeImpl>(); 376 } 377 }, 378 379 /** GBT's PF1 receiver; 385.0 - 520.0 MHz. */ 380 GBT_PF1_450("PF1 450 MHz", null, GBT) 381 { 382 void initFreqRanges() 383 { 384 frequencyRange = new FrequencyRange(new Frequency("385.0", MEGAHERTZ), 385 new Frequency("520.0", MEGAHERTZ)); 386 extendedRanges = new ArrayList<NamedRangeImpl>(); 387 } 388 }, 389 390 /** GBT's PF1 receiver; 510.0 - 690.0 MHz. */ 391 GBT_PF1_600("PF1 600 MHz", null, GBT) 392 { 393 void initFreqRanges() 394 { 395 frequencyRange = new FrequencyRange(new Frequency("510.0", MEGAHERTZ), 396 new Frequency("690.0", MEGAHERTZ)); 397 extendedRanges = new ArrayList<NamedRangeImpl>(); 398 } 399 }, 400 401 /** GBT's PF1 receiver; 680.0 - 920.0 MHz. */ 402 GBT_PF1_800("PF1 800 MHz", null, GBT) 403 { 404 void initFreqRanges() 405 { 406 frequencyRange = new FrequencyRange(new Frequency("680.0", MEGAHERTZ), 407 new Frequency("920.0", MEGAHERTZ)); 408 extendedRanges = new ArrayList<NamedRangeImpl>(); 409 } 410 }, 411 412 /** GBT's PF2 receiver; 0.91 - 1.23 GHz. */ 413 GBT_PF2("PF2", null, GBT) 414 { 415 void initFreqRanges() 416 { 417 frequencyRange = new FrequencyRange(new Frequency("910.0", MEGAHERTZ), 418 new Frequency( "1.23", GIGAHERTZ)); 419 extendedRanges = new ArrayList<NamedRangeImpl>(); 420 } 421 }, 422 423 /** GBT's L Band receiver; 1.15 - 1.73 GHz. */ 424 GBT_L("L", null, GBT) 425 { 426 void initFreqRanges() 427 { 428 frequencyRange = new FrequencyRange(new Frequency("1.15", GIGAHERTZ), 429 new Frequency("1.73", GIGAHERTZ)); 430 extendedRanges = new ArrayList<NamedRangeImpl>(); 431 } 432 }, 433 434 /** GBT's S Band receiver; 1.73 - 2.60 GHz. */ 435 GBT_S("S", null, GBT) 436 { 437 void initFreqRanges() 438 { 439 frequencyRange = new FrequencyRange(new Frequency("1.73", GIGAHERTZ), 440 new Frequency("2.60", GIGAHERTZ)); 441 extendedRanges = new ArrayList<NamedRangeImpl>(); 442 } 443 }, 444 445 /** GBT's C Band receiver; 3.95 - 5.85 GHz. */ 446 GBT_C("C", null, GBT) 447 { 448 void initFreqRanges() 449 { 450 frequencyRange = new FrequencyRange(new Frequency("3.95", GIGAHERTZ), 451 new Frequency("5.85", GIGAHERTZ)); 452 extendedRanges = new ArrayList<NamedRangeImpl>(); 453 } 454 }, 455 456 /** GBT's X Band receiver; 8.0 - 10.1 GHz. */ 457 GBT_X("X", null, GBT) 458 { 459 void initFreqRanges() 460 { 461 frequencyRange = new FrequencyRange(new Frequency( "8.0", GIGAHERTZ), 462 new Frequency("10.1", GIGAHERTZ)); 463 extendedRanges = new ArrayList<NamedRangeImpl>(); 464 } 465 }, 466 467 /** GBT's Ku Band receiver; 12.0 - 15.4 GHz. */ 468 GBT_Ku("Ku", null, GBT) 469 { 470 void initFreqRanges() 471 { 472 frequencyRange = new FrequencyRange(new Frequency("12.0", GIGAHERTZ), 473 new Frequency("15.4", GIGAHERTZ)); 474 extendedRanges = new ArrayList<NamedRangeImpl>(); 475 } 476 }, 477 478 /** GBT's K Band receiver; 18.0 - 26.5 GHz. */ 479 GBT_K("K", null, GBT) 480 { 481 void initFreqRanges() 482 { 483 frequencyRange = new FrequencyRange(new Frequency("18.0", GIGAHERTZ), 484 new Frequency("26.5", GIGAHERTZ)); 485 extendedRanges = new ArrayList<NamedRangeImpl>(); 486 } 487 }, 488 489 /** GBT's Q Band receiver; 40.0 - 52.0 GHz. */ 490 GBT_Q("Q", null, GBT) 491 { 492 void initFreqRanges() 493 { 494 frequencyRange = new FrequencyRange(new Frequency("40.0", GIGAHERTZ), 495 new Frequency("52.0", GIGAHERTZ)); 496 extendedRanges = new ArrayList<NamedRangeImpl>(); 497 } 498 }, 499 500 /** VLA's 4 Band receiver; 73.0 - 74.5 MHz. */ 501 VLA_4("4", null, VLA) 502 { 503 void initFreqRanges() 504 { 505 frequencyRange = new FrequencyRange(new Frequency("73.0", MEGAHERTZ), 506 new Frequency("74.5", MEGAHERTZ)); 507 extendedRanges = new ArrayList<NamedRangeImpl>(); 508 } 509 }, 510 511 /** VLA's P Band receiver; 300.0 - 340.5 MHz. */ 512 VLA_P("P", null, VLA) 513 { 514 void initFreqRanges() 515 { 516 frequencyRange = new FrequencyRange(new Frequency("300.0", MEGAHERTZ), 517 new Frequency("340.5", MEGAHERTZ)); 518 extendedRanges = new ArrayList<NamedRangeImpl>(); 519 } 520 }, 521 522 /** VLA's L Band receiver; 1.24 - 1.70 GHz. */ 523 VLA_L("L", null, VLA) 524 { 525 void initFreqRanges() 526 { 527 frequencyRange = new FrequencyRange(new Frequency("1.24", GIGAHERTZ), 528 new Frequency("1.70", GIGAHERTZ)); 529 530 extendedRanges = new ArrayList<NamedRangeImpl>(); 531 } 532 }, 533 534 /** VLA's C Band receiver; 4.5 - 5.0 GHz. */ 535 VLA_C("C", null, VLA) 536 { 537 void initFreqRanges() 538 { 539 frequencyRange = new FrequencyRange(new Frequency("4.5", GIGAHERTZ), 540 new Frequency("5.0", GIGAHERTZ)); 541 extendedRanges = new ArrayList<NamedRangeImpl>(); 542 } 543 }, 544 545 /** VLA's X Band receiver; 8.1 - 8.8 GHz. */ 546 VLA_X("X", null, VLA) 547 { 548 void initFreqRanges() 549 { 550 frequencyRange = new FrequencyRange(new Frequency("8.1", GIGAHERTZ), 551 new Frequency("8.8", GIGAHERTZ)); 552 extendedRanges = new ArrayList<NamedRangeImpl>(); 553 } 554 }, 555 556 /** VLA's U Band receiver; 14.6 - 15.3 GHz. */ 557 VLA_U("U", null, VLA) 558 { 559 void initFreqRanges() 560 { 561 frequencyRange = new FrequencyRange(new Frequency("14.6", GIGAHERTZ), 562 new Frequency("15.3", GIGAHERTZ)); 563 extendedRanges = new ArrayList<NamedRangeImpl>(); 564 } 565 }, 566 567 /** VLA's K Band receiver; 22.0 - 24.0 GHz. */ 568 VLA_K("K", null, VLA) 569 { 570 void initFreqRanges() 571 { 572 frequencyRange = new FrequencyRange(new Frequency("22.0", GIGAHERTZ), 573 new Frequency("24.0", GIGAHERTZ)); 574 extendedRanges = new ArrayList<NamedRangeImpl>(); 575 } 576 }, 577 578 /** VLA's Q Band receiver; 40.0 - 50.0 GHz. */ 579 VLA_Q("Q", null, VLA) 580 { 581 void initFreqRanges() 582 { 583 frequencyRange = new FrequencyRange(new Frequency("40.0", GIGAHERTZ), 584 new Frequency("50.0", GIGAHERTZ)); 585 extendedRanges = new ArrayList<NamedRangeImpl>(); 586 } 587 }, 588 589 /** Receiver band of unspecified origin. */ 590 UNSPECIFIED(null, null, OTHER) 591 { 592 void initFreqRanges() 593 { 594 frequencyRange = new FrequencyRange(); 595 extendedRanges = new ArrayList<NamedRangeImpl>(); 596 } 597 }; 598 599 FrequencyRange frequencyRange; 600 List<NamedRangeImpl> extendedRanges; 601 602 private final String displayName; 603 private final String frequencyName; 604 private final TelescopeType telescope; 605 606 //private Set<PolarizationType> polarizationTypes; 607 //private int numberOfBeams; 608 //private int polarizationsPerBeam; 609 610 private ReceiverBand(String name, String freqName, TelescopeType tele) 611 { 612 displayName = name; 613 frequencyName = freqName; 614 telescope = tele; 615 frequencyRange = null; //will do just-in-time object creation 616 extendedRanges = null; //will do just-in-time object creation 617 } 618 619 /** 620 * Returns a name for this band that is more suitable for display than the 621 * text returned by the {@link #name()} or {@link #toString()} methods. 622 * <p> 623 * Note, though, that the text returned by this method may <i>not</i> be used 624 * successfully in the {@link #fromString(String)} method because several 625 * bands have identical display names. For example, <tt>EVLA_L, GBT_L, & 626 * VLA_L</tt> all have the display name "L".</p> 627 */ 628 public String getDisplayName() 629 { 630 return displayName == null ? 631 EnumerationUtility.getSharedInstance().enumToString(this) : 632 displayName; 633 } 634 635 /** 636 * Returns a name for this band based on its frequency range, such as 637 * "33GHz". 638 * 639 * @return 640 * a name for this band based on its frequency range. 641 */ 642 public String getFrequencyName() 643 { 644 return frequencyName == null ? 645 getNominalRange().getCenterFrequency().normalize().toString() : 646 frequencyName; 647 } 648 649 abstract void initFreqRanges(); 650 651 /** @deprecated Use {@link #getNominalRange()}. */ 652 @Deprecated public FrequencyRange getFrequencyRange() 653 { 654 if (frequencyRange == null) 655 initFreqRanges(); 656 657 return frequencyRange.clone(); 658 } 659 660 /** 661 * Returns a copy of the frequency range covered by this receiver. 662 * The returned range is the nominal range of this receiver, but 663 * may not be the full range of frequencies it can receive. 664 * 665 * @return a copy of the nominal frequency range covered by this receiver. 666 * 667 * @see #getWidestRange() 668 * @see #getExtendedRanges() 669 */ 670 public FrequencyRange getNominalRange() 671 { 672 if (frequencyRange == null) 673 initFreqRanges(); 674 675 return frequencyRange.clone(); 676 } 677 678 /** 679 * Returns the widest of this receiver's extended ranges. 680 * If this receiver has no extended range, the nominal range is returned. 681 * 682 * @return 683 * the widest of this receiver's extended ranges. 684 * 685 * @see #getNominalRange() 686 * @see #getExtendedRanges() 687 * 688 * @since 2008-10-23 689 */ 690 public FrequencyRange getWidestRange() 691 { 692 if (frequencyRange == null) 693 initFreqRanges(); 694 695 FrequencyRange broadest = frequencyRange; 696 Frequency width = broadest.getWidth(); 697 698 for (NamedRangeImpl ext : extendedRanges) 699 { 700 FrequencyRange extRange = ext.range; 701 Frequency extWidth = extRange.getWidth(); 702 703 if (extWidth.compareTo(width) > 0) 704 { 705 broadest = extRange; 706 width = extWidth; 707 } 708 } 709 710 return broadest.clone(); 711 } 712 713 /** 714 * Returns copies of the extended frequency ranges covered by this receiver, 715 * if any. 716 * <p> 717 * The returned ranges are broader than the nominal range of this receiver. 718 * Furthermore, each range in the list should contain all the ranges in 719 * lower positions in the list. 720 * Reception in the extended zones may not be optimal, but might be sufficient 721 * for some purposes.</p> 722 * <p> 723 * The returned list might be empty, but will never be <i>null</i>.</p> 724 * 725 * @return copies of the extended frequency ranges covered by this receiver. 726 * 727 * @see #getFrequencyRange() 728 */ 729 public List<NamedRange> getExtendedRanges() 730 { 731 if (frequencyRange == null) 732 initFreqRanges(); 733 734 List<NamedRange> er = new ArrayList<NamedRange>(); 735 736 for (NamedRange nr : extendedRanges) 737 er.add(new NamedRangeImpl(nr.getName(), nr.getRange())); 738 739 return er; 740 } 741 742 /** 743 * Returns the telescope to which this receiver band belongs. 744 * @return the telescope to which this receiver band belongs.s 745 */ 746 public TelescopeType getTelescope() 747 { 748 return telescope; 749 } 750 751 /** 752 * Creates and returns a new receiver with the same name and frequency range 753 * as this receiver band. 754 * 755 * @return a new receiver with the same name and frequency range 756 * as this receiver band. 757 * 758 public Receiver makeReceiver() 759 { 760 return new Receiver(displayName, getFrequencyRange()); 761 }*/ 762 763 /** 764 * Returns a text representation of this enumeration constant. 765 * @return a text representation of this enumeration constant. 766 */ 767 @Override 768 public String toString() 769 { 770 return EnumerationUtility.getSharedInstance().enumToString(this); 771 } 772 773 /** 774 * Returns the band represented by {@code text}. 775 * <p> 776 * For details about the transformation, see 777 * {@link EnumerationUtility#enumFromString(Class, String)}.</p> 778 * 779 * @param text a text representation of a receiver band. 780 * 781 * @return the receiver band represented by {@code text}. 782 */ 783 public static ReceiverBand fromString(String text) 784 { 785 return EnumerationUtility.getSharedInstance() 786 .enumFromString(ReceiverBand.class, text); 787 } 788 789 //=========================================================================== 790 // 791 //=========================================================================== 792 793 public static interface NamedRange 794 { 795 public String getName(); 796 797 public FrequencyRange getRange(); 798 } 799 800 //Note: originally did not have keyword "static". 801 //Eclipse compiled & ran OK; mvn gave compile error whereever an new inst 802 //of this class was created. 803 private static class NamedRangeImpl implements NamedRange 804 { 805 String name; 806 FrequencyRange range; 807 808 NamedRangeImpl(String name, FrequencyRange range) 809 { 810 this.name = name; 811 this.range = range; 812 } 813 814 public String getName() { return name; } 815 public FrequencyRange getRange() { return range.clone(); } 816 } 817 818 //=========================================================================== 819 // 820 //=========================================================================== 821 /* 822 public static void main(String... args) throws Exception 823 { 824 for (ReceiverBand rb : TelescopeType.EVLA.getReceivers()) 825 System.out.println(rb.getDisplayName() + ": " + rb.getFrequencyRange() + 826 ", " + rb.getExtendedFrequencyRange()); 827 } 828 */ 829 }