Package com.rs.seagull.emulator.api
Class StopConditions.StopConditionAdapter
java.lang.Object
com.rs.seagull.emulator.api.StopConditions.StopConditionAdapter
- All Implemented Interfaces:
Condition
,Table.StopCondition
- Direct Known Subclasses:
StopConditions.CompositeStopCondition
,StopConditions.EndMarkerStopCondition
- Enclosing class:
- StopConditions
public abstract static class StopConditions.StopConditionAdapter
extends Object
implements Table.StopCondition
An abstract superclass for most concrete StopConditions.
-
Field Summary
Modifier and TypeFieldDescriptionfinal boolean
True if the text comparison should be contains() rather than equals()final boolean
True if the text comparison should ignore caseScript source script that implements isTrue and "returns" (ends with) a boolean, can be nullstatic final org.apache.logging.log4j.Logger
The logger for StopConditionAdapterfinal int
The maximum number of pages to retrievefinal Session
The sessionfinal boolean
True if the test should be done before processing the page -
Constructor Summary
ConstructorDescriptionStopConditionAdapter
(Session session) Create a newStopConditions.StopConditionAdapter
.StopConditionAdapter
(Session session, boolean ignoreCase, boolean testBefore, boolean contains) Create a newStopConditions.StopConditionAdapter
.StopConditionAdapter
(Session session, boolean ignoreCase, boolean testBefore, boolean contains, int maxPages) Create a newStopConditions.StopConditionAdapter
.StopConditionAdapter
(Session session, boolean testBefore, int maxPages) Create a newStopConditions.StopConditionAdapter
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if the condition's isTrue method should be called before processing a page (versus after).void
eachPage()
Called after each scroll.boolean
Called for each row, also gives the StopCondition a chance to skip rows.void
Increment the page count.void
initialize will be called once before iterating through the pages of a Table.abstract boolean
Returns true if the Condition is satisfied.boolean
isTrue()
Returns true if the Condition is satisfied.boolean
Return true if actual "equals" expected, where "equals" takes into account the ignoreCase and contains settings.void
setJavascriptIsTrueScript
(String script) Allow the isTrue method to be implemented in javascript, which allows for extensibility.
-
Field Details
-
LOG
public static final org.apache.logging.log4j.Logger LOGThe logger for StopConditionAdapter -
session
The session -
ignoreCase
public final boolean ignoreCaseTrue if the text comparison should ignore case -
testBefore
public final boolean testBeforeTrue if the test should be done before processing the page -
contains
public final boolean containsTrue if the text comparison should be contains() rather than equals() -
jsIsTrueScript
Script source script that implements isTrue and "returns" (ends with) a boolean, can be null -
maxPages
public final int maxPagesThe maximum number of pages to retrieve
-
-
Constructor Details
-
StopConditionAdapter
public StopConditionAdapter(Session session, boolean ignoreCase, boolean testBefore, boolean contains) Create a newStopConditions.StopConditionAdapter
. The maximum pages to retrieve is not set.- Parameters:
session
- The session.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().
-
StopConditionAdapter
Create a newStopConditions.StopConditionAdapter
. Does not ignore case and comparison is done using equals().- Parameters:
session
- The session.testBefore
- True if the test should be done before processing the page.maxPages
- the maximum number of pages to retrieve
-
StopConditionAdapter
Create a newStopConditions.StopConditionAdapter
. Does not ignore case, test is done after the page and comparison is done using equals().- Parameters:
session
- The session.
-
StopConditionAdapter
public StopConditionAdapter(Session session, boolean ignoreCase, boolean testBefore, boolean contains, int maxPages) Create a newStopConditions.StopConditionAdapter
.- Parameters:
session
- The session.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
-
-
Method Details
-
isTrue
public boolean isTrue()Description copied from interface:Condition
Returns true if the Condition is satisfied. -
innerIsTrue
public abstract boolean innerIsTrue()Returns true if the Condition is satisfied.- Returns:
- true if the Condition is satisfied.
-
initialize
public void initialize()Description copied from interface:Table.StopCondition
initialize will be called once before iterating through the pages of a Table.- Specified by:
initialize
in interfaceTable.StopCondition
-
doTestBeforeProcessingPage
public boolean doTestBeforeProcessingPage()Description copied from interface:Table.StopCondition
Returns true if the condition's isTrue method should be called before processing a page (versus after).- Specified by:
doTestBeforeProcessingPage
in interfaceTable.StopCondition
- Returns:
- whether or not to call the condition's isTrue method before processing the page
-
eachPage
public void eachPage()Description copied from interface:Table.StopCondition
Called after each scroll.- Specified by:
eachPage
in interfaceTable.StopCondition
-
eachRow
Description copied from interface:Table.StopCondition
Called for each row, also gives the StopCondition a chance to skip rows. Return true to include the row, false to skip it.- Specified by:
eachRow
in interfaceTable.StopCondition
- Parameters:
row
- the current row to check- Returns:
- whether or not to include the row
-
setJavascriptIsTrueScript
Allow the isTrue method to be implemented in javascript, which allows for extensibility. During execution of the script, hostSession is the active Session and stopCondition is this StopConditionAdapter.- Parameters:
script
- source script that implements isTrue and "returns" (ends with) a boolean.
-
isTrue
Return true if actual "equals" expected, where "equals" takes into account the ignoreCase and contains settings.- Parameters:
actual
- the actual valueexpected
- the expected value- Returns:
- true if actual "equals" expected
-
incrementPageCount
public void incrementPageCount()Increment the page count.
-