Package org.yamcs.parameter
Class ParameterValueList
- java.lang.Object
-
- org.yamcs.parameter.ParameterValueList
-
- All Implemented Interfaces:
Iterable<ParameterValue>,Collection<ParameterValue>
public class ParameterValueList extends Object implements Collection<ParameterValue>
Stores a collection of ParameterValue indexed on Parameterit works like a LinkedHashMap<Parameter, LinkedList<ParameterValue>>
it also works like a LinkedList<ParameterValue;>
Not thread safe
-
-
Constructor Summary
Constructors Constructor Description ParameterValueList()ParameterValueList(Collection<ParameterValue> pvs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(ParameterValue pv)booleanaddAll(Collection<? extends ParameterValue> c)Adds all element to this collectionvoidclear()Throws UnsupportedOperationExceptionbooleancontains(Object o)Return true if the list contains the exact same ParameterValue.booleancontainsAll(Collection<?> c)Throws UnsupportedOperationExceptionintcount(Parameter p)Return the number of values for pvoidforEach(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 processedParameterValuegetFirst()ParameterValuegetFirstInserted(Parameter p)ParameterValuegetLast()ParameterValuegetLastInserted(Parameter p)Returns the last inserted value for Parameter p or null if there is no valueintgetSize()booleanisEmpty()Iterator<ParameterValue>iterator()booleanremove(Object o)Throws UnsupportedOperationExceptionbooleanremoveAll(Collection<?> c)Throws UnsupportedOperationExceptionParameterValueremoveFirst(Parameter p)Remove the first inserted value for Parameter pParameterValueremoveLast(Parameter p)Remove the last inserted value for Parameter pbooleanretainAll(Collection<?> c)Throws UnsupportedOperationExceptionintsize()Object[]toArray()Returns a copy of the list as array<T> T[]toArray(T[] a)Throws UnsupportedOperationExceptionStringtoString()-
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
-
-
-
-
Constructor Detail
-
ParameterValueList
public ParameterValueList()
-
ParameterValueList
public ParameterValueList(Collection<ParameterValue> pvs)
- Parameters:
pvs-
-
-
Method Detail
-
add
public boolean add(ParameterValue pv)
- Specified by:
addin interfaceCollection<ParameterValue>
-
count
public int count(Parameter p)
Return the number of values for p- Parameters:
p-- Returns:
-
getFirst
public ParameterValue getFirst()
-
getLast
public ParameterValue getLast()
-
getSize
public int getSize()
-
getLastInserted
public ParameterValue getLastInserted(Parameter p)
Returns the last inserted value for Parameter p or null if there is no value- Parameters:
p-- Returns:
-
getFirstInserted
public ParameterValue getFirstInserted(Parameter p)
-
forEach
public void 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 processed- Parameters:
p-action-
-
removeLast
public ParameterValue removeLast(Parameter p)
Remove the last inserted value for Parameter p- Parameters:
p-- Returns:
- the value removed or null if there was no value for p
-
removeFirst
public ParameterValue removeFirst(Parameter p)
Remove the first inserted value for Parameter p- Parameters:
p-- Returns:
- the value removed or null if there was no value for p
-
iterator
public Iterator<ParameterValue> iterator()
- Specified by:
iteratorin interfaceCollection<ParameterValue>- Specified by:
iteratorin interfaceIterable<ParameterValue>
-
addAll
public boolean addAll(Collection<? extends ParameterValue> c)
Adds all element to this collection- Specified by:
addAllin interfaceCollection<ParameterValue>- Parameters:
c-- Returns:
-
clear
public void clear()
Throws UnsupportedOperationException- Specified by:
clearin interfaceCollection<ParameterValue>
-
contains
public boolean contains(Object o)
Return true if the list contains the exact same ParameterValue. That means exactly the same object.- Specified by:
containsin interfaceCollection<ParameterValue>- Parameters:
o-- Returns:
-
containsAll
public boolean containsAll(Collection<?> c)
Throws UnsupportedOperationException- Specified by:
containsAllin interfaceCollection<ParameterValue>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<ParameterValue>
-
remove
public boolean remove(Object o)
Throws UnsupportedOperationException- Specified by:
removein interfaceCollection<ParameterValue>
-
removeAll
public boolean removeAll(Collection<?> c)
Throws UnsupportedOperationException- Specified by:
removeAllin interfaceCollection<ParameterValue>
-
retainAll
public boolean retainAll(Collection<?> c)
Throws UnsupportedOperationException- Specified by:
retainAllin interfaceCollection<ParameterValue>
-
size
public int size()
- Specified by:
sizein interfaceCollection<ParameterValue>
-
toArray
public Object[] toArray()
Returns a copy of the list as array- Specified by:
toArrayin interfaceCollection<ParameterValue>
-
toArray
public <T> T[] toArray(T[] a)
Throws UnsupportedOperationException- Specified by:
toArrayin interfaceCollection<ParameterValue>
-
-