automation/arith/Arith. Arith

Arith provides randomly generated mental arithmetics operations, ready to be used in JClic activities.

The operations can be additions, subtractions, multiplications or divides. The unknown of these
operations can be the result of the operation (A op B = ?), any of the two operators
(A op ? = C or ? op B = C) or also the operator itself (A ? B = C).

Constructor

new Arith()

Arith constructor

Extends

Classes

Operator

Members

exp_abx :boolean

Allow expressions of type A op B = X

Type:
  • boolean

exp_axbc :boolean

Allow expressions of type A x B = C

Type:
  • boolean

exp_axc :boolean

Allow expressions of type A op X = C

Type:
  • boolean

exp_caxb :boolean

Allow inverse expressions, like C = A op B

Type:
  • boolean

exp_xbc :boolean

Allow expressions of type X op B = C

Type:
  • boolean

numericContent :boolean

This AutoContentProvider manages numeric expressions, so text literals should be
converted to numbers for comparisions, taking in account the
number format of the current locale (dot or comma as decimal separator)

Type:
  • boolean

opA :module:automation/arith/Arith.Operator

First operator

Type:
  • module:automation/arith/Arith.Operator

opB :module:automation/arith/Arith.Operator

Second operator

Type:
  • module:automation/arith/Arith.Operator

opCond :string

Sorting of the operands in commutative operations. Possible values are: 'AGB' (A greater than B),
'BGA' (B greater tan A) and 'INDIF' (default)

Type:
  • string

resultCarry :boolean

Allow carry operations

Type:
  • boolean

resultLimInf :number

Lower limit of the result

Type:
  • number

resultLimSup :number

Upper limit of the result

Type:
  • number

resultNoDup :boolean

Avoid operations with the same result

Type:
  • boolean

resultOrder :string

Type of sorting of results. Possible values are: 'NOSORT', 'SORTASC' and 'SORTDESC'

Type:
  • string

use_add :boolean

Allow additions

Type:
  • boolean

use_div :boolean

Allow divides

Type:
  • boolean

use_mult :boolean

Allow multiplications

Type:
  • boolean

use_subst :boolean

Allow subtractions

Type:
  • boolean

Methods

genNum(n, op, limInf2, limSup2) → {boolean}

Fills the n parameter (an Num) with a value in accordance with the
specifications of op (an Operator), between two limits.

Parameters:
NameTypeDescription
nmodule:automation/arith/Arith.Num

The number

opmodule:automation/arith/Arith.Operator

The operator

limInf2number

Lower limit

limSup2number

Upper limit

Returns:
  • true if all was OK
Type: 
boolean

genOp(o) → {boolean}

Fills the provided Operator with real values

Parameters:
NameTypeDescription
omodule:automation/arith/Arith.Operator

The operator to use to generate the operation

Returns:
  • true if all was OK
Type: 
boolean

generateContent(nRows, nCols, content, useIds) → {boolean}

Builds an ActiveBagContentKit and generates the automatized content.

Parameters:
NameTypeDescription
nRowsnumber

Number of rows to be processed

nColsnumber

Number of columns to be processed

contentArray.<module:boxes/ActiveBagContent.ActiveBagContent>

Array with one or more containers of ActiveBoxContent
objects to be filled with new content.

useIdsboolean

When true, the id field of ActiveBoxContent objects is significant

Returns:
  • true if the process was OK. false otherwise.
Type: 
boolean

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.

Returns:
  • The resulting object, with minimal attrributes
Type: 
object

init()

Initializes the content provider

process(kit) → {boolean}

Fills the provided ActiveBagContentKit with randomly generated operations

Parameters:
NameTypeDescription
kitmodule:automation/AutoContentProvider.ActiveBagContentKit

The composite object to be filled with data.

Returns:
  • true if all was OK
Type: 
boolean

setAttributes(data) → {object}

Reads the properties of this Arith object from a dataset

Parameters:
NameTypeDescription
dataobject

The data object to be parsed

Returns:
Type: 
object

setProperties($xml)

Loads the object settings from a specific JQuery XML element

Parameters:
NameTypeDescription
$xmlexternal:jQuery

The XML element to parse

(static) DecFormat(val, dec, pre) → {string}

Formats the number with a fixed number of decimals, optionally filling the result with leading
zeroes to have a fixed number of digits.

Parameters:
NameTypeDescription
valnumber

The value to format

decnumber

Number of decimals

prenumber

Minimal number of digits before dot.

Returns:
Type: 
string

(static) Operator#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.

Returns:
  • The resulting object, with minimal attrributes
Type: 
object

(static) Operator#setAttributes(data) → {module:automation/arith/Arith.Arith}

Reads the properties of this operator from a dataset

Parameters:
NameTypeDescription
dataobject

The data object to be parsed

(static) Operator#setProperties($xml)

Loads Operator settings from a specific JQuery XML element

Parameters:
NameTypeDescription
$xmlexternal:jQuery

The XML element to parse