Class Divider

Object
Divider

public class Divider extends Object
Creates a line of text that span a certain width with a repeated character, optionally containing a label.
Author:
Owen Feehan
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final char
    The default character used in the divider, if not otherwise specified in the constructor.
    static final int
    The default total nubmer of characters to use in the divier, if not otherwise specified in the constructor.
  • Constructor Summary

    Constructors
    Constructor
    Description
    A banner using dashes.
    Divider(char characterToRepeat)
    A banner using a particular repeated character.
    Divider(char characterToRepeat, int numberCharactersInBanner)
    A banner using a particular repeated character.
    Divider(int numberCharactersInBanner)
    A banner using dashes, with a particular number of characters.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a line of repeated dashes with a centered label of text.
    Creates a line of repeated dashes.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_CHARACTER

      public static final char DEFAULT_CHARACTER
      The default character used in the divider, if not otherwise specified in the constructor.
      See Also:
    • DEFAULT_NUMBER_CHARACTERS_IN_BANNER

      public static final int DEFAULT_NUMBER_CHARACTERS_IN_BANNER
      The default total nubmer of characters to use in the divier, if not otherwise specified in the constructor.
      See Also:
  • Constructor Details

    • Divider

      public Divider()
      A banner using dashes.
    • Divider

      public Divider(int numberCharactersInBanner)
      A banner using dashes, with a particular number of characters.
      Parameters:
      numberCharactersInBanner - the number of characters in the banner.
    • Divider

      public Divider(char characterToRepeat)
      A banner using a particular repeated character.
      Parameters:
      characterToRepeat - the character that is repeated.
    • Divider

      public Divider(char characterToRepeat, int numberCharactersInBanner)
      A banner using a particular repeated character.
      Parameters:
      characterToRepeat - the character that is repeated.
      numberCharactersInBanner - the number of characters in the banner.
  • Method Details

    • withoutLabel

      public String withoutLabel()
      Creates a line of repeated dashes.
      Returns:
      a string of repeated dashes to total 80 chracters.
    • withLabel

      public String withLabel(String label)
      Creates a line of repeated dashes with a centered label of text.

      The label of text is padded by one character of whitespace on either side.

      Parameters:
      label - the label
      Returns:
      a string of repreated dashes including a label to total 80 characters