Class PropertyCondition

java.lang.Object
com.rs.seagull.emulator.api.AbstractCondition
com.rs.seagull.emulator.api.PropertyCondition
All Implemented Interfaces:
Condition

public abstract class PropertyCondition extends AbstractCondition
An implementation of Condition that includes model property names which indicates when a waitFor should 'wake up' to evaluate the condition. For example, say there's a condition to check for the cursor being at a particular point, then the property would be "CursorPoint". In addition, a targetValue may be optionally supplied. If it is, then the property's changed value (newValue) must equal the targetValue for the condition to be evaluated.
Version:
$Id$
  • Field Details

    • LOG

      public static final org.apache.logging.log4j.Logger LOG
      The logger for PropertyCondition
  • Constructor Details

    • PropertyCondition

      public PropertyCondition(com.rs.seagull.emulator.api.impl.ModelMemberHolder model, String propertyName)
      Create a PropertyCondition with the provided model member and one property name. Target value stays empty. The change-count is included.
      Parameters:
      model - the provided model member
      propertyName - the provided property name
    • PropertyCondition

      public PropertyCondition(com.rs.seagull.emulator.api.impl.ModelMemberHolder model, String... propertyNames)
      Create a PropertyCondition with the provided model member and property names. Target value stays empty. The change-count is included.
      Parameters:
      model - the provided model member
      propertyNames - the provided property names
    • PropertyCondition

      public PropertyCondition(String propertyName)
      Create a PropertyCondition with the provided property name. Target value and model member stay empty. The change-count is included.
      Parameters:
      propertyName - the provided property name
    • PropertyCondition

      public PropertyCondition(String... propertyNames)
      Create a PropertyCondition with the provided property names. Target value and model member stay empty. The change-count is included.
      Parameters:
      propertyNames - the provided property names
    • PropertyCondition

      public PropertyCondition(com.rs.seagull.emulator.api.impl.ModelMemberHolder model, String propertyName, Object targetValue)
      Create a PropertyCondition with the provided model member, property name and target value. The change-count is included.
      Parameters:
      model - the provided model member
      propertyName - the provided property name
      targetValue - the provided target value
    • PropertyCondition

      public PropertyCondition(com.rs.seagull.emulator.api.impl.ModelMemberHolder model, Object targetValue, String... propertyNames)
      Create a PropertyCondition with the provided model member, property names and target value. The change-count is included.
      Parameters:
      model - the provided model member
      targetValue - the provided target value
      propertyNames - the provided property names
    • PropertyCondition

      public PropertyCondition(String propertyName, Object targetValue)
      Create a PropertyCondition with the provided property name and target value. Model member stays empty. The change-count is included.
      Parameters:
      propertyName - the provided property name
      targetValue - the provided target value
    • PropertyCondition

      public PropertyCondition(String propertyName, boolean includeChangeCount)
      Create a PropertyCondition with the provided property name and flag whether to include the change-count. Target value and model member stay empty.
      Parameters:
      propertyName - the provided property name
      includeChangeCount - the flag whether to include the change-count
    • PropertyCondition

      public PropertyCondition(Object targetValue, String... propertyNames)
      Create a PropertyCondition with the provided property names and target value. Model member stays empty. The change-count is included.
      Parameters:
      targetValue - the provided target value
      propertyNames - the provided property names
    • PropertyCondition

      public PropertyCondition(com.rs.seagull.emulator.api.impl.ModelMemberHolder model)
      Create a PropertyCondition with the provided model member. Target value stays empty. The change-count is included.
      Parameters:
      model - the provided model member
    • PropertyCondition

      public PropertyCondition()
      Create a PropertyCondition. Target value and model member stay empty. The change-count is included.
  • Method Details

    • getPropertyName

      @Deprecated public String getPropertyName()
      Deprecated.
      will return null is there are no property names otherwise returns the alphabetically first property name
      Returns a model property that, when changed, causes the condition to be evaluated. See available property names in HostModel and HostInteraction. Note that if a Condition does not supply a property name, then the condition will be evaluated every time *any* property changes.
      Returns:
      the name of a HostModel property
    • getPropertyNames

      public Set<String> getPropertyNames()
      Returns a collection of model properties which, when changed, causes the condition to be evaluated. See available property names in HostModel and HostInteraction. Note that if a Condition does not supply any property name, then the condition will be evaluated every time *any* property changes.
      Returns:
      the names of the HostModel properties
    • getPropertyNamesAsArray

      public String[] getPropertyNamesAsArray()
      Returns an array of model properties which, when changed, causes the condition to be evaluated. See available property names in HostModel and HostInteraction. Note that if a Condition does not supply any property name, then the condition will be evaluated every time *any* property changes.
      Returns:
      the names of the HostModel properties
    • getTargetValue

      public Object getTargetValue()
      Get the target value.
      Returns:
      the target value
    • setTrigger

      public void setTrigger(Semaphore semaphore, BareSession session)
      Description copied from class: AbstractCondition
      Set the trigger condition.
      Specified by:
      setTrigger in class AbstractCondition
      Parameters:
      semaphore - the semaphore to wait for a condition
      session - the session for which to wait for the condition
    • cleanUp

      public void cleanUp()
      Description copied from class: AbstractCondition
      Clean up, e.g. remove listeners.
      Overrides:
      cleanUp in class AbstractCondition
    • getHostSession

      public BareSession getHostSession()
      Get the host session.
      Returns:
      the host session
    • isTrue

      public abstract boolean isTrue()
      Description copied from interface: Condition
      Returns true if the Condition is satisfied.
      Returns:
      true if the Condition is satisfied.
    • toString

      public String toString()
      Overrides:
      toString in class Object