class BloodType extends AnyRef
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 reprents the ABO component as a string and the rhesus component as a boolean
so that true
corresponds to positive and false
to negative.
- Alphabetic
- By Inheritance
- BloodType
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new BloodType(abo: String, rhesus: Boolean)
- 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
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val abo: String
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def canDonateTo(recipient: BloodType): Boolean
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.
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.
- recipient
the blood type of the person who would receive the blood of this type
- def canReceiveFrom(donor: BloodType): Boolean
Determines whether the person with this blood type can safely receive blood donated by the given person.
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.
- donor
the blood type of the donor
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hasSafeABOFor(recipient: BloodType): Boolean
Determines whether the person with this blood type can safely donate blood to the given recipient, as far as the ABO component is concerned.
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.
- recipient
the blood type of the person who would receive the blood of this type
- def hasSafeRhesusFor(recipient: BloodType): Boolean
Determines whether the person with this blood type can safely donate blood to the given recipient, as far as the rhesus component is concerned.
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.
- recipient
the blood type of the person who would receive the blood of this type
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- val rhesus: Boolean
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString: String
Returns a string representation of the blood 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-".- Definition Classes
- BloodType → AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.