Class TrailItemSet.AllItems

Enclosing class:
TrailItemSet

public static final class TrailItemSet.AllItems extends TrailItemSet
Represents a set of all items.
  • Field Details

  • Constructor Details

    • AllItems

      public AllItems()
  • Method Details

    • contains

      public boolean contains(ItemIdentity id)
      Description copied from class: TrailItemSet
      Checks if the set contains the given item.
      Specified by:
      contains in class TrailItemSet
      Parameters:
      id - item ID
      Returns:
      true if the item is a part of this set
    • expand

      @NotNull public TrailItemSet expand(ItemIdentity trailItem)
      Description copied from class: TrailItemSet

      Expands the set to include the given item. The result of this operation is a new set, which a) includes everything this set includes, b) includes given item.

      Note that the resulting set may contain more items, due to escalation to a more wide set class. If you expand a set by a sufficient number of items, it will switch to be type-based set, which will contain all items of the given types.

      Specified by:
      expand in class TrailItemSet
      Parameters:
      trailItem - item to add to the set
      Returns:
      a new set with all items from this set and with trailItem
    • union

      @NotNull public TrailItemSet union(@Nullable TrailItemSet anotherSet)
      Description copied from class: TrailItemSet

      Creates a new set with all items from this and anotherSet sets.

      If anotherSet == null or this.equals(anotherSet) - this set should be returned

      Note that:

      • AllItems set union with any set is always AllItems set.
      • Type-based set union with any set is type-based set.
      • None union with non null anotherSet set is always anotherSet set.
      • Union of NON type-set may switch to be type-based set if number of items after union is sufficient.
      • Union of type-set may switch to be AllItems set if number of types after union is sufficient.
      Specified by:
      union in class TrailItemSet
      Parameters:
      anotherSet - - another set to union with this
      Returns:
      a new set with all items of this set and anotherSet
    • accept

      public void accept(@NotNull TrailItemSet.Visitor visitor)
      Description copied from class: TrailItemSet
      Allows the caller to perform per-subclass actions.
      Specified by:
      accept in class TrailItemSet