public class SingletonOrOrderedSet<V> extends Object
Constructor and Description |
---|
SingletonOrOrderedSet(AvlTree<V> orderedSet)
Creates a new instance of SingletonOrOrderedSet with a set of ordered
values.
|
SingletonOrOrderedSet(V singleton)
Creates a new instance of SingletonOrOrderedSet with a singleton value.
|
Modifier and Type | Method and Description |
---|---|
AvlTree<V> |
getOrderedSet()
Gets the ordered set.
|
V |
getSingleton()
Gets the singleton value.
|
boolean |
isOrderedSet()
Gets whether or not the stored value is an ordered set.
|
boolean |
isSingleton()
Gets whether or not the stored value is a singleton.
|
AvlTree<V> |
setOrderedSet(AvlTree<V> orderedSet)
Sets the set of ordered values.
|
V |
setSingleton(V singleton)
Sets the singleton if in singleton mode.
|
V |
switchToOrderedSet(AvlTree<V> orderedSet)
Switches from orderedSet mode to singleton mode, while returning the
singleton value before removing it forever.
|
AvlTree<V> |
switchToSingleton(V singleton)
Switches from orderedSet mode to singleton mode, while returning the
ordered set of values before removing them forever.
|
public SingletonOrOrderedSet(V singleton)
singleton
- the singleton valuepublic SingletonOrOrderedSet(AvlTree<V> orderedSet)
orderedSet
- the set of ordered valuespublic boolean isSingleton()
public boolean isOrderedSet()
public V getSingleton()
RuntimeException
- if not in singleton modepublic V setSingleton(V singleton)
singleton
- the singleton value to setpublic AvlTree<V> switchToSingleton(V singleton)
singleton
- the singleton valueRuntimeException
- if already in singleton modepublic AvlTree<V> getOrderedSet()
RuntimeException
- if in singleton modepublic AvlTree<V> setOrderedSet(AvlTree<V> orderedSet)
orderedSet
- the set of ordered values to useRuntimeException
- if in singleton modepublic V switchToOrderedSet(AvlTree<V> orderedSet)
orderedSet
- the AvlTree to use for orderedSet of valuesRuntimeException
- if the mode is already in orderedSet mode.Copyright © 2003–2020 The Apache Software Foundation. All rights reserved.