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 Parameter

it works like a LinkedHashMap<Parameter, LinkedList<ParameterValue>>

it also works like a LinkedList<ParameterValue;>

Not thread safe

  • Field Details

  • Constructor Details

    • ParameterValueList

      public ParameterValueList()
    • ParameterValueList

      public ParameterValueList(Collection<ParameterValue> pvs)
      Parameters:
      pvs -
  • Method Details

    • add

      public boolean add(ParameterValue pv)
      Specified by:
      add in interface Collection<ParameterValue>
    • count

      public int count(org.yamcs.xtce.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(org.yamcs.xtce.Parameter p)
      Returns the last inserted value for Parameter p or null if there is no value
      Parameters:
      p -
      Returns:
    • getFirstInserted

      public ParameterValue getFirstInserted(org.yamcs.xtce.Parameter p)
      Returns first inserted parameter value for the given parameter or null if there is none
      Parameters:
      p -
      Returns:
    • get

      public ParameterValue get(org.yamcs.xtce.Parameter p, int n)
      Returns the n'th instance of the parameter or null if it does not exist

      If n = 0 it is equivalent with getFirstInserted(Parameter)

    • getFromEnd

      public ParameterValue getFromEnd(org.yamcs.xtce.Parameter p, int n)
      Returns the n'th instance of the parameter from the end or null if it does not exist

      If n = 0 it is equivalent with getLastInserted(Parameter)

    • forEach

      public void forEach(org.yamcs.xtce.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(org.yamcs.xtce.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(org.yamcs.xtce.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
    • tailIterator

      public Iterator<ParameterValue> 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

      public Iterator<ParameterValue> iterator()
      Specified by:
      iterator in interface Collection<ParameterValue>
      Specified by:
      iterator in interface Iterable<ParameterValue>
    • addAll

      public boolean addAll(Collection<? extends ParameterValue> c)
      Adds all element to this collection
      Specified by:
      addAll in interface Collection<ParameterValue>
      Parameters:
      c -
      Returns:
    • clear

      public void clear()
      Throws UnsupportedOperationException
      Specified by:
      clear in interface Collection<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:
      contains in interface Collection<ParameterValue>
      Parameters:
      o -
      Returns:
    • containsAll

      public boolean containsAll(Collection<?> c)
      Throws UnsupportedOperationException
      Specified by:
      containsAll in interface Collection<ParameterValue>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Collection<ParameterValue>
    • remove

      public boolean remove(Object o)
      Throws UnsupportedOperationException
      Specified by:
      remove in interface Collection<ParameterValue>
    • removeAll

      public boolean removeAll(Collection<?> c)
      Throws UnsupportedOperationException
      Specified by:
      removeAll in interface Collection<ParameterValue>
    • retainAll

      public boolean retainAll(Collection<?> c)
      Throws UnsupportedOperationException
      Specified by:
      retainAll in interface Collection<ParameterValue>
    • size

      public int size()
      Specified by:
      size in interface Collection<ParameterValue>
    • toArray

      public Object[] toArray()
      Returns a copy of the list as array
      Specified by:
      toArray in interface Collection<ParameterValue>
    • toArray

      public <T> T[] toArray(T[] a)
      Throws UnsupportedOperationException
      Specified by:
      toArray in interface Collection<ParameterValue>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • asList

      public static ParameterValueList asList(ParameterValue... pvs)