Class TeamModel

java.lang.Object
de.calamanari.pk.modelviewcontroller.TeamModel

public class TeamModel
extends java.lang.Object
Team Model - the MODEL in this MVC-example holding the member data of a team.
Author:
Karl Eilebrecht
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static interface  TeamModel.TeamModelObserver
    Team Model Observer - allows to observe model changes.
  • Constructor Summary

    Constructors
    Constructor Description
    TeamModel()
    Creates new empty model
  • Method Summary

    Modifier and Type Method Description
    void add​(java.lang.String member)
    Adds the member to the list
    java.lang.String getMember​(int idx)
    Returns the member at the given position
    void remove​(int idx)
    Removes the specified member from the list
    void setModelObserver​(TeamModel.TeamModelObserver observer)
    Sets the model observer, one at a time
    int size()
    Returns the model's size

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TeamModel

      public TeamModel()
      Creates new empty model
  • Method Details

    • setModelObserver

      public void setModelObserver​(TeamModel.TeamModelObserver observer)
      Sets the model observer, one at a time
      Parameters:
      observer - model observer (replaces existing)
    • add

      public void add​(java.lang.String member)
      Adds the member to the list
      Parameters:
      member - the member to add
    • getMember

      public java.lang.String getMember​(int idx)
      Returns the member at the given position
      Parameters:
      idx - member position, 0-based
      Returns:
      member or null if the member does not exist
    • remove

      public void remove​(int idx)
      Removes the specified member from the list
      Parameters:
      idx - member position, 0-based
    • size

      public int size()
      Returns the model's size
      Returns:
      size