An instance of this class corresponds to a single blood type in an ABO+Rh blood group system. A person’s blood type affects who they can donate blood to; the blood types of the donor and the recipient must be compatible.
As represented here, a blood type consists of two components, ABO and rhesus. For any person, the ABO component has one of the following values: "A", "B", "AB", or "O" (the letter O, not zero). The rhesus component is either positive or negative. These components describe the presence or absence of particular antigens in human blood; for further reading, see Wikipedia.
This class represents the ABO component as a string and the rhesus component as a Boolean, with true corresponding to positive and false to negative.
Parameters
abo
the ABO component of the blood type; this must be one of the strings "A", "B", "AB", or "O", or the class will malfunction
rhesus
the rhesus component of the blood type; true stands positive, false for negative
Determines whether the person with this blood type can safely donate blood to the given recipient, taking into account both the ABO and rhesus components. The donor’s blood must be safe for the recipient in both respects, as defined under methods hasSafeABOFor and hasSafeRhesusFor.
Determines whether the person with this blood type can safely donate blood to the given recipient, taking into account both the ABO and rhesus components. The donor’s blood must be safe for the recipient in both respects, as defined under methods hasSafeABOFor and hasSafeRhesusFor.
Parameters
recipient
the blood type of the person who would receive the blood of this type
Determines whether the person with this blood type can safely receive blood donated by the given person. Both the ABO and rhesus components are taken into account, the same way as in canDonateTo.
Determines whether the person with this blood type can safely receive blood donated by the given person. Both the ABO and rhesus components are taken into account, the same way as in canDonateTo.
Determines whether the person with this blood type can safely donate blood to the given recipient, as far as the ABO component is concerned. Blood of type A can be safely donated to recipients with type A or AB; blood of type B to recipients of type B or AB; blood of type O to recipients with any ABO type; and blood of type AB only to recipients who also have AB blood. More information: Red Blood Cell Compatibility.
Determines whether the person with this blood type can safely donate blood to the given recipient, as far as the ABO component is concerned. Blood of type A can be safely donated to recipients with type A or AB; blood of type B to recipients of type B or AB; blood of type O to recipients with any ABO type; and blood of type AB only to recipients who also have AB blood. More information: Red Blood Cell Compatibility.
Note that this method entirely ignores the rhesus component.
Parameters
recipient
the blood type of the person who would receive the blood of this type
Determines whether the person with this blood type can safely donate blood to the given recipient, as far as the rhesus component is concerned. Blood with a negative rhesus component is safe to both positive and negative recipients; blood with a positive rhesus is only safe for positive recipients. More information: Red Blood Cell Compatibility.
Determines whether the person with this blood type can safely donate blood to the given recipient, as far as the rhesus component is concerned. Blood with a negative rhesus component is safe to both positive and negative recipients; blood with a positive rhesus is only safe for positive recipients. More information: Red Blood Cell Compatibility.
Note that this method entirely ignores the ABO component.
Parameters
recipient
the blood type of the person who would receive the blood of this type
Returns a string representation of the blood type. This will be one of "A", "B", "AB", or "O" followed by either "+" or "-". For example, if the type’s ABO component is "A" and its rhesus component false, this method returns "A-".
Returns a string representation of the blood type. This will be one of "A", "B", "AB", or "O" followed by either "+" or "-". For example, if the type’s ABO component is "A" and its rhesus component false, this method returns "A-".