001/* 002 * This class is an auto-generated source file for a HAPI 003 * HL7 v2.x standard structure class. 004 * 005 * For more information, visit: http://hl7api.sourceforge.net/ 006 * 007 * The contents of this file are subject to the Mozilla Public License Version 1.1 008 * (the "License"); you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 010 * Software distributed under the License is distributed on an "AS IS" basis, 011 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 012 * specific language governing rights and limitations under the License. 013 * 014 * The Original Code is "[file_name]". Description: 015 * "[one_line_description]" 016 * 017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 018 * 2012. All Rights Reserved. 019 * 020 * Contributor(s): ______________________________________. 021 * 022 * Alternatively, the contents of this file may be used under the terms of the 023 * GNU General Public License (the "GPL"), in which case the provisions of the GPL are 024 * applicable instead of those above. If you wish to allow use of your version of this 025 * file only under the terms of the GPL and not to allow others to use your version 026 * of this file under the MPL, indicate your decision by deleting the provisions above 027 * and replace them with the notice and other provisions required by the GPL License. 028 * If you do not delete the provisions above, a recipient may use your version of 029 * this file under either the MPL or the GPL. 030 * 031 */ 032 033 034package ca.uhn.hl7v2.model.v251.segment; 035 036// import ca.uhn.hl7v2.model.v251.group.*; 037import ca.uhn.hl7v2.model.v251.datatype.*; 038import ca.uhn.hl7v2.HL7Exception; 039import ca.uhn.hl7v2.parser.ModelClassFactory; 040import ca.uhn.hl7v2.parser.DefaultModelClassFactory; 041import ca.uhn.hl7v2.model.AbstractMessage; 042import ca.uhn.hl7v2.model.Group; 043import ca.uhn.hl7v2.model.Type; 044import ca.uhn.hl7v2.model.AbstractSegment; 045import ca.uhn.hl7v2.model.Varies; 046 047/** 048 *<p>Represents an HL7 TQ1 message segment (Timing/Quantity). 049 * This segment has the following fields:</p> 050 * <ul> 051 * <li>TQ1-1: Set ID - TQ1 (SI) <b>optional </b> 052 * <li>TQ1-2: Quantity (CQ) <b>optional </b> 053 * <li>TQ1-3: Repeat Pattern (RPT) <b>optional repeating</b> 054 * <li>TQ1-4: Explicit Time (TM) <b>optional repeating</b> 055 * <li>TQ1-5: Relative Time and Units (CQ) <b>optional repeating</b> 056 * <li>TQ1-6: Service Duration (CQ) <b>optional </b> 057 * <li>TQ1-7: Start date/time (TS) <b>optional </b> 058 * <li>TQ1-8: End date/time (TS) <b>optional </b> 059 * <li>TQ1-9: Priority (CWE) <b>optional repeating</b> 060 * <li>TQ1-10: Condition text (TX) <b>optional </b> 061 * <li>TQ1-11: Text instruction (TX) <b>optional </b> 062 * <li>TQ1-12: Conjunction (ID) <b>optional </b> 063 * <li>TQ1-13: Occurrence duration (CQ) <b>optional </b> 064 * <li>TQ1-14: Total occurrence's (NM) <b>optional </b> 065 * </ul> 066 */ 067@SuppressWarnings("unused") 068public class TQ1 extends AbstractSegment { 069 070 /** 071 * Creates a new TQ1 segment 072 */ 073 public TQ1(Group parent, ModelClassFactory factory) { 074 super(parent, factory); 075 init(factory); 076 } 077 078 private void init(ModelClassFactory factory) { 079 try { 080 this.add(SI.class, false, 1, 4, new Object[]{ getMessage() }, "Set ID - TQ1"); 081 this.add(CQ.class, false, 1, 20, new Object[]{ getMessage() }, "Quantity"); 082 this.add(RPT.class, false, 0, 540, new Object[]{ getMessage() }, "Repeat Pattern"); 083 this.add(TM.class, false, 0, 20, new Object[]{ getMessage() }, "Explicit Time"); 084 this.add(CQ.class, false, 0, 20, new Object[]{ getMessage() }, "Relative Time and Units"); 085 this.add(CQ.class, false, 1, 20, new Object[]{ getMessage() }, "Service Duration"); 086 this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "Start date/time"); 087 this.add(TS.class, false, 1, 26, new Object[]{ getMessage() }, "End date/time"); 088 this.add(CWE.class, false, 0, 250, new Object[]{ getMessage() }, "Priority"); 089 this.add(TX.class, false, 1, 250, new Object[]{ getMessage() }, "Condition text"); 090 this.add(TX.class, false, 1, 250, new Object[]{ getMessage() }, "Text instruction"); 091 this.add(ID.class, false, 1, 10, new Object[]{ getMessage(), new Integer(427) }, "Conjunction"); 092 this.add(CQ.class, false, 1, 20, new Object[]{ getMessage() }, "Occurrence duration"); 093 this.add(NM.class, false, 1, 10, new Object[]{ getMessage() }, "Total occurrence's"); 094 } catch(HL7Exception e) { 095 log.error("Unexpected error creating TQ1 - this is probably a bug in the source code generator.", e); 096 } 097 } 098 099 100 101 /** 102 * Returns 103 * TQ1-1: "Set ID - TQ1" - creates it if necessary 104 */ 105 public SI getSetIDTQ1() { 106 SI retVal = this.getTypedField(1, 0); 107 return retVal; 108 } 109 110 /** 111 * Returns 112 * TQ1-1: "Set ID - TQ1" - creates it if necessary 113 */ 114 public SI getTq11_SetIDTQ1() { 115 SI retVal = this.getTypedField(1, 0); 116 return retVal; 117 } 118 119 120 121 /** 122 * Returns 123 * TQ1-2: "Quantity" - creates it if necessary 124 */ 125 public CQ getQuantity() { 126 CQ retVal = this.getTypedField(2, 0); 127 return retVal; 128 } 129 130 /** 131 * Returns 132 * TQ1-2: "Quantity" - creates it if necessary 133 */ 134 public CQ getTq12_Quantity() { 135 CQ retVal = this.getTypedField(2, 0); 136 return retVal; 137 } 138 139 140 /** 141 * Returns all repetitions of Repeat Pattern (TQ1-3). 142 */ 143 public RPT[] getRepeatPattern() { 144 RPT[] retVal = this.getTypedField(3, new RPT[0]); 145 return retVal; 146 } 147 148 149 /** 150 * Returns all repetitions of Repeat Pattern (TQ1-3). 151 */ 152 public RPT[] getTq13_RepeatPattern() { 153 RPT[] retVal = this.getTypedField(3, new RPT[0]); 154 return retVal; 155 } 156 157 158 /** 159 * Returns a count of the current number of repetitions of Repeat Pattern (TQ1-3). 160 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 161 * it will return zero. 162 */ 163 public int getRepeatPatternReps() { 164 return this.getReps(3); 165 } 166 167 168 /** 169 * Returns a specific repetition of 170 * TQ1-3: "Repeat Pattern" - creates it if necessary 171 * 172 * @param rep The repetition index (0-indexed) 173 */ 174 public RPT getRepeatPattern(int rep) { 175 RPT retVal = this.getTypedField(3, rep); 176 return retVal; 177 } 178 179 /** 180 * Returns a specific repetition of 181 * TQ1-3: "Repeat Pattern" - creates it if necessary 182 * 183 * @param rep The repetition index (0-indexed) 184 */ 185 public RPT getTq13_RepeatPattern(int rep) { 186 RPT retVal = this.getTypedField(3, rep); 187 return retVal; 188 } 189 190 /** 191 * Returns a count of the current number of repetitions of Repeat Pattern (TQ1-3). 192 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 193 * it will return zero. 194 */ 195 public int getTq13_RepeatPatternReps() { 196 return this.getReps(3); 197 } 198 199 200 /** 201 * Inserts a repetition of 202 * TQ1-3: "Repeat Pattern" at a specific index 203 * 204 * @param rep The repetition index (0-indexed) 205 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 206 */ 207 public RPT insertRepeatPattern(int rep) throws HL7Exception { 208 return (RPT) super.insertRepetition(3, rep); 209 } 210 211 212 /** 213 * Inserts a repetition of 214 * TQ1-3: "Repeat Pattern" at a specific index 215 * 216 * @param rep The repetition index (0-indexed) 217 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 218 */ 219 public RPT insertTq13_RepeatPattern(int rep) throws HL7Exception { 220 return (RPT) super.insertRepetition(3, rep); 221 } 222 223 224 /** 225 * Removes a repetition of 226 * TQ1-3: "Repeat Pattern" at a specific index 227 * 228 * @param rep The repetition index (0-indexed) 229 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 230 */ 231 public RPT removeRepeatPattern(int rep) throws HL7Exception { 232 return (RPT) super.removeRepetition(3, rep); 233 } 234 235 236 /** 237 * Removes a repetition of 238 * TQ1-3: "Repeat Pattern" at a specific index 239 * 240 * @param rep The repetition index (0-indexed) 241 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 242 */ 243 public RPT removeTq13_RepeatPattern(int rep) throws HL7Exception { 244 return (RPT) super.removeRepetition(3, rep); 245 } 246 247 248 249 /** 250 * Returns all repetitions of Explicit Time (TQ1-4). 251 */ 252 public TM[] getExplicitTime() { 253 TM[] retVal = this.getTypedField(4, new TM[0]); 254 return retVal; 255 } 256 257 258 /** 259 * Returns all repetitions of Explicit Time (TQ1-4). 260 */ 261 public TM[] getTq14_ExplicitTime() { 262 TM[] retVal = this.getTypedField(4, new TM[0]); 263 return retVal; 264 } 265 266 267 /** 268 * Returns a count of the current number of repetitions of Explicit Time (TQ1-4). 269 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 270 * it will return zero. 271 */ 272 public int getExplicitTimeReps() { 273 return this.getReps(4); 274 } 275 276 277 /** 278 * Returns a specific repetition of 279 * TQ1-4: "Explicit Time" - creates it if necessary 280 * 281 * @param rep The repetition index (0-indexed) 282 */ 283 public TM getExplicitTime(int rep) { 284 TM retVal = this.getTypedField(4, rep); 285 return retVal; 286 } 287 288 /** 289 * Returns a specific repetition of 290 * TQ1-4: "Explicit Time" - creates it if necessary 291 * 292 * @param rep The repetition index (0-indexed) 293 */ 294 public TM getTq14_ExplicitTime(int rep) { 295 TM retVal = this.getTypedField(4, rep); 296 return retVal; 297 } 298 299 /** 300 * Returns a count of the current number of repetitions of Explicit Time (TQ1-4). 301 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 302 * it will return zero. 303 */ 304 public int getTq14_ExplicitTimeReps() { 305 return this.getReps(4); 306 } 307 308 309 /** 310 * Inserts a repetition of 311 * TQ1-4: "Explicit Time" at a specific index 312 * 313 * @param rep The repetition index (0-indexed) 314 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 315 */ 316 public TM insertExplicitTime(int rep) throws HL7Exception { 317 return (TM) super.insertRepetition(4, rep); 318 } 319 320 321 /** 322 * Inserts a repetition of 323 * TQ1-4: "Explicit Time" at a specific index 324 * 325 * @param rep The repetition index (0-indexed) 326 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 327 */ 328 public TM insertTq14_ExplicitTime(int rep) throws HL7Exception { 329 return (TM) super.insertRepetition(4, rep); 330 } 331 332 333 /** 334 * Removes a repetition of 335 * TQ1-4: "Explicit Time" at a specific index 336 * 337 * @param rep The repetition index (0-indexed) 338 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 339 */ 340 public TM removeExplicitTime(int rep) throws HL7Exception { 341 return (TM) super.removeRepetition(4, rep); 342 } 343 344 345 /** 346 * Removes a repetition of 347 * TQ1-4: "Explicit Time" at a specific index 348 * 349 * @param rep The repetition index (0-indexed) 350 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 351 */ 352 public TM removeTq14_ExplicitTime(int rep) throws HL7Exception { 353 return (TM) super.removeRepetition(4, rep); 354 } 355 356 357 358 /** 359 * Returns all repetitions of Relative Time and Units (TQ1-5). 360 */ 361 public CQ[] getRelativeTimeAndUnits() { 362 CQ[] retVal = this.getTypedField(5, new CQ[0]); 363 return retVal; 364 } 365 366 367 /** 368 * Returns all repetitions of Relative Time and Units (TQ1-5). 369 */ 370 public CQ[] getTq15_RelativeTimeAndUnits() { 371 CQ[] retVal = this.getTypedField(5, new CQ[0]); 372 return retVal; 373 } 374 375 376 /** 377 * Returns a count of the current number of repetitions of Relative Time and Units (TQ1-5). 378 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 379 * it will return zero. 380 */ 381 public int getRelativeTimeAndUnitsReps() { 382 return this.getReps(5); 383 } 384 385 386 /** 387 * Returns a specific repetition of 388 * TQ1-5: "Relative Time and Units" - creates it if necessary 389 * 390 * @param rep The repetition index (0-indexed) 391 */ 392 public CQ getRelativeTimeAndUnits(int rep) { 393 CQ retVal = this.getTypedField(5, rep); 394 return retVal; 395 } 396 397 /** 398 * Returns a specific repetition of 399 * TQ1-5: "Relative Time and Units" - creates it if necessary 400 * 401 * @param rep The repetition index (0-indexed) 402 */ 403 public CQ getTq15_RelativeTimeAndUnits(int rep) { 404 CQ retVal = this.getTypedField(5, rep); 405 return retVal; 406 } 407 408 /** 409 * Returns a count of the current number of repetitions of Relative Time and Units (TQ1-5). 410 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 411 * it will return zero. 412 */ 413 public int getTq15_RelativeTimeAndUnitsReps() { 414 return this.getReps(5); 415 } 416 417 418 /** 419 * Inserts a repetition of 420 * TQ1-5: "Relative Time and Units" at a specific index 421 * 422 * @param rep The repetition index (0-indexed) 423 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 424 */ 425 public CQ insertRelativeTimeAndUnits(int rep) throws HL7Exception { 426 return (CQ) super.insertRepetition(5, rep); 427 } 428 429 430 /** 431 * Inserts a repetition of 432 * TQ1-5: "Relative Time and Units" at a specific index 433 * 434 * @param rep The repetition index (0-indexed) 435 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 436 */ 437 public CQ insertTq15_RelativeTimeAndUnits(int rep) throws HL7Exception { 438 return (CQ) super.insertRepetition(5, rep); 439 } 440 441 442 /** 443 * Removes a repetition of 444 * TQ1-5: "Relative Time and Units" at a specific index 445 * 446 * @param rep The repetition index (0-indexed) 447 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 448 */ 449 public CQ removeRelativeTimeAndUnits(int rep) throws HL7Exception { 450 return (CQ) super.removeRepetition(5, rep); 451 } 452 453 454 /** 455 * Removes a repetition of 456 * TQ1-5: "Relative Time and Units" at a specific index 457 * 458 * @param rep The repetition index (0-indexed) 459 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 460 */ 461 public CQ removeTq15_RelativeTimeAndUnits(int rep) throws HL7Exception { 462 return (CQ) super.removeRepetition(5, rep); 463 } 464 465 466 467 468 /** 469 * Returns 470 * TQ1-6: "Service Duration" - creates it if necessary 471 */ 472 public CQ getServiceDuration() { 473 CQ retVal = this.getTypedField(6, 0); 474 return retVal; 475 } 476 477 /** 478 * Returns 479 * TQ1-6: "Service Duration" - creates it if necessary 480 */ 481 public CQ getTq16_ServiceDuration() { 482 CQ retVal = this.getTypedField(6, 0); 483 return retVal; 484 } 485 486 487 488 /** 489 * Returns 490 * TQ1-7: "Start date/time" - creates it if necessary 491 */ 492 public TS getStartDateTime() { 493 TS retVal = this.getTypedField(7, 0); 494 return retVal; 495 } 496 497 /** 498 * Returns 499 * TQ1-7: "Start date/time" - creates it if necessary 500 */ 501 public TS getTq17_StartDateTime() { 502 TS retVal = this.getTypedField(7, 0); 503 return retVal; 504 } 505 506 507 508 /** 509 * Returns 510 * TQ1-8: "End date/time" - creates it if necessary 511 */ 512 public TS getEndDateTime() { 513 TS retVal = this.getTypedField(8, 0); 514 return retVal; 515 } 516 517 /** 518 * Returns 519 * TQ1-8: "End date/time" - creates it if necessary 520 */ 521 public TS getTq18_EndDateTime() { 522 TS retVal = this.getTypedField(8, 0); 523 return retVal; 524 } 525 526 527 /** 528 * Returns all repetitions of Priority (TQ1-9). 529 */ 530 public CWE[] getPriority() { 531 CWE[] retVal = this.getTypedField(9, new CWE[0]); 532 return retVal; 533 } 534 535 536 /** 537 * Returns all repetitions of Priority (TQ1-9). 538 */ 539 public CWE[] getTq19_Priority() { 540 CWE[] retVal = this.getTypedField(9, new CWE[0]); 541 return retVal; 542 } 543 544 545 /** 546 * Returns a count of the current number of repetitions of Priority (TQ1-9). 547 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 548 * it will return zero. 549 */ 550 public int getPriorityReps() { 551 return this.getReps(9); 552 } 553 554 555 /** 556 * Returns a specific repetition of 557 * TQ1-9: "Priority" - creates it if necessary 558 * 559 * @param rep The repetition index (0-indexed) 560 */ 561 public CWE getPriority(int rep) { 562 CWE retVal = this.getTypedField(9, rep); 563 return retVal; 564 } 565 566 /** 567 * Returns a specific repetition of 568 * TQ1-9: "Priority" - creates it if necessary 569 * 570 * @param rep The repetition index (0-indexed) 571 */ 572 public CWE getTq19_Priority(int rep) { 573 CWE retVal = this.getTypedField(9, rep); 574 return retVal; 575 } 576 577 /** 578 * Returns a count of the current number of repetitions of Priority (TQ1-9). 579 * This method does not create a repetition, so if no repetitions have currently been defined or accessed, 580 * it will return zero. 581 */ 582 public int getTq19_PriorityReps() { 583 return this.getReps(9); 584 } 585 586 587 /** 588 * Inserts a repetition of 589 * TQ1-9: "Priority" at a specific index 590 * 591 * @param rep The repetition index (0-indexed) 592 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 593 */ 594 public CWE insertPriority(int rep) throws HL7Exception { 595 return (CWE) super.insertRepetition(9, rep); 596 } 597 598 599 /** 600 * Inserts a repetition of 601 * TQ1-9: "Priority" at a specific index 602 * 603 * @param rep The repetition index (0-indexed) 604 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 605 */ 606 public CWE insertTq19_Priority(int rep) throws HL7Exception { 607 return (CWE) super.insertRepetition(9, rep); 608 } 609 610 611 /** 612 * Removes a repetition of 613 * TQ1-9: "Priority" at a specific index 614 * 615 * @param rep The repetition index (0-indexed) 616 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 617 */ 618 public CWE removePriority(int rep) throws HL7Exception { 619 return (CWE) super.removeRepetition(9, rep); 620 } 621 622 623 /** 624 * Removes a repetition of 625 * TQ1-9: "Priority" at a specific index 626 * 627 * @param rep The repetition index (0-indexed) 628 * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions) 629 */ 630 public CWE removeTq19_Priority(int rep) throws HL7Exception { 631 return (CWE) super.removeRepetition(9, rep); 632 } 633 634 635 636 637 /** 638 * Returns 639 * TQ1-10: "Condition text" - creates it if necessary 640 */ 641 public TX getConditionText() { 642 TX retVal = this.getTypedField(10, 0); 643 return retVal; 644 } 645 646 /** 647 * Returns 648 * TQ1-10: "Condition text" - creates it if necessary 649 */ 650 public TX getTq110_ConditionText() { 651 TX retVal = this.getTypedField(10, 0); 652 return retVal; 653 } 654 655 656 657 /** 658 * Returns 659 * TQ1-11: "Text instruction" - creates it if necessary 660 */ 661 public TX getTextInstruction() { 662 TX retVal = this.getTypedField(11, 0); 663 return retVal; 664 } 665 666 /** 667 * Returns 668 * TQ1-11: "Text instruction" - creates it if necessary 669 */ 670 public TX getTq111_TextInstruction() { 671 TX retVal = this.getTypedField(11, 0); 672 return retVal; 673 } 674 675 676 677 /** 678 * Returns 679 * TQ1-12: "Conjunction" - creates it if necessary 680 */ 681 public ID getConjunction() { 682 ID retVal = this.getTypedField(12, 0); 683 return retVal; 684 } 685 686 /** 687 * Returns 688 * TQ1-12: "Conjunction" - creates it if necessary 689 */ 690 public ID getTq112_Conjunction() { 691 ID retVal = this.getTypedField(12, 0); 692 return retVal; 693 } 694 695 696 697 /** 698 * Returns 699 * TQ1-13: "Occurrence duration" - creates it if necessary 700 */ 701 public CQ getOccurrenceDuration() { 702 CQ retVal = this.getTypedField(13, 0); 703 return retVal; 704 } 705 706 /** 707 * Returns 708 * TQ1-13: "Occurrence duration" - creates it if necessary 709 */ 710 public CQ getTq113_OccurrenceDuration() { 711 CQ retVal = this.getTypedField(13, 0); 712 return retVal; 713 } 714 715 716 717 /** 718 * Returns 719 * TQ1-14: "Total occurrence's" - creates it if necessary 720 */ 721 public NM getTotalOccurrenceS() { 722 NM retVal = this.getTypedField(14, 0); 723 return retVal; 724 } 725 726 /** 727 * Returns 728 * TQ1-14: "Total occurrence's" - creates it if necessary 729 */ 730 public NM getTq114_TotalOccurrenceS() { 731 NM retVal = this.getTypedField(14, 0); 732 return retVal; 733 } 734 735 736 737 738 739 /** {@inheritDoc} */ 740 protected Type createNewTypeWithoutReflection(int field) { 741 switch (field) { 742 case 0: return new SI(getMessage()); 743 case 1: return new CQ(getMessage()); 744 case 2: return new RPT(getMessage()); 745 case 3: return new TM(getMessage()); 746 case 4: return new CQ(getMessage()); 747 case 5: return new CQ(getMessage()); 748 case 6: return new TS(getMessage()); 749 case 7: return new TS(getMessage()); 750 case 8: return new CWE(getMessage()); 751 case 9: return new TX(getMessage()); 752 case 10: return new TX(getMessage()); 753 case 11: return new ID(getMessage(), new Integer( 427 )); 754 case 12: return new CQ(getMessage()); 755 case 13: return new NM(getMessage()); 756 default: return null; 757 } 758 } 759 760 761} 762