Package com.rs.seagull.emulator.api
Class StopConditions
java.lang.Object
com.rs.seagull.emulator.api.StopConditions
Static methods for creating common Table.StopCondition's.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
A StopCondition where the stop condition is a value in a field.static class
An abstract superclass for most concrete StopConditions. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Parameter: containsstatic final String
Parameter: ignoreCasestatic final String
Parameter: includeMarkerRowstatic final String
Parameter: isTrueFunctionstatic final org.apache.logging.log4j.Logger
The logger for StopConditionsstatic final String
Parameter: markerFieldstatic final String
Parameter: markerValuestatic final String
Parameter: maxRecordCountstatic final String
Parameter: resetKeystatic final String
Parameter: stopConditionstatic final String
Parameter: testBefore -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Table.StopCondition
columnContainsValue
(Session session, String markerField, String markerValue, boolean includeMarkerRow, boolean ignoreCase, boolean testBefore, boolean contains, int maxPages) Returns a StopCondition where the end is indicated by a particular column field having a particular value anywhere within it.static Table.StopCondition
composite
(Session session, List<Table.StopCondition> conditions, int maxPages) Create a StopCondition that is composed of multiple StopConditions.static Table.StopCondition
defaultStopCondition
(Session session, Table table, int maxPages) Returns a StopCondition that is a composite of FirstPageMatches and TwoPagesMatch.static Table.StopCondition
emptyMarker
(Session session, String markerField, boolean testBefore, int maxPages) Returns a StopCondition where the end is indicated by a particular field becoming empty.static Table.StopCondition
endMarker
(Session session, String markerField, String markerValue, boolean ignoreCase, boolean testBefore, boolean contains, String isTrueFunction, int maxPages) Returns a StopCondition where the end is indicated by a particular field having a particular value.static Table.StopCondition
firstPageMatches
(Session session, Table table, int maxPages) Returns a StopCondition where the end is reached when the first page appears again.static Table.StopCondition
javaScript
(Session session, String script) Create a StopCondition that uses JavaScript to determine when to stop.static Table.StopCondition
operatorError
(Session session, Table table, int maxPages, String resetKey) Returns a StopCondition where the end is reached when an operator error occurs.static Table.StopCondition
screenChanges
(Session session, com.rs.seagull.emulator.api.impl.TableImpl tableImpl, int maxPages) Returns a StopCondition where the end is reached when the screen changes.static Table.StopCondition
twoFieldsMatch
(Session session, String markerField1, String markerField2, boolean ignoreCase, boolean testBefore, boolean contains, int maxPages) Returns a StopCondition where the end is reached when two particular fields contain the same value.static Table.StopCondition
twoPagesMatch
(Session session, Table table, int maxPages) Returns a StopCondition where the end is reached when two consecutive pages match.
-
Field Details
-
LOG
public static final org.apache.logging.log4j.Logger LOGThe logger for StopConditions -
MARKER_FIELD_PARAM
Parameter: markerField- See Also:
-
MARKER_VALUE_PARAM
Parameter: markerValue- See Also:
-
IGNORE_CASE_PARAM
Parameter: ignoreCase- See Also:
-
CONTAINS_PARAM
Parameter: contains- See Also:
-
TEST_BEFORE_PARAM
Parameter: testBefore- See Also:
-
INCLUDE_MARKER_ROW_PARAM
Parameter: includeMarkerRow- See Also:
-
IS_TRUE_FUNCTION_PARAM
Parameter: isTrueFunction- See Also:
-
STOP_CONDITION_JS_PARAM
Parameter: stopCondition- See Also:
-
MAX_PAGES_PARAM
Parameter: maxRecordCount- See Also:
-
RESET_KEY_PARAM
Parameter: resetKey- See Also:
-
-
Constructor Details
-
StopConditions
public StopConditions()
-
-
Method Details
-
endMarker
public static Table.StopCondition endMarker(Session session, String markerField, String markerValue, boolean ignoreCase, boolean testBefore, boolean contains, String isTrueFunction, int maxPages) Returns a StopCondition where the end is indicated by a particular field having a particular value.- Parameters:
session
- The session.markerField
- The name of the marker field.markerValue
- The value the marker field has when the end of the table is reached.ignoreCase
- True if the text comparison should ignore case.testBefore
- True if the test should be done before processing the page.contains
- True if the text comparison should be contains() rather than equals().isTrueFunction
- An optional javascript isTrue function.maxPages
- the maximum number of pages to retrieve- Returns:
- a StopCondition.
-
emptyMarker
public static Table.StopCondition emptyMarker(Session session, String markerField, boolean testBefore, int maxPages) Returns a StopCondition where the end is indicated by a particular field becoming empty.- Parameters:
session
- The session.markerField
- The name of the marker field.testBefore
- True if the test should be done before processing the page.maxPages
- the maximum number of pages to retrieve- Returns:
- a StopCondition.
-
twoFieldsMatch
public static Table.StopCondition twoFieldsMatch(Session session, String markerField1, String markerField2, boolean ignoreCase, boolean testBefore, boolean contains, int maxPages) Returns a StopCondition where the end is reached when two particular fields contain the same value. An example of this is "page x of y" where the "x" and the "y" are the two fields. When the "x" is equal to the "y", you're at the end.- Parameters:
session
- The session.markerField1
- The name of the first marker field.markerField2
- The name of the second marker field.ignoreCase
- True if the text comparison should ignore case.testBefore
- True if the test should be done before processing the page.contains
- True if the text comparison should be contains() rather than equals().maxPages
- the maximum number of pages to retrieve- Returns:
- a StopCondition.
-
columnContainsValue
public static Table.StopCondition columnContainsValue(Session session, String markerField, String markerValue, boolean includeMarkerRow, boolean ignoreCase, boolean testBefore, boolean contains, int maxPages) Returns a StopCondition where the end is indicated by a particular column field having a particular value anywhere within it.- Parameters:
session
- The session.markerField
- The name of the marker column field.markerValue
- The value the marker field contains when the end of the table is reached.includeMarkerRow
- True if the row with the marker value in it should be included in the table's rows.ignoreCase
- True if the text comparison should ignore case.testBefore
- True if the test should be done before processing the page.contains
- True if the text comparison should be contains() rather than equals().maxPages
- the maximum number of pages to retrieve- Returns:
- a StopCondition.
-
twoPagesMatch
Returns a StopCondition where the end is reached when two consecutive pages match.- Parameters:
session
- The session.table
- The table.maxPages
- the maximum number of pages to retrieve- Returns:
- a StopCondition.
-
defaultStopCondition
Returns a StopCondition that is a composite of FirstPageMatches and TwoPagesMatch.- Parameters:
session
- The session.table
- The table.maxPages
- the maximum number of pages to retrieve- Returns:
- a StopCondition.
-
firstPageMatches
Returns a StopCondition where the end is reached when the first page appears again.- Parameters:
session
- The session.table
- The table.maxPages
- the maximum number of pages to retrieve- Returns:
- a StopCondition.
-
screenChanges
public static Table.StopCondition screenChanges(Session session, com.rs.seagull.emulator.api.impl.TableImpl tableImpl, int maxPages) Returns a StopCondition where the end is reached when the screen changes.- Parameters:
session
- The session.tableImpl
- The table.maxPages
- the maximum number of pages to retrieve- Returns:
- a StopCondition.
-
operatorError
public static Table.StopCondition operatorError(Session session, Table table, int maxPages, String resetKey) Returns a StopCondition where the end is reached when an operator error occurs.- Parameters:
session
- The session.table
- The table.maxPages
- the maximum number of pages to retrieveresetKey
- the reset key to use to reset an operator error- Returns:
- a StopCondition.
-
javaScript
Create a StopCondition that uses JavaScript to determine when to stop.- Parameters:
session
- The session.script
- the JavaScript- Returns:
- a StopCondition.
-
composite
public static Table.StopCondition composite(Session session, List<Table.StopCondition> conditions, int maxPages) Create a StopCondition that is composed of multiple StopConditions.- Parameters:
session
- The session.conditions
- the StopConditions this StopCondition is composed ofmaxPages
- the maximum number of pages to retrieve- Returns:
- a StopCondition.
-