Packages

c

o1.blood

BloodType

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.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BloodType
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. 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

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val abo: String
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. 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

  7. 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

  8. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  12. 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

  13. 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

  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  19. val rhesus: Boolean
  20. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  21. 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
  22. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  23. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  24. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. 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.

Inherited from AnyRef

Inherited from Any

Ungrouped