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 Details

    • LOG

      public static final org.apache.logging.log4j.Logger LOG
      The logger for StopConditionAdapter
    • session

      public final Session session
      The session
    • ignoreCase

      public final boolean ignoreCase
      True if the text comparison should ignore case
    • testBefore

      public final boolean testBefore
      True if the test should be done before processing the page
    • contains

      public final boolean contains
      True if the text comparison should be contains() rather than equals()
    • jsIsTrueScript

      public String jsIsTrueScript
      Script source script that implements isTrue and "returns" (ends with) a boolean, can be null
    • maxPages

      public final int maxPages
      The maximum number of pages to retrieve
  • Constructor Details

    • StopConditionAdapter

      public StopConditionAdapter(Session session, boolean ignoreCase, boolean testBefore, boolean contains)
      Create a new StopConditions.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

      public StopConditionAdapter(Session session, boolean testBefore, int maxPages)
      Create a new StopConditions.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

      public StopConditionAdapter(Session session)
      Create a new StopConditions.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)
      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.
      Specified by:
      isTrue in 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 interface Table.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 interface Table.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 interface Table.StopCondition
    • eachRow

      public boolean eachRow(Table.Row row)
      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 interface Table.StopCondition
      Parameters:
      row - the current row to check
      Returns:
      whether or not to include the row
    • setJavascriptIsTrueScript

      public void setJavascriptIsTrueScript(String script)
      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

      public boolean isTrue(String actual, String expected)
      Return true if actual "equals" expected, where "equals" takes into account the ignoreCase and contains settings.
      Parameters:
      actual - the actual value
      expected - the expected value
      Returns:
      true if actual "equals" expected
    • incrementPageCount

      public void incrementPageCount()
      Increment the page count.