Class AbstractWorker

java.lang.Object
de.calamanari.pk.iterator.AbstractWorker
Direct Known Subclasses:
Worker

public abstract class AbstractWorker
extends java.lang.Object
Abstract Worker (a COMPOSITE-interface) represents the AGGREGATE (abstract base class), an iterator will be created for.
Author:
Karl Eilebrecht
  • Field Summary

    Fields
    Modifier and Type Field Description
    static java.util.Comparator<AbstractWorker> BY_NAME_COMPARATOR
    Default comparator, only compares the names for bringing workers into a natural order.
  • Constructor Summary

    Constructors
    Constructor Description
    AbstractWorker​(java.lang.String name)
    Creates a new Worker with the given name
  • Method Summary

    Modifier and Type Method Description
    abstract java.util.Iterator<? extends AbstractWorker> createSubordinatesIterator()
    A concrete Worker return an iterator of all his direct and indirect subordinates (recursively)
    java.lang.String getName()
    Returns the worker's name
    void setName​(java.lang.String name)
    Sets the worker's name
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • BY_NAME_COMPARATOR

      public static final java.util.Comparator<AbstractWorker> BY_NAME_COMPARATOR
      Default comparator, only compares the names for bringing workers into a natural order.
  • Constructor Details

    • AbstractWorker

      public AbstractWorker​(java.lang.String name)
      Creates a new Worker with the given name
      Parameters:
      name - person's name
  • Method Details

    • getName

      public java.lang.String getName()
      Returns the worker's name
      Returns:
      name
    • setName

      public void setName​(java.lang.String name)
      Sets the worker's name
      Parameters:
      name - person's name
    • createSubordinatesIterator

      public abstract java.util.Iterator<? extends AbstractWorker> createSubordinatesIterator()
      A concrete Worker return an iterator of all his direct and indirect subordinates (recursively)
      Returns:
      iterator of subordinates, NEVER NULL
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object