Class DataCase

  • All Implemented Interfaces:
    DataElement, java.lang.Comparable<DataElement>, java.lang.Iterable<DataParam>, java.util.Collection<DataParam>, java.util.List<DataParam>, javolution.lang.Reusable

    public final class DataCase
    extends DataElementList<DataParam>
    Defines a data element called a case. A case is a collection of parameters or variables that make up a single run or test case. Any number of parameters may be added to a case, but all array type parameters in a single case must have the same number of elements.

    Modified by: Joseph A. Huwaldt

    Version:
    October 15, 2015
    Author:
    Joseph A. Huwaldt, Date: March 5, 2003
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, DataParam element)
      Inserts the specified parameter at the specified position in this case.
      void addAll​(int index, DataParam[] elements)
      Inserts the specified list of parameters at the specified position in this case.
      void addAll​(DataParam[] elements)
      Appends the specified list of parameters to the end of this case.
      void clearAllText()
      Removes all TextParam objects from this case.
      java.util.List<ArrayParam> getAllArrays()
      Returns a list of all the ArrayParam objects in this case.
      int getAllowedArraySize()
      Returns the size of any array in this case (since all arrays must have the same number of elements).
      java.util.List<ScalarParam> getAllScalars()
      Returns a list of all the ScalarParam objects in this case.
      java.util.List<TextParam> getAllText()
      Returns a list of all the Text/Note objects in this case.
      static DataCase newInstance​(java.lang.CharSequence name)  
      static void recycle​(DataCase instance)
      Recycles a case instance immediately (on the stack when executing in a StackContext).
      DataParam set​(int index, DataParam element)
      Replaces the parameter at the specified position in this case with the specified parameter.
      static DataCase valueOf​(java.lang.CharSequence name, java.util.Collection<?> params)
      Return a case made up of any parameters found in the specified collection.
      • Methods inherited from class java.util.AbstractList

        add, addAll, clear, indexOf, lastIndexOf, subList
      • Methods inherited from class java.util.AbstractCollection

        addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
    • Method Detail

      • valueOf

        public static DataCase valueOf​(java.lang.CharSequence name,
                                       java.util.Collection<?> params)
                                throws java.lang.ArrayIndexOutOfBoundsException
        Return a case made up of any parameters found in the specified collection. Any objects that are not DataParam objects in the specified collection will be ignored.
        Parameters:
        name - The name to be assigned to this case (may not be null).
        params - A collection that contains a set of parameters.
        Throws:
        java.lang.ArrayIndexOutOfBoundsException - if an array added to this case has a different number of elements than an array already in this case.
      • set

        public DataParam set​(int index,
                             DataParam element)
        Replaces the parameter at the specified position in this case with the specified parameter. Null elements are ignored.
        Specified by:
        set in interface java.util.List<DataParam>
        Overrides:
        set in class DataElementList<DataParam>
        Parameters:
        index - The index of the parameter to replace.
        element - The parameter to be stored a the specified position.
        Returns:
        The parameter previously at the specified position in this case.
        Throws:
        java.lang.ArrayIndexOutOfBoundsException - if an array added to this case has a different number of elements than an array already in this case.
      • add

        public void add​(int index,
                        DataParam element)
        Inserts the specified parameter at the specified position in this case. Shifts the parameter currently at that position (if any) and any subsequent parameters to the right (adds one to their indices). Null elements are ignored.
        Specified by:
        add in interface java.util.List<DataParam>
        Overrides:
        add in class DataElementList<DataParam>
        Parameters:
        index - Index at which the specified parameter is to be inserted.
        element - DataParam to be inserted.
        Throws:
        java.lang.ClassCastException - if the specified element is not a DataParam type object.
        java.lang.ArrayIndexOutOfBoundsException - if an array added to this case has a different number of elements than an array already in this case.
      • addAll

        public void addAll​(DataParam[] elements)
        Appends the specified list of parameters to the end of this case. Null elements are ignored.
        Overrides:
        addAll in class DataElementList<DataParam>
        Parameters:
        elements - List of parameters to be inserted.
        Throws:
        java.lang.ArrayIndexOutOfBoundsException - if an array added to this case has a different number of elements than an array already in this case.
      • addAll

        public void addAll​(int index,
                           DataParam[] elements)
        Inserts the specified list of parameters at the specified position in this case. Shifts the parameter currently at that position (if any) and any subsequent parameters to the right (adds one to their indices) until all the parameters have been added. Null elements are ignored.
        Overrides:
        addAll in class DataElementList<DataParam>
        Parameters:
        index - Index at which the specified list of parameters is to be inserted.
        elements - List of parameters to be inserted.
        Throws:
        java.lang.ArrayIndexOutOfBoundsException - if an array added to this case has a different number of elements than an array already in this case.
      • getAllowedArraySize

        public int getAllowedArraySize()
        Returns the size of any array in this case (since all arrays must have the same number of elements). If there are no arrays in this case, zero is returned.
      • getAllText

        public java.util.List<TextParamgetAllText()
        Returns a list of all the Text/Note objects in this case. If there are no text parameters, null is returned.
      • clearAllText

        public void clearAllText()
        Removes all TextParam objects from this case.
      • getAllScalars

        public java.util.List<ScalarParamgetAllScalars()
        Returns a list of all the ScalarParam objects in this case. If there are no scalar parameters, null is returned.
      • getAllArrays

        public java.util.List<ArrayParamgetAllArrays()
        Returns a list of all the ArrayParam objects in this case. If there are no array parameters, null is returned.
      • recycle

        public static void recycle​(DataCase instance)
        Recycles a case instance immediately (on the stack when executing in a StackContext).