Package com.nomagic.uml2.ext.jmi
Class OptimizedForSingleValueSet<T>
- java.lang.Object
-
- com.nomagic.uml2.ext.jmi.OptimizedForSingleValueSet<T>
-
- Direct Known Subclasses:
ModelPropertyChangeListeners.ListenerContainer
,ModelPropertyChangeListeners.ListenerContainerSet
public abstract class OptimizedForSingleValueSet<T> extends java.lang.Object
The set with optimized memory usage for storing a single value.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object
holder
private boolean
holderArray
-
Constructor Summary
Constructors Constructor Description OptimizedForSingleValueSet()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
add(T object)
Add object to setprivate boolean
addSingle(T object)
private boolean
addToArray(T object)
private T[]
holderToArray()
boolean
isEmpty()
protected abstract T[]
newArray(int length)
boolean
remove(T object)
Remove object from setprivate boolean
removeFromArray(T object)
private boolean
removeSingle(T object)
T[]
toArray()
-
-
-
Method Detail
-
add
public boolean add(T object)
Add object to set- Parameters:
object
- object- Returns:
- true if object was added to a set
-
remove
public boolean remove(T object)
Remove object from set- Parameters:
object
- object- Returns:
- true if object was removed from the set
-
isEmpty
public boolean isEmpty()
- Returns:
- true if set is empty
-
toArray
public T[] toArray()
- Returns:
- values as array (not a copy array!)
-
addSingle
private boolean addSingle(T object)
-
addToArray
private boolean addToArray(T object)
-
newArray
protected abstract T[] newArray(int length)
-
removeSingle
private boolean removeSingle(T object)
-
removeFromArray
private boolean removeFromArray(T object)
-
holderToArray
@Nonnull private T[] holderToArray()
-
-