Object functions
Object functions define conditions based on objects (as opposed to attributes of
objects). A customer is an object; the age of the customer is an attribute of the customer
object.
| Syntax | Description | Example |
|---|---|---|
<object> is <object>
|
Tests that two objects are equivalent. Important: Rules can modify the value of
decision variables, but not the value of input variables. As a result, when comparing the value of a
decision variable with the value of an input variable, the function might return
false. |
if 'current customer' is the customer on 'rental agreement'
|
<object> is not <object>
|
Tests that two objects are not equivalent. |
if 'current customer' is not the customer on 'rental agreement'
|
the number of <objects>
|
Returns the total number of objects of the specified type. |
if the number of vehicles is more than 5
|
<attribute> of <object>
|
Associates two business terms. |
if the address of customer contains "France"
|
new <object> where
|
Creates a new instance of the specified object type. To define the values of this new object,
you add the where keyword followed by one or more attributes. |
define Jane as a new customer where 'customer id' is "jane@example.com"
|
a copy of <object> where
|
Creates a copy of the specified object type. To define the values of this new object, you add
the where keyword followed by one or more attributes.Important: The
copy constructor differs from standard constructors: it copies the value of
attributes that are not specified in the where clause. |
define 'new address' as a copy of 'original address'
where the street number is 22
|