Class LabelStack

All Implemented Interfaces:
Serializable, Cloneable, Iterable<String>, Collection<String>, Deque<String>, List<String>, Queue<String>

public class LabelStack extends LinkedList<String>
Collection of labels applied to a cell. Used for conditional styling and behavior.
See Also:
  • Constructor Details

    • LabelStack

      public LabelStack(String... labels)
      Creates a LabelStack initialized with the given labels.
      Parameters:
      labels - The labels that should be initially added to the created LabelStack.
    • LabelStack

      public LabelStack(Collection<String> labels)
      Creates a LabelStack initialized with the given labels.
      Parameters:
      labels - The labels that should be initially added to the created LabelStack.
      Since:
      2.0
  • Method Details

    • addLabel

      public boolean addLabel(String label)
      Adds a label to the bottom of the label stack.
      Parameters:
      label - The label to add.
      Returns:
      true if the label was added, false if adding failed.
      Since:
      2.0
    • addLabelOnTop

      public void addLabelOnTop(String label)
      Adds a label to the top of the label stack. If the label is already in the label stack it is moved to the top.
      Parameters:
      label - The label to add.
    • getLabels

      @Deprecated public List<String> getLabels()
      Deprecated.
      As LabelStack is itself a collection, the usage of this method is not needed anymore.
      Returns:
      The label stack collection.
    • hasLabel

      public boolean hasLabel(String label)
      Check if the given label is on the label stack.
      Parameters:
      label - The label to test.
      Returns:
      true if the label stack contains the given label, false if not.
    • hasAllLabels

      public boolean hasAllLabels(String... labels)
      Check if all given labels are on the label stack.
      Parameters:
      labels - The labels to test.
      Returns:
      true if the label stack contains all given labels, false if not.
      Since:
      2.3
    • hasAllLabels

      public boolean hasAllLabels(List<String> labels)
      Check if all given labels are on the label stack.
      Parameters:
      labels - The labels to test.
      Returns:
      true if the label stack contains all given labels, false if not.
      Since:
      2.3
    • removeLabel

      public boolean removeLabel(String label)
      Removes the given label from the label stack.
      Parameters:
      label - The label to remove.
      Returns:
      true if the label was removed, false if not.