IBM Rational Functional Tester
Version 8.1.1000
IBM Rational Functional Tester API Reference

Project Version 2.3

com.rational.test.ft.script
Class List

java.lang.Object   extended by com.rational.test.ft.script.Subitem
      extended by com.rational.test.ft.script.List

public class List
extends Subitem

Represents a sequence of subitems. For example, a node in a tree is represented as a sequence of nodes that lead to the desired node, as in Music->Jazz->Louis Armstrong->Star Dust.

A List is represented in the script as an atPath method if all the members of the sequence are Text or Index values. If any value in the sequence is neither a Text value nor an Index value, or if any value in the sequence is a Text value with an additional text index, an atList method is used in the script.

Examples of possible List values in a script are:

In the above examples, the List subitems are represented as calls to atPath and atList.

Since:
RFT1.0

Constructor Summary
List()
          Creates an empty list of subitems.
List(java.lang.String path)
          Builds the list of subitems from a path specification.
List(Subitem subitem)
          Creates a single element list of subitems.
List(Subitem[] subitems)
          Creates a list of subitems from the specified array of subitems.
List(Subitem subitem1, Subitem subitem2)
          Creates a two-element list of subitems.
List(Subitem subitem1, Subitem subitem2, Subitem subitem3)
          Creates a three-element list of subitems.
List(Subitem subitem1, Subitem subitem2, Subitem subitem3, Subitem subitem4)
          Creates a four-element list of subitems.
 
Method Summary
 void append(Subitem subitem)
          Appends a subitem to the end of the existing list of subitems.
 void append(Subitem[] subitems)
          Appends an array of subitems to the end of the existing list of subitems.
 boolean equals(java.lang.Object other)
          Compares two List objects and returns true if all elements in both lists are equal.
static boolean equals(Subitem[] left, Subitem[] right)
          Compares two arrays of subitem objects.
 Subitem getFirstSubitem()
          Returns the first element in the list or null if the list is empty.
 Subitem getLastSubitem()
          Returns the last element in the list or null if the list is empty.
 java.lang.String getPath()
          Converts the active list of subitems into a path string that can be used by a script.
 Subitem getSubitem(int index)
          Returns the subitem at the specified index in the list.
 int getSubitemCount()
          Returns the number of subitems represented in the list.
 Subitem[] getSubitems()
          Returns an array containing all subitems associated with this list.
 java.lang.String toString()
          Returns a string representation of the subitems in the list.
 boolean usePath()
          Returns true if the list of subitems should be represented as a path in a script.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

List

public List()
Creates an empty list of subitems.

Since:
RFT1.0

List

public List(Subitem subitem)
Creates a single element list of subitems.

Parameters:
subitem - the first subitem in the new list
Since:
RFT1.0

List

public List(Subitem subitem1,             Subitem subitem2)
Creates a two-element list of subitems.

Parameters:
subitem1 - the first subitem in the new list
subitem2 - the second subitem in the new list
Since:
RFT1.0

List

public List(Subitem subitem1,             Subitem subitem2,             Subitem subitem3)
Creates a three-element list of subitems.

Parameters:
subitem1 - the first subitem in the new list
subitem2 - the second subitem in the new list
subitem3 - the third subitem in the new list
Since:
RFT1.0

List

public List(Subitem subitem1,             Subitem subitem2,             Subitem subitem3,             Subitem subitem4)
Creates a four-element list of subitems.

Parameters:
subitem1 - the first subitem in the new list
subitem2 - the second subitem in the new list
subitem3 - the third subitem in the new list
subitem4 - the fourth subitem in the new list
Since:
RFT1.0

List

public List(Subitem[] subitems)
Creates a list of subitems from the specified array of subitems.

Parameters:
subitems - the array of subitems to use in the initial list
Since:
RFT1.0

List

public List(java.lang.String path)
Builds the list of subitems from a path specification. The path is a sequence of Text or Index subitems separated by a ->. Text sequences are represented in raw form and cannot contain nested separator character sequences. Index sequences are represented in an Index(int) specification.

Parameters:
path - the string representation of a series of subitems separated by a -> sequence of characters
Since:
RFT1.0
Method Detail

append

public void append(Subitem subitem)
Appends a subitem to the end of the existing list of subitems.

Parameters:
subitem - the new subitem to append to the existing list
Since:
RFT1.0

append

public void append(Subitem[] subitems)
Appends an array of subitems to the end of the existing list of subitems.

Parameters:
subitems - the new subitems to append to the existing list
Since:
RFT1.0

getSubitemCount

public int getSubitemCount()
Returns the number of subitems represented in the list.

Since:
RFT1.0

getSubitem

public Subitem getSubitem(int index)
Returns the subitem at the specified index in the list. The index is zero based and must be in the range zero to getSubitemCount()-1. An index outside the range of available subitems causes a java.lang.ArrayIndexOutOfBoundsException exception to be thrown.

Parameters:
index - the index of the desired subitem
Since:
RFT1.0

getSubitems

public Subitem[] getSubitems()
Returns an array containing all subitems associated with this list. If no subitems are in the list, an empty array is returned.

Since:
RFT1.0

getFirstSubitem

public Subitem getFirstSubitem()
Returns the first element in the list or null if the list is empty.

Returns:
The first element in the list or null if the list is empty.
Since:
RFT1.1

getLastSubitem

public Subitem getLastSubitem()
Returns the last element in the list or null if the list is empty.

Returns:
The last element in the list or null if the list is empty.
Since:
RFT1.1

usePath

public boolean usePath()
Returns true if the list of subitems should be represented as a path in a script. The criterion for being considered a path in the script is that all subitems must be either a Text subitem without a text index or an Index subitem.

Returns:
true if the list of subitems should be represented as a path in a script
Since:
RFT1.0

getPath

public java.lang.String getPath()
Converts the active list of subitems into a path string that can be used by a script.

Since:
RFT1.0

equals

public boolean equals(java.lang.Object other)
Compares two List objects and returns true if all elements in both lists are equal. This is an ordered comparison of the nested subitem values.

Overrides:
equals in class java.lang.Object
Parameters:
list - the list of subitems to compare this list of subitems against
Since:
RFT1.0

equals

public static boolean equals(Subitem[] left,                              Subitem[] right)
Compares two arrays of subitem objects. This method is a shortcut that creates two List objects and compares them.

Parameters:
left - the left array
right - the right side of the compare
Returns:
true if the values are the same
Since:
RFT1.0

toString

public java.lang.String toString()
Returns a string representation of the subitems in the list.

Overrides:
toString in class java.lang.Object
Since:
RFT1.0