Constructor
new Evaluator(className)
Evaluator constructor
| Name | Type | Description |
|---|---|---|
className | string | The class name of this evaluator. |
Members
checkcase :boolean
Whether uppercase and lowercase expressions must be considered equivalent or not.
- boolean
className :string
The type of evaluator.
- string
collator :external:Collator
The Intl.Collator object used to compare strings, when available.
initiated :boolean
Whether this evaluator has been initialized or not.
- boolean
Methods
_checkText(_text, _match) → {boolean}
Abstract method to be implemented in subclasses.
Performs the validation of a string against a single match.
| Name | Type | Description |
|---|---|---|
_text | string | The text to be checked |
_match | string | A valid expression with which to compare. |
truewhen the two expressions can be considered equivalent.
- Type:
- boolean
_evalText(_text, _match) → {Array.<number>}
Abstract method to be implemented in subclasses.
Performs the evaluation of a string against an array of valid matches, returning an array of
flags useful to indicate where the mistakes are located.
| Name | Type | Description |
|---|---|---|
_text | string | The text to be checked |
_match | string | A valid expression with which to compare. |
- An array of flags (one number for character) indicating whether each
position is erroneous or OK.
- Type:
- Array.<number>
checkText(text, match) → {boolean}
Checks the given text against a set of valid matches
| Name | Type | Description |
|---|---|---|
text | string | The text to be checked |
match | string | | The valid expression or expressions with which to compare. |
trueif the checked expression is valid,falseotherwise.
- Type:
- boolean
evalText(text, match) → {Array.<number>}
Evaluates the given text against a set of valid matches, returning an array of flags useful
to indicate where the mistakes are located.
| Name | Type | Description |
|---|---|---|
text | string | The text to be checked |
match | string | | The valid expression or expressions with which to compare. |
- An array of flags (one number for character) indicating whether each
position is erroneous or ok.
- Type:
- Array.<number>
getAttributes() → {object}
Gets a object with the basic attributes needed to rebuild this instance excluding functions,
parent references, constants and also attributes retaining the default value.
The resulting object is commonly usued to serialize elements in JSON format.
- The resulting object, with minimal attrributes
- Type:
- object
init(_locales)
Initializes this evaluator
| Name | Type | Description |
|---|---|---|
_locales | Array.<string> | An array of valid locales, to be used by Intl.Collator |
isOk(flags) → {boolean}
Checks if the given array of flags (usually returned by evalText) can be considered as a
valid or erroneous answer.
| Name | Type | Description |
|---|---|---|
flags | Array.<number> |
truewhen there is at least one flag and all flags are 0 (meaning no error).
- Type:
- boolean
setProperties($xml)
Loads the object settings from a specific JQuery XML element
| Name | Type | Description |
|---|---|---|
$xml | external:jQuery | The jQuery XML element to parse |
(static) factory(data) → {module:activities/text/Evaluator.Evaluator}
Builds a new Evaluator, based on the properties specified in a data object
| Name | Type | Description |
|---|---|---|
data | object | The data object to be parsed |
(static) getEvaluator($xml) → {module:activities/text/Evaluator.Evaluator}
Factory constructor that returns a specific type of Evaluator based on the class
attribute declared in the $xml element.
| Name | Type | Description |
|---|---|---|
$xml | external:jQuery | The XML element to be parsed. |