Package org.yamcs.parameter
Class ParameterValueList
java.lang.Object
org.yamcs.parameter.ParameterValueList
- All Implemented Interfaces:
Iterable<ParameterValue>
,Collection<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
-
Constructor Summary
-
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()
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.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Field Details
-
EMPTY
-
-
Constructor Details
-
ParameterValueList
public ParameterValueList() -
ParameterValueList
- Parameters:
pvs
-
-
-
Method Details
-
add
- Specified by:
add
in interfaceCollection<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>
-
addAll
Adds all element to this collection- Specified by:
addAll
in interfaceCollection<ParameterValue>
- Parameters:
c
-- Returns:
-
clear
public void clear()Throws UnsupportedOperationException- Specified by:
clear
in interfaceCollection<ParameterValue>
-
contains
Return true if the list contains the exact same ParameterValue. That means exactly the same object.- Specified by:
contains
in interfaceCollection<ParameterValue>
- Parameters:
o
-- Returns:
-
containsAll
Throws UnsupportedOperationException- Specified by:
containsAll
in interfaceCollection<ParameterValue>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<ParameterValue>
-
remove
Throws UnsupportedOperationException- Specified by:
remove
in interfaceCollection<ParameterValue>
-
removeAll
Throws UnsupportedOperationException- Specified by:
removeAll
in interfaceCollection<ParameterValue>
-
retainAll
Throws UnsupportedOperationException- Specified by:
retainAll
in interfaceCollection<ParameterValue>
-
size
public int size()- Specified by:
size
in interfaceCollection<ParameterValue>
-
toArray
Returns a copy of the list as array- Specified by:
toArray
in interfaceCollection<ParameterValue>
-
toArray
public <T> T[] toArray(T[] a) Throws UnsupportedOperationException- Specified by:
toArray
in interfaceCollection<ParameterValue>
-
toString
-
asList
-