Class TrailItemSet.OneType
Object
TrailItemSet
OneType
- Enclosing class:
- TrailItemSet
Represents a set of all items of one specific type.
-
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(TrailItemSet.Visitor visitor) Allows the caller to perform per-subclass actions.booleancontains(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 fromthisandanotherSetsets.Methods inherited from class TrailItemSet
containsAny, equals, hashCode, isEmpty, of, of, ofTypes, toString
-
Method Details
-
getItemType
-
contains
Description copied from class:TrailItemSetChecks if the set contains the given item.- Specified by:
containsin classTrailItemSet- Parameters:
id- item ID- Returns:
- true if the item is a part of this set
-
expand
Description copied from class:TrailItemSetExpands 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:
expandin 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:TrailItemSetCreates a new set with all items from
thisandanotherSetsets.If
anotherSet == nullorthis.equals(anotherSet)-thisset should be returnedNote that:
AllItemsset union with any set is alwaysAllItemsset.- Type-based set union with any set is type-based set.
Noneunion with non nullanotherSetset is alwaysanotherSetset.- 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
AllItemsset if number of types after union is sufficient.
- Specified by:
unionin classTrailItemSet- Parameters:
anotherSet- - another set to union withthis- Returns:
- a new set with all items of
thisset andanotherSet
-
accept
Description copied from class:TrailItemSetAllows the caller to perform per-subclass actions.- Specified by:
acceptin classTrailItemSet
-