Package eu.bandm.tools.ops
Class RtArraySet2<D>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<D>
eu.bandm.tools.ops.RtArraySet2<D>
- All Implemented Interfaces:
Iterable<D>
,Collection<D>
,Set<D>
A set implementation for real-time application.
Based on an array of references.
"Lock-Free" variant of a "Real-Time Array Set".
DISCUSS: not yet clear whether the old dynamic form for "size()" is more efficient, -- it needs one "atomic" variable less. (!?)
ATTENTION: This class restricts the contract of "Iterator": Once "
DISCUSS: not yet clear whether the old dynamic form for "size()" is more efficient, -- it needs one "atomic" variable less. (!?)
ATTENTION: This class restricts the contract of "Iterator": Once "
hasNext()==false
" has returned, all following behaviour
is unspecified and further usage forbidden. (The Iterator object will be recycled.)-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
any()
Get one arbitrarily chosen element and remove it.int
capacity()
void
clear()
boolean
Delegate directly to superclass.void
Apply code to all elements.int
hashCode()
Delegate directly to superclass.iterator()
boolean
int
size()
ATTENTION however implemented, there is always a race condition between the result of "size()" and the following number of contained elements, unless ADDITIONALLY enclosed in some "critical section", or sim.Methods inherited from class java.util.AbstractSet
removeAll
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.Set
addAll, contains, containsAll, isEmpty, retainAll, spliterator, toArray, toArray
-
Constructor Details
-
RtArraySet2
public RtArraySet2(int capacity) -
RtArraySet2
public RtArraySet2(int capacity, int iterators)
-
-
Method Details
-
equals
Delegate directly to superclass. Only semantics shall be subject to equals(), not the implementation.- Specified by:
equals
in interfaceCollection<D>
- Specified by:
equals
in interfaceSet<D>
- Overrides:
equals
in classAbstractSet<D>
-
hashCode
public int hashCode()Delegate directly to superclass. @see #equals(Object)- Specified by:
hashCode
in interfaceCollection<D>
- Specified by:
hashCode
in interfaceSet<D>
- Overrides:
hashCode
in classAbstractSet<D>
-
add
- Specified by:
add
in interfaceCollection<D>
- Specified by:
add
in interfaceSet<D>
- Overrides:
add
in classAbstractCollection<D>
-
capacity
public int capacity() -
size
public int size()ATTENTION however implemented, there is always a race condition between the result of "size()" and the following number of contained elements, unless ADDITIONALLY enclosed in some "critical section", or sim.- Specified by:
size
in interfaceCollection<D>
- Specified by:
size
in interfaceSet<D>
- Specified by:
size
in classAbstractCollection<D>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<D>
- Specified by:
clear
in interfaceSet<D>
- Overrides:
clear
in classAbstractCollection<D>
-
iterator
-
remove
- Specified by:
remove
in interfaceCollection<D>
- Specified by:
remove
in interfaceSet<D>
- Overrides:
remove
in classAbstractCollection<D>
-
any
Get one arbitrarily chosen element and remove it.
(This is an dditional method not in the "java.util.Set" interface.) -
forEach
Apply code to all elements.
-