Package com.rs.seagull.emulator.api
Class PropertyCondition
java.lang.Object
com.rs.seagull.emulator.api.AbstractCondition
com.rs.seagull.emulator.api.PropertyCondition
- All Implemented Interfaces:
Condition
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 Summary
Modifier and TypeFieldDescriptionstatic final org.apache.logging.log4j.Logger
The logger forPropertyCondition
Fields inherited from class com.rs.seagull.emulator.api.AbstractCondition
semaphore
-
Constructor Summary
ConstructorDescriptionCreate aPropertyCondition
.PropertyCondition
(com.rs.seagull.emulator.api.impl.ModelMemberHolder model) Create aPropertyCondition
with the provided model member.PropertyCondition
(com.rs.seagull.emulator.api.impl.ModelMemberHolder model, Object targetValue, String... propertyNames) Create aPropertyCondition
with the provided model member, property names and target value.PropertyCondition
(com.rs.seagull.emulator.api.impl.ModelMemberHolder model, String propertyName) Create aPropertyCondition
with the provided model member and one property name.PropertyCondition
(com.rs.seagull.emulator.api.impl.ModelMemberHolder model, String... propertyNames) Create aPropertyCondition
with the provided model member and property names.PropertyCondition
(com.rs.seagull.emulator.api.impl.ModelMemberHolder model, String propertyName, Object targetValue) Create aPropertyCondition
with the provided model member, property name and target value.PropertyCondition
(Object targetValue, String... propertyNames) Create aPropertyCondition
with the provided property names and target value.PropertyCondition
(String propertyName) Create aPropertyCondition
with the provided property name.PropertyCondition
(String... propertyNames) Create aPropertyCondition
with the provided property names.PropertyCondition
(String propertyName, boolean includeChangeCount) Create aPropertyCondition
with the provided property name and flag whether to include the change-count.PropertyCondition
(String propertyName, Object targetValue) Create aPropertyCondition
with the provided property name and target value. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanUp()
Clean up, e.g.Get the host session.Deprecated.Returns a collection of model properties which, when changed, causes the condition to be evaluated.String[]
Returns an array of model properties which, when changed, causes the condition to be evaluated.Get the target value.abstract boolean
isTrue()
Returns true if the Condition is satisfied.void
setTrigger
(Semaphore semaphore, BareSession session) Set the trigger condition.toString()
-
Field Details
-
LOG
public static final org.apache.logging.log4j.Logger LOGThe logger forPropertyCondition
-
-
Constructor Details
-
PropertyCondition
public PropertyCondition(com.rs.seagull.emulator.api.impl.ModelMemberHolder model, String propertyName) Create aPropertyCondition
with the provided model member and one property name. Target value stays empty. The change-count is included.- Parameters:
model
- the provided model memberpropertyName
- the provided property name
-
PropertyCondition
public PropertyCondition(com.rs.seagull.emulator.api.impl.ModelMemberHolder model, String... propertyNames) Create aPropertyCondition
with the provided model member and property names. Target value stays empty. The change-count is included.- Parameters:
model
- the provided model memberpropertyNames
- the provided property names
-
PropertyCondition
Create aPropertyCondition
with the provided property name. Target value and model member stay empty. The change-count is included.- Parameters:
propertyName
- the provided property name
-
PropertyCondition
Create aPropertyCondition
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 aPropertyCondition
with the provided model member, property name and target value. The change-count is included.- Parameters:
model
- the provided model memberpropertyName
- the provided property nametargetValue
- the provided target value
-
PropertyCondition
public PropertyCondition(com.rs.seagull.emulator.api.impl.ModelMemberHolder model, Object targetValue, String... propertyNames) Create aPropertyCondition
with the provided model member, property names and target value. The change-count is included.- Parameters:
model
- the provided model membertargetValue
- the provided target valuepropertyNames
- the provided property names
-
PropertyCondition
Create aPropertyCondition
with the provided property name and target value. Model member stays empty. The change-count is included.- Parameters:
propertyName
- the provided property nametargetValue
- the provided target value
-
PropertyCondition
Create aPropertyCondition
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 nameincludeChangeCount
- the flag whether to include the change-count
-
PropertyCondition
Create aPropertyCondition
with the provided property names and target value. Model member stays empty. The change-count is included.- Parameters:
targetValue
- the provided target valuepropertyNames
- the provided property names
-
PropertyCondition
public PropertyCondition(com.rs.seagull.emulator.api.impl.ModelMemberHolder model) Create aPropertyCondition
with the provided model member. Target value stays empty. The change-count is included.- Parameters:
model
- the provided model member
-
PropertyCondition
public PropertyCondition()Create aPropertyCondition
. Target value and model member stay empty. The change-count is included.
-
-
Method Details
-
getPropertyName
Deprecated.will returnnull
is there are no property names otherwise returns the alphabetically first property nameReturns 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
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
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
Get the target value.- Returns:
- the target value
-
setTrigger
Description copied from class:AbstractCondition
Set the trigger condition.- Specified by:
setTrigger
in classAbstractCondition
- Parameters:
semaphore
- the semaphore to wait for a conditionsession
- 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 classAbstractCondition
-
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
-
null
is there are no property names otherwise returns the alphabetically first property name