Class Index | File Index

Classes


Namespace jamEngine


Version 4.5.

Defined in: jamEngine.jsxinc.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Global object (used to simulate a namespace in JavaScript) containing all the methods and properties of the JSON Action Manager engine.
Field Summary
Field Attributes Field Name and Description
<static>  
jamEngine.displayDialogs
Global option: default value for displayDialogs when calling jamEngine.jsonPlay ().
<static>  
jamEngine.meaningfulIds
Global option: generate as "meaningful" as possible ID strings (instead of "canonic" ID strings).
<static>  
jamEngine.parseFriendly
Global option: generate alternative, more parse-friendly JSON compact format (using ordered pairs made of arrays instead of objects).
Method Summary
Method Attributes Method Name and Description
<static>  
jamEngine.actionReferenceToJson(actionReference)
Convert an ActionReference object into a reference array in JSON AM Data Format.
<static>  
jamEngine.buildCompact(type, value)
Build an element in compact format from type and value.
<static>  
jamEngine.classIdAndActionDescriptorToJson(classId, actionDescriptor)
Convert a class numerical ID and an ActionDescriptor object into a class unified ID string and a descriptor object in JSON AM Data Format.
<static>  
jamEngine.compactToExplicit(compact, typeKey, valueKey)
Expand a special case of JavaScript literal object, from compact to explicit format.
<static>  
jamEngine.equivalentUniIdStrs(uniIdStr1, uniIdStr2)
Test if two unified ID strings are equivalent (map to the same numerical ID).
<static>  
jamEngine.eventIdAndActionDescriptorToJson(eventId, actionDescriptor)
Convert an event numerical ID and an ActionDescriptor object into an event unified ID string and a descriptor object in JSON AM Data Format.
<static>  
jamEngine.explicitToCompact(explicit, typeKey, valueKey)
Shrink a special case of JavaScript literal object, from explicit to compact format.
<static>  
jamEngine.getConflictingStringIdStrs(charIdStr)
Get an array of conflicting StringID strings corresponding to a CharID string.
<static>  
jamEngine.idToUniIdStrs(id)
Convert a numerical ID into a CharID string and a StringID string (or an array of conflicting StringID strings).
<static>  
jamEngine.jsonGet(referenceArr)
Get information from a reference array in JSON AM Data Format.
<static>  
jamEngine.jsonPlay(eventUniIdStr, descriptorObj, displayDialogs)
Play an event as a unified ID string with a descriptor object in JSON AM Data Format.
<static>  
jamEngine.jsonToActionDescriptor(descriptorObj)
Convert a descriptor object in JSON AM Data Format into an ActionDescriptor object.
<static>  
jamEngine.jsonToActionReference(referenceArr)
Convert a reference array in JSON AM Data Format into an ActionReference object.
<static>  
jamEngine.normalizeJsonItem(item, options)
Normalize a JSON AM item, according to normalizing options.
<static>  
jamEngine.parseCompact(compact)
Parse an element in compact format into type and value as a two-element array.
<static>  
jamEngine.simplifyList(object, hookFunction)
Simplifies a JSON AM List into a JSON array.
<static>  
jamEngine.simplifyObject(object, hookFunction)
Simplifies a JSON AM Object into a JSON object.
<static>  
jamEngine.uniIdStrToId(uniIdStr)
Convert a unified ID string into its numerical ID.
Namespace Detail
jamEngine
Global object (used to simulate a namespace in JavaScript) containing all the methods and properties of the JSON Action Manager engine.
Author: Michel MARIANI.
Field Detail
<static> {Object} jamEngine.displayDialogs
Global option: default value for displayDialogs when calling jamEngine.jsonPlay ().
jamEngine.displayDialogs = DialogModes.ALL;
Default Value:
DialogModes.ERROR

<static> {Boolean} jamEngine.meaningfulIds
Global option: generate as "meaningful" as possible ID strings (instead of "canonic" ID strings).
jamEngine.meaningfulIds = false;
var resultDescriptorObj = jamEngine.jsonGet
(
    [
        { "'Prpr'": { "<property>": "'HstN'" } },
        { "'capp'": { "<enumerated>": { "'Ordn'": "'Trgt'" } } }
    ]
);
alert (jamJSON.stringify (resultDescriptorObj)); // -> { "'HstN'": { "<string>": "Adobe Photoshop CS" } }
jamEngine.meaningfulIds = true;
var resultDescriptorObj = jamEngine.jsonGet
(
    [
        { "property": { "<property>": "hostName" } },
        { "application": { "<enumerated>": { "ordinal": "targetEnum" } } }
    ]
);
alert (jamJSON.stringify (resultDescriptorObj)); // -> { "hostName": { "<string>": "Adobe Photoshop CS" } }
Default Value:
false

<static> {Boolean} jamEngine.parseFriendly
Global option: generate alternative, more parse-friendly JSON compact format (using ordered pairs made of arrays instead of objects).
jamEngine.meaningfulIds = true;
jamEngine.parseFriendly = false;
var resultDescriptorObj = jamEngine.jsonGet
(
    [
        { "property": { "<property>": "rulerUnits" } },
        { "application": { "<enumerated>": { "ordinal": "targetEnum" } } }
    ]
);
alert (jamJSON.stringify (resultDescriptorObj));
// -> { "rulerUnits": { "<enumerated>": { "rulerUnits": "rulerPixels" } } }
var rulerUnits = resultDescriptorObj["rulerUnits"]["<enumerated>"]["rulerUnits"];
alert (jamJSON.stringify (rulerUnits)); // -> "rulerPixels"
jamEngine.meaningfulIds = true;
jamEngine.parseFriendly = true;
var resultDescriptorObj = jamEngine.jsonGet
(
    [
        [ "property", [ "<property>", "rulerUnits" ] ],
        [ "application", [ "<enumerated>", [ "ordinal", "targetEnum" ] ] ]
    ]
);
alert (jamJSON.stringify (resultDescriptorObj));
// -> { "rulerUnits": [ "<enumerated>", [ "rulerUnits", "rulerPixels" ] ] }
var rulerUnits = resultDescriptorObj["rulerUnits"][1][1];
alert (jamJSON.stringify (rulerUnits)); // -> "rulerPixels"
Default Value:
false
Method Detail
<static> {Array} jamEngine.actionReferenceToJson(actionReference)
Convert an ActionReference object into a reference array in JSON AM Data Format.
jamEngine.meaningfulIds = true;
var referenceArr = jamEngine.actionReferenceToJson (actionReference);
$.writeln ('jamEngine.jsonGet');
$.writeln ('(');
$.writeln (jamJSON.stringify (referenceArr, '\t', '\t');
$.writeln (');');
Parameters:
{Object} actionReference
ActionReference object
Returns:
{Array} Reference array in JSON AM Data Format
See:
jamEngine.jsonToActionReference

<static> {Object|Array} jamEngine.buildCompact(type, value)
Build an element in compact format from type and value.
jamEngine.parseFriendly = false;
var compact = jamEngine.buildCompact ("percentUnit", 50);
// -> { "percentUnit": 50 }
jamEngine.parseFriendly = true;
var compact = jamEngine.buildCompact ("percentUnit", 50);
// -> [ "percentUnit", 50 ]
Parameters:
{String} type
Type (must be a string)
{Object|Array|String|Number|Boolean|Null} value
Value
Returns:
{Object|Array} JavaScript literal object or array in compact format: { (type): (value) } or [ (type), (value) ] depending on the boolean value of jamEngine.parseFriendy
See:
jamEngine.parseCompact

<static> {Object} jamEngine.classIdAndActionDescriptorToJson(classId, actionDescriptor)
Convert a class numerical ID and an ActionDescriptor object into a class unified ID string and a descriptor object in JSON AM Data Format.
var objectObj = jamEngine.classIdAndActionDescriptorToJson
(
    jamEngine.uniIdStrToId (signature),
    app.getCustomOptions (signature)
);
var customOptions = objectObj["<descriptor>"];
Parameters:
{Number} classId
Class numerical ID
{Object} actionDescriptor
ActionDescriptor object
Returns:
{Object} Class unified ID string and descriptor object in JSON AM Data Format
See:
jamEngine.eventIdAndActionDescriptorToJson
jamEngine.jsonToActionDescriptor

<static> {Object} jamEngine.compactToExplicit(compact, typeKey, valueKey)
Expand a special case of JavaScript literal object, from compact to explicit format.
var compactObj = { "pixelsUnit": 5 };
var explicitObj = jamEngine.compactToExplicit (compactObj, "<unit>", "<double>");
// -> { "<unit>": "pixelsUnit", "<double>": 5 }
var compactArr = [ "pixelsUnit", 5 ];
var defaultExplicitObj = jamEngine.compactToExplicit (compactArr);
// -> { "<type>": "pixelsUnit", "<value>": 5 }
Parameters:
{Object|Array} compact
JavaScript literal object or array in compact format: { (type): (value) } or [ (type), (value) ]
{String} typeKey Optional
Type key string ("<type>" by default)
{String} valueKey Optional
Value key string ("<value>" by default)
Returns:
{Object} JavaScript literal object in explicit format: { (typeKey): (type), (valueKey): (value) }
See:
jamEngine.explicitToCompact

<static> {Boolean} jamEngine.equivalentUniIdStrs(uniIdStr1, uniIdStr2)
Test if two unified ID strings are equivalent (map to the same numerical ID).
jamEngine.equivalentUniIdStrs ("green", "'Grn '");    // returns true
jamEngine.equivalentUniIdStrs ("grain", "'Grn '");    // returns true
jamEngine.equivalentUniIdStrs ("green", "grain");     // returns true
jamEngine.equivalentUniIdStrs ("null", "'null'");     // returns true
jamEngine.equivalentUniIdStrs ("target", "'Trgt'");   // returns false
jamEngine.equivalentUniIdStrs ("target", "null");     // returns true
jamEngine.equivalentUniIdStrs ("target", "'null'");   // returns true
jamEngine.equivalentUniIdStrs ("axis", "'Axis'");     // returns true
jamEngine.equivalentUniIdStrs ("center", "contrast"); // returns true
jamEngine.equivalentUniIdStrs ("'Grn '", "'Grns'");   // returns false
jamEngine.equivalentUniIdStrs ("green", "greens");    // returns false
Parameters:
{String} uniIdStr1
unified ID string (either "'xxxx'" or "xxxxxxxx")
{String} uniIdStr2
unified ID string (either "'xxxx'" or "xxxxxxxx")
Returns:
{Boolean} true if the two unified ID strings are equivalent, false otherwise

<static> {Object} jamEngine.eventIdAndActionDescriptorToJson(eventId, actionDescriptor)
Convert an event numerical ID and an ActionDescriptor object into an event unified ID string and a descriptor object in JSON AM Data Format.
jamEngine.meaningfulIds = true;
var playObj = jamEngine.eventIdAndActionDescriptorToJson (eventId, actionDescriptor);
$.writeln ('jamEngine.jsonPlay');
$.writeln ('(');
$.writeln (jamJSON.stringify (playObj["<event>"], '\t', '\t') + ',');
$.writeln (jamJSON.stringify (playObj["<descriptor>"], '\t', '\t'));
$.writeln (');');
Parameters:
{Number} eventId
Event numerical ID
{Object|Null} actionDescriptor Optional
ActionDescriptor object (can be null)
Returns:
{Object} Event unified ID string and descriptor object in JSON AM Data Format
See:
jamEngine.classIdAndActionDescriptorToJson
jamEngine.jsonToActionDescriptor

<static> {Object|Array} jamEngine.explicitToCompact(explicit, typeKey, valueKey)
Shrink a special case of JavaScript literal object, from explicit to compact format.
jamEngine.parseFriendly = false;
var explicitObj = { "<unit>": "pixelsUnit", "<double>": 5 };
var compactObj = jamEngine.explicitToCompact (explicitObj, "<unit>", "<double>");
// -> { "pixelsUnit": 5 }
jamEngine.parseFriendly = true;
var defaultExplicitObj = { "<type>": "pixelsUnit", "<value>": 5 };
var compactArr = jamEngine.explicitToCompact (defaultExplicitObj);
// -> [ "pixelsUnit", 5 ]
Parameters:
{Object} explicit
JavaScript literal object in explicit format: { (typeKey): (type), (valueKey): (value) }
{String} typeKey Optional
Type key string ("<type>" by default)
{String} valueKey Optional
Value key string ("<value>" by default)
Returns:
{Object|Array} JavaScript literal object or array in compact format: { (type): (value) } or [ (type), (value) ] depending on the boolean value of jamEngine.parseFriendy
See:
jamEngine.compactToExplicit

<static> {Array|Null} jamEngine.getConflictingStringIdStrs(charIdStr)
Get an array of conflicting StringID strings corresponding to a CharID string.
alert (jamJSON.stringify (jamEngine.getConflictingStringIdStrs ("'Rd  '")));
// -> null
alert (jamJSON.stringify (jamEngine.getConflictingStringIdStrs ("'Grn '")));
// -> [ "grain", "green" ]
alert (jamJSON.stringify (jamEngine.getConflictingStringIdStrs ("'Bl  '")));
// -> null
Parameters:
{String} charIdStr
CharID string ("'xxxx'")
Returns:
{Array|Null} Array of conflicting StringID strings corresponding to a CharID string if available, null otherwise

<static> {Object} jamEngine.idToUniIdStrs(id)
Convert a numerical ID into a CharID string and a StringID string (or an array of conflicting StringID strings).
var uniIdStr = "green";
alert (jamJSON.stringify (jamEngine.idToUniIdStrs (jamEngine.uniIdStrToId (uniIdStr))));
// -> [ "'Grn '", [ "grain", "green" ] ]
Parameters:
{Number} id
Numerical ID
Returns:
{Object} Two-element array: CharID string ("'xxxx'") (empty string if not available) and StringID string ("xxxxxxxx") (empty string if not available, or array of StringID strings if they are conflicting)
See:
jamEngine.uniIdStrToId

<static> {Object} jamEngine.jsonGet(referenceArr)
Get information from a reference array in JSON AM Data Format.
jamEngine.meaningfulIds = true;
var resultDescriptorObj = jamEngine.jsonGet
(
    [
        { "property": { "<property>": "numberOfDocuments" } },
        { "application": { "<enumerated>": { "ordinal": "targetEnum" } } }
    ]
);
alert ("Number of documents: " + resultDescriptorObj["numberOfDocuments"]["<integer>"]);
Parameters:
{Array} referenceArr
Reference array in JSON AM Data Format
Returns:
{Object} Descriptor object in JSON AM Data Format
See:
jamEngine.jsonPlay

<static> {Object} jamEngine.jsonPlay(eventUniIdStr, descriptorObj, displayDialogs)
Play an event as a unified ID string with a descriptor object in JSON AM Data Format.
jamEngine.jsonPlay
(
    "motionBlur",
    {
        "angle": { "<integer>": -45 },
        "distance": { "<unitDouble>": { "pixelsUnit": 200 } }
    }
);
Parameters:
{String} eventUniIdStr
Event unified ID string
{Object|Null} descriptorObj Optional
Descriptor object in JSON AM Data Format; can be null
{Object} displayDialogs Optional
Dialog mode:
  • DialogModes.ERROR: show dialogs on error only (by default, unless jamEngine.displayDialogs has been set to another value)
  • DialogModes.ALL: show all dialogs
  • DialogModes.NO: show no dialogs
Returns:
{Object} Descriptor object in JSON AM Data Format
See:
jamEngine.jsonGet

<static> {Object} jamEngine.jsonToActionDescriptor(descriptorObj)
Convert a descriptor object in JSON AM Data Format into an ActionDescriptor object.
app.putCustomOptions (signature, jamEngine.jsonToActionDescriptor (customOptions));
Parameters:
{Object} descriptorObj
Descriptor object in JSON AM Data Format
Returns:
{Object} ActionDescriptor object
See:
jamEngine.classIdAndActionDescriptorToJson
jamEngine.eventIdAndActionDescriptorToJson

<static> {Object} jamEngine.jsonToActionReference(referenceArr)
Convert a reference array in JSON AM Data Format into an ActionReference object.
var referenceArr =
[
    { "property": { "<property>": "hostName" } },
    { "application": { "<enumerated>": { "ordinal": "targetEnum" } } }
];
var actionReference = jamEngine.jsonToActionReference (referenceArr);
Parameters:
{Array} referenceArr
Reference array in JSON AM Data Format
Returns:
{Object} ActionReference object
See:
jamEngine.actionReferenceToJson

<static> {Object|Array} jamEngine.normalizeJsonItem(item, options)
Normalize a JSON AM item, according to normalizing options.
var item = { "<object>": { "'Grsc'": { "'Gry '": { "<double>": 50 } } } };
var normalizedItem = jamEngine.normalizeJsonItem (item, { meaningfulIds: true, parseFriendly: true });
alert (jamJSON.stringify (normalizedItem));
// -> [ "<object>", [ "grayscale", { "gray": [ "<double>", 50 ] } ] ]
Parameters:
{Object|Array} item
JSON AM item in compact format
{Object} options Optional
Normalizing options (meaningfulIds and parseFriendly, overriding currently defined jamEngine global options when present)
Returns:
{Object|Array} Normalized JSON AM item, according to normalizing options

<static> {Array} jamEngine.parseCompact(compact)
Parse an element in compact format into type and value as a two-element array.
var compactObj = { "percentUnit": 50 };
var parsed = jamEngine.parseCompact (compactObj);
// -> [ "percentUnit", 50 ]
var compactArr = [ "percentUnit", 50 ];
var parsed = jamEngine.parseCompact (compactArr);
// -> [ "percentUnit", 50 ]
Parameters:
{Object|Array} compact
JavaScript literal object or array in compact format: { (type): (value) } or [ (type), (value) ]
Returns:
{Array} Two-element array: [ (type), (value) ]
See:
jamEngine.buildCompact

<static> {Object} jamEngine.simplifyList(object, hookFunction)
Simplifies a JSON AM List into a JSON array.
jamHelpers.fromCurvePointList = function (curvePointList)
{
    return jamEngine.simplifyList (curvePointList);
};
Parameters:
{Object|Array} object
JSON AM List
{Function} hookFunction Optional
Hook function: (desc, key, getDefaultValue); returns value or undefined
Returns:
{Object} Simplified JSON array

<static> {Object} jamEngine.simplifyObject(object, hookFunction)
Simplifies a JSON AM Object into a JSON object.
jamStyles.fromLayerEffectsObject = function (layerEffectsObject)
{
    return jamEngine.simplifyObject (layerEffectsObject);
};
Parameters:
{Object|Array} object
JSON AM Object
{Function} hookFunction Optional
Hook function: (desc, key, getDefaultValue); returns value or undefined
Returns:
{Object} Simplified JSON object

<static> {Number} jamEngine.uniIdStrToId(uniIdStr)
Convert a unified ID string into its numerical ID.
var smallestHashValue = jamEngine.uniIdStrToId ("'    '");  // -> 0x20202020
Parameters:
{String} uniIdStr
unified ID string (either "'xxxx'" or "xxxxxxxx")
Returns:
{Number} Numerical ID
See:
jamEngine.idToUniIdStrs

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Oct 12 2016 23:32:44 GMT+0200 (CEST)