Package org.yamcs.parameter
Class ParameterValueList
- All Implemented Interfaces:
Iterable<ParameterValue>
,Collection<ParameterValue>
,List<ParameterValue>
Stores a collection of ParameterValue indexed on Parameter
it works like a LinkedHashMap<Parameter, LinkedList<ParameterValue>>
it also works like a LinkedList<ParameterValue;>
Not thread safe
-
Field Summary
FieldsFields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(ParameterValue pv) boolean
addAll
(Collection<? extends ParameterValue> c) Adds all element to this collectionstatic ParameterValueList
asList
(ParameterValue... pvs) void
clear()
Throws UnsupportedOperationExceptionboolean
Return true if the list contains the exact same ParameterValue.boolean
containsAll
(Collection<?> c) Throws UnsupportedOperationExceptionint
Return the number of values for pvoid
forEach
(Parameter p, Consumer<ParameterValue> action) Performs the given action for each value of the parameter p The values are considered in insertion order - oldest is first to be processedReturns the n'th instance of the parameter or null if it does not existgetFirst()
Returns first inserted parameter value for the given parameter or null if there is nonegetFromEnd
(Parameter p, int n) Returns the n'th instance of the parameter from the end or null if it does not existgetLast()
Returns the last inserted value for Parameter p or null if there is no valueint
getSize()
boolean
isEmpty()
iterator()
listIterator
(int index) boolean
Throws UnsupportedOperationExceptionboolean
removeAll
(Collection<?> c) Throws UnsupportedOperationExceptionRemove the first inserted value for Parameter pRemove the last inserted value for Parameter pboolean
retainAll
(Collection<?> c) Throws UnsupportedOperationExceptionint
size()
Creates an iterator which is positioned on the end of the list but returns all the elements added after the iterator has been created.Object[]
toArray()
Returns a copy of the list as array<T> T[]
toArray
(T[] a) Throws UnsupportedOperationExceptiontoString()
Methods inherited from class java.util.AbstractList
equals, hashCode, indexOf, lastIndexOf, listIterator, removeRange, subList
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.List
replaceAll, sort, spliterator
-
Field Details
-
EMPTY
-
-
Constructor Details
-
ParameterValueList
public ParameterValueList() -
ParameterValueList
- Parameters:
pvs
-
-
-
Method Details
-
add
- Specified by:
add
in interfaceCollection<ParameterValue>
- Specified by:
add
in interfaceList<ParameterValue>
- Overrides:
add
in classAbstractList<ParameterValue>
-
count
Return the number of values for p- Parameters:
p
-- Returns:
-
getFirst
-
getLast
-
getSize
public int getSize() -
getLastInserted
Returns the last inserted value for Parameter p or null if there is no value- Parameters:
p
-- Returns:
-
getFirstInserted
Returns first inserted parameter value for the given parameter or null if there is none- Parameters:
p
-- Returns:
-
get
Returns the n'th instance of the parameter or null if it does not existIf n = 0 it is equivalent with
getFirstInserted(Parameter)
-
getFromEnd
Returns the n'th instance of the parameter from the end or null if it does not existIf n = 0 it is equivalent with
getLastInserted(Parameter)
-
forEach
Performs the given action for each value of the parameter p The values are considered in insertion order - oldest is first to be processed- Parameters:
p
-action
-
-
removeLast
Remove the last inserted value for Parameter p- Parameters:
p
-- Returns:
- the value removed or null if there was no value for p
-
removeFirst
Remove the first inserted value for Parameter p- Parameters:
p
-- Returns:
- the value removed or null if there was no value for p
-
tailIterator
Creates an iterator which is positioned on the end of the list but returns all the elements added after the iterator has been created.Removing elements will invalidate the iterator.
- Returns:
-
iterator
- Specified by:
iterator
in interfaceCollection<ParameterValue>
- Specified by:
iterator
in interfaceIterable<ParameterValue>
- Specified by:
iterator
in interfaceList<ParameterValue>
- Overrides:
iterator
in classAbstractSequentialList<ParameterValue>
-
addAll
Adds all element to this collection- Specified by:
addAll
in interfaceCollection<ParameterValue>
- Specified by:
addAll
in interfaceList<ParameterValue>
- Overrides:
addAll
in classAbstractCollection<ParameterValue>
- Parameters:
c
-- Returns:
-
clear
public void clear()Throws UnsupportedOperationException- Specified by:
clear
in interfaceCollection<ParameterValue>
- Specified by:
clear
in interfaceList<ParameterValue>
- Overrides:
clear
in classAbstractList<ParameterValue>
-
contains
Return true if the list contains the exact same ParameterValue. That means exactly the same object.- Specified by:
contains
in interfaceCollection<ParameterValue>
- Specified by:
contains
in interfaceList<ParameterValue>
- Overrides:
contains
in classAbstractCollection<ParameterValue>
- Parameters:
o
-- Returns:
-
containsAll
Throws UnsupportedOperationException- Specified by:
containsAll
in interfaceCollection<ParameterValue>
- Specified by:
containsAll
in interfaceList<ParameterValue>
- Overrides:
containsAll
in classAbstractCollection<ParameterValue>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<ParameterValue>
- Specified by:
isEmpty
in interfaceList<ParameterValue>
- Overrides:
isEmpty
in classAbstractCollection<ParameterValue>
-
remove
Throws UnsupportedOperationException- Specified by:
remove
in interfaceCollection<ParameterValue>
- Specified by:
remove
in interfaceList<ParameterValue>
- Overrides:
remove
in classAbstractCollection<ParameterValue>
-
removeAll
Throws UnsupportedOperationException- Specified by:
removeAll
in interfaceCollection<ParameterValue>
- Specified by:
removeAll
in interfaceList<ParameterValue>
- Overrides:
removeAll
in classAbstractCollection<ParameterValue>
-
retainAll
Throws UnsupportedOperationException- Specified by:
retainAll
in interfaceCollection<ParameterValue>
- Specified by:
retainAll
in interfaceList<ParameterValue>
- Overrides:
retainAll
in classAbstractCollection<ParameterValue>
-
size
public int size()- Specified by:
size
in interfaceCollection<ParameterValue>
- Specified by:
size
in interfaceList<ParameterValue>
- Specified by:
size
in classAbstractCollection<ParameterValue>
-
toArray
Returns a copy of the list as array- Specified by:
toArray
in interfaceCollection<ParameterValue>
- Specified by:
toArray
in interfaceList<ParameterValue>
- Overrides:
toArray
in classAbstractCollection<ParameterValue>
-
toArray
public <T> T[] toArray(T[] a) Throws UnsupportedOperationException- Specified by:
toArray
in interfaceCollection<ParameterValue>
- Specified by:
toArray
in interfaceList<ParameterValue>
- Overrides:
toArray
in classAbstractCollection<ParameterValue>
-
toString
- Overrides:
toString
in classAbstractCollection<ParameterValue>
-
listIterator
- Specified by:
listIterator
in interfaceList<ParameterValue>
- Specified by:
listIterator
in classAbstractSequentialList<ParameterValue>
-
asList
-