Packages

c

o1.family

FamilyMember

class FamilyMember extends AnyRef

The class FamilyMember represents people in a very simple family tree analysis program. Each person has a name and zero or more children. A FamilyMember object is immutable.

Note: All the methods in this class assume that each descendant descends from a person via a single line of ancestry only.

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

Instance Constructors

  1. new FamilyMember(name: String)

    Initializes a new, childless FamilyMember.

  2. new FamilyMember(name: String, children: Vector[FamilyMember])

    name

    the person's name

    children

    the person's children

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. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. val children: Vector[FamilyMember]
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. def everyoneBelow: Vector[FamilyMember]

    Returns all the people in the family tree from this FamilyMember downwards, including this FamilyMember.

    Returns all the people in the family tree from this FamilyMember downwards, including this FamilyMember. That is, the returned collection contains this person and their descendants.

  10. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  11. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  12. def isChildless: Boolean

    Returns true if and only if the person has no children.

  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. def mostChildren: FamilyMember

    Returns the person in the family tree from this FamilyMember downwards (this person included) that has the largest number of children.

    Returns the person in the family tree from this FamilyMember downwards (this person included) that has the largest number of children. (Only immediate descendants count as children.) If called on a childless person, returns that person. In case of a tie, the method will return one of the tied people.

    Consider an example family tree:

    • Odin has one child: Edie.
    • Edie has five children: Molly, Barbara, Calvin, Sam, and Walter.
    • Sam has three children: Dawn, Gus, and Greg.
    • Dawn has three children: Lewis, Milton, and Edith.

    This means that:

    • Called on Odin, the method returns Edie, since she has five children; more than her parent Odin and more than any of her own descendants.
    • Called on Edie, the method returns Edie herself, for the same reason.
    • Called on Molly, the method returns Molly herself, even though she has no children.
    • Called on Sam, the method may return either Sam himself or Sam's daughter Dawn, both of whom have three children.
  15. val name: String
  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. def numberOfChildren: Int

    Returns the number of children the person has.

  20. def numberOfDescendants: Int

    Returns the number of descendants the person has in total.

    Returns the number of descendants the person has in total. A person's descendants are that person's children plus all their descendants.

  21. def numberOfDescendantsAt(generation: Int): Int

    Returns the number of descendants the FamilyMember has in a particular generation (not above, not below).

    Returns the number of descendants the FamilyMember has in a particular generation (not above, not below). A generation is defined here as a number of "steps" that indicates how far removed a set of descendants is from their ancestor. For example, a person's children form a generation at step 1, the person's grandchildren constitute another generation at step 2, the greatgrandchildren at step 3, and so on.

    generation

    a positive number of "steps" that identifies a generation

    returns

    the number of descendants that are exactly the indicated number of steps removed from the person in the family tree

  22. def numberOfDescendingGenerations: Int

    Returns the number of generations below this person in the family tree.

    Returns the number of generations below this person in the family tree. For a person with no children, this will be zero; for someone with at least one child but no grandchildren, this will be one; for someone with grandchildren but no greatgrandchildren, this will be two, and so on.

  23. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  24. def toString: String

    Returns a string representation of the person.

    Returns a string representation of the person.

    Definition Classes
    FamilyMember → AnyRef → Any
  25. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  26. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  27. 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