Package jahuwaldt.js.datareader
Class DataCase
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- jahuwaldt.js.datareader.DataElementList<DataParam>
-
- jahuwaldt.js.datareader.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 ofparameters
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
-
-
Field Summary
-
Fields inherited from interface jahuwaldt.js.datareader.DataElement
RESOURCES
-
-
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 anyparameters
found in the specified collection.-
Methods inherited from class jahuwaldt.js.datareader.DataElementList
compareTo, equals, get, get, getIndexFromName, getName, getUserObject, hashCode, iterator, listIterator, listIterator, remove, remove, reset, setName, setUserObject, size, toString, toText, unmodifiable
-
Methods inherited from class java.util.AbstractList
add, addAll, clear, indexOf, lastIndexOf, subList
-
-
-
-
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 anyparameters
found in the specified collection. Any objects that are notDataParam
objects in the specified collection will be ignored.- Parameters:
name
- The name to be assigned to this case (may not benull
).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 interfacejava.util.List<DataParam>
- Overrides:
set
in classDataElementList<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 interfacejava.util.List<DataParam>
- Overrides:
add
in classDataElementList<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 classDataElementList<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 classDataElementList<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<TextParam> getAllText()
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<ScalarParam> getAllScalars()
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<ArrayParam> getAllArrays()
Returns a list of all the ArrayParam objects in this case. If there are no array parameters, null is returned.
-
newInstance
public static DataCase newInstance(java.lang.CharSequence name)
-
-