Class TrailItemSet.AllItems
Object
TrailItemSet
AllItems
- Enclosing class:
- TrailItemSet
Represents a set of all items.
-
Nested Class Summary
Nested classes/interfaces inherited from class TrailItemSet
TrailItemSet.AllItems, TrailItemSet.Collector, TrailItemSet.None, TrailItemSet.OneItem, TrailItemSet.OneType, TrailItemSet.ReadVisitor, TrailItemSet.SpecificItems, TrailItemSet.SpecificTypes, TrailItemSet.Visitor
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(TrailItemSet.Visitor visitor) Allows the caller to perform per-subclass actions.boolean
contains
(ItemIdentity id) Checks if the set contains the given item.expand
(ItemIdentity trailItem) Expands the set to include the given item.union
(TrailItemSet anotherSet) Creates a new set with all items fromthis
andanotherSet
sets.Methods inherited from class TrailItemSet
containsAny, equals, hashCode, isEmpty, of, of, ofTypes, toString
-
Field Details
-
ALL_ITEMS
-
-
Constructor Details
-
AllItems
public AllItems()
-
-
Method Details
-
contains
Description copied from class:TrailItemSet
Checks if the set contains the given item.- Specified by:
contains
in classTrailItemSet
- Parameters:
id
- item ID- Returns:
- true if the item is a part of this set
-
expand
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 classTrailItemSet
- Parameters:
trailItem
- item to add to the set- Returns:
- a new set with all items from this set and with
trailItem
-
union
Description copied from class:TrailItemSet
Creates a new set with all items from
this
andanotherSet
sets.If
anotherSet == null
orthis.equals(anotherSet)
-this
set should be returnedNote that:
AllItems
set union with any set is alwaysAllItems
set.- Type-based set union with any set is type-based set.
None
union with non nullanotherSet
set is alwaysanotherSet
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 classTrailItemSet
- Parameters:
anotherSet
- - another set to union withthis
- Returns:
- a new set with all items of
this
set andanotherSet
-
accept
Description copied from class:TrailItemSet
Allows the caller to perform per-subclass actions.- Specified by:
accept
in classTrailItemSet
-