Methods
addSubcondition(subcondition)
Add a subcondition (unfulfilled).
This can be used to generate a new threshold condition from a set of subconditions or to provide a non-fulfilled subcondition when creating a threshold fulfillment.
Parameters:
Name | Type | Description |
---|---|---|
subcondition |
Condition | String | Condition object or URI string representing a new subcondition to be added. |
- Source:
addSubfulfillment(subfulfillment)
Add a fulfilled subcondition.
When constructing a threshold fulfillment, this method allows you to provide a fulfillment for one of the subconditions.
Note that you do not have to add the subcondition if you're adding the fulfillment. The condition can be calculated from the fulfillment and will be added automatically.
Parameters:
Name | Type | Description |
---|---|---|
subfulfillment |
Fulfillment | String | Fulfillment object or URI string representing a new subfulfillment to be added. |
- Source:
getSubtypes() → {Number}
Get set of used type names.
This is a type of condition that can contain subconditions. A complete set of subtypes must contain all types that must be supported in order to validate this fulfillment. Therefore, we need to join the type of this fulfillment with all of the sets of subtypes for each of the subconditions.
- Source:
Returns:
Complete set of types for this fulfillment.
- Type
- Number
setThreshold(threshold)
Set the threshold.
Determines the threshold that is used to consider this condition fulfilled. If the number of valid subfulfillments is greater or equal to this number, the threshold condition is considered to be fulfilled.
Parameters:
Name | Type | Description |
---|---|---|
threshold |
Number | Integer threshold |
- Source:
validate(message) → {Boolean}
Check whether this fulfillment meets all validation criteria.
This will validate the subfulfillments and verify that there are enough subfulfillments to meet the threshold.
Parameters:
Name | Type | Description |
---|---|---|
message |
Buffer | Message to validate against. |
- Source:
Returns:
Whether this fulfillment is valid.
- Type
- Boolean