Constructor
new ActivitySequence(project)
ActivitySequence constructor
Name | Type | Description |
---|---|---|
project | module:project/JClicProject. | The JClic project to which this ActivitySequence belongs |
- Source
Members
currentAct :number
Pointer to the ActivitySequenceElement
currently running (points inside
the elements
array).
- number
- Source
elements :Array.<module:bags/ActivitySequenceElement.ActivitySequenceElement>
The ordered list of ActivitySequenceElement
objects
- Source
project :module:project/JClicProject.JClicProject
The JClic project to which this ActivitySequence belongs.
- Source
Methods
checkCurrentActivity(activity)
Utility function to check if the current sequence element corresponds to the specified
activity. If negative, the currentAct
will be accordingly set.
Name | Type | Description |
---|---|---|
activity | string | The name of the activity to check |
- Source
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.
- Source
- The resulting object, with minimal attrributes
- Type:
- object
getCurrentAct() → {module:bags/ActivitySequenceElement.ActivitySequenceElement}
Gets the sequence element pointed by the currentAct
member.
- Source
- The current sequence element, or
null
if not set.
getElement(n, updateCurrentAct) → {module:bags/ActivitySequenceElement.ActivitySequenceElement}
Returns the nth element of the sequence.
Name | Type | Description |
---|---|---|
n | number | Index of the requested element |
updateCurrentAct | boolean | when |
- Source
- The requested element, or
null
if out of range.
getElementByActivityName(activity) → {module:bags/ActivitySequenceElement.ActivitySequenceElement}
Gets the first ActivitySequenceElement
in the elements
list pointing to the
specified activity name.
The search is always case-insensitive.
Name | Type | Description |
---|---|---|
activity | string | The name of the activity to search for. |
- Source
The requested element or null
if not found.
getElementByTag(tag, updateCurrentAct) → {module:bags/ActivitySequenceElement.ActivitySequenceElement}
Search into the sequence for a element with the provided tag
Name | Type | Description |
---|---|---|
tag | string | The tag to search |
updateCurrentAct | boolean | when |
- Source
- The requested element, or
null
if not found.
getElementIndex(ase) → {number}
Returns the index of the specified element in the sequence.
Name | Type | Description |
---|---|---|
ase | module:bags/ActivitySequenceElement. | The element to search. |
- Source
- The requested index, or
null
if not found.
- Type:
- number
getJump(back, reporter) → {module:bags/JumpInfo.JumpInfo}
Computes the jump to perform from the current position on the sequence
Name | Type | Description |
---|---|---|
back | boolean | When |
reporter | module:report/Reporter. | The reporting engine that will provide values about score average |
- Source
- The jump info if a valid jump is possible,
null
otherwise.
getNavButtonsFlag() → {string}
Gets the current state for the 'next' and 'prev' buttons.
- Source
- One of the possible values of
navButtons
,
thus:none
,fwd
,back
orboth
- Type:
- string
getSequenceForElement(num) → {string}
Finds the nearest sequence element with a valid 'tag', looking back in the elements
list.
Name | Type | Description |
---|---|---|
num | number | The point of the sequence from which to start looking back. |
- Source
- The nearest 'tag', or
null
if not found.
- Type:
- string
hasNextAct(hasReturn) → {boolean}
Checks if it's possible to go forward from the current position in the sequence.
Name | Type | Description |
---|---|---|
hasReturn | boolean | Indicates whether the history of jumps done since the beginning |
- Source
true
when the user is allowed to go ahead to a next activity,false
otherwise.
- Type:
- boolean
hasPrevAct(hasReturn) → {boolean}
Checks if it's possible to go back from the current position in the sequence.
Name | Type | Description |
---|---|---|
hasReturn | boolean | Indicates whether the history of jumps done since the beginning |
- Source
true
when the user is allowed to go back to a previous activity,false
otherwise.
- Type:
- boolean
setAttributes(data)
Loads the object settings from a data object
Name | Type | Description |
---|---|---|
data | object | The data object to parse |
- Source
setProperties($xml)
Loads the object settings from a specific JQuery XML element
Name | Type | Description |
---|---|---|
$xml | external:jQuery | The XML element to parse |
- Source