Advertisement
Guest User

drugingredient.java

a guest
Jul 26th, 2011
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. /**
  2. * The contents of this file are subject to the OpenMRS Public License
  3. * Version 1.0 (the "License"); you may not use this file except in
  4. * compliance with the License. You may obtain a copy of the License at
  5. * http://license.openmrs.org
  6. *
  7. * Software distributed under the License is distributed on an "AS IS"
  8. * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  9. * License for the specific language governing rights and limitations
  10. * under the License.
  11. *
  12. * Copyright (C) OpenMRS, LLC. All Rights Reserved.
  13. */
  14. package org.openmrs;
  15.  
  16. import java.util.Collection;
  17. import java.util.Collections;
  18.  
  19. /**
  20. * DrugIngredient
  21. */
  22. public class DrugIngredient extends BaseOpenmrsObject implements java.io.Serializable, OpenmrsObject {
  23.  
  24. public static final long serialVersionUID = 94023L;
  25.  
  26. // Fields
  27.  
  28. private Drug drug;
  29.  
  30. private Concept ingredient;
  31.  
  32. private Double quantity;
  33.  
  34. private String units;
  35.  
  36. // Constructors
  37.  
  38. /** default constructor */
  39. public DrugIngredient() {
  40. }
  41.  
  42. public boolean equals(Object obj) {
  43. if (obj instanceof DrugIngredient) {
  44. DrugIngredient c = (DrugIngredient) obj;
  45. return (this.drug.equals(c.getDrug()) && this.ingredient.equals(c.getIngredient()));
  46. }
  47. return false;
  48. }
  49.  
  50. public int hashCode() {
  51. if (this.getDrug() == null || this.getIngredient() == null)
  52. return super.hashCode();
  53. return this.getDrug().hashCode() + this.getIngredient().hashCode();
  54. }
  55.  
  56. // Property accessors
  57.  
  58. /**
  59. * @return the drug
  60. */
  61. public Drug getDrug() {
  62. return drug;
  63. }
  64.  
  65. /**
  66. * @param drug the drug to set
  67. */
  68. public void setDrug(Drug drug) {
  69. this.drug = drug;
  70. }
  71.  
  72. /**
  73. * @return Returns the ingredient.
  74. */
  75. public Concept getIngredient() {
  76. return ingredient;
  77. }
  78.  
  79. /**
  80. * @param ingredient The ingredient to set.
  81. */
  82. public void setIngredient(Concept ingredient) {
  83. this.ingredient = ingredient;
  84. }
  85.  
  86. /**
  87. * @return Returns the quantity.
  88. */
  89. public Double getQuantity() {
  90. return quantity;
  91. }
  92.  
  93. /**
  94. * @param quantity The quantity to set.
  95. */
  96. public void setQuantity(Double quantity) {
  97. this.quantity = quantity;
  98. }
  99.  
  100. /**
  101. * @return Returns the units.
  102. */
  103. public String getUnits() {
  104. return units;
  105. }
  106.  
  107. /**
  108. *@param units The units to set.
  109. */
  110. public void setUnits(String units) {
  111. this.units = units;
  112. }
  113.  
  114. /**
  115. * @since 1.5
  116. * @see org.openmrs.OpenmrsObject#getId()
  117. */
  118. public Integer getId() {
  119. throw new UnsupportedOperationException();
  120. }
  121.  
  122. /**
  123. * @since 1.5
  124. * @see org.openmrs.OpenmrsObject#setId(java.lang.Integer)
  125. */
  126. public void setId(Integer id) {
  127. throw new UnsupportedOperationException();
  128. }
  129.  
  130. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement