Class Index | File Index

Classes


Class baja.EnumRange


Extends baja.Simple.
Represents a BEnumRange in BajaScript.

An EnumRange stores a range of ordinal/name pairs for Enumerations.

When creating a Simple, always use the 'make' method instead of creating a new Object.
Defined in: obj.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
<static>  
baja.EnumRange.BOOLEAN_RANGE
Boolean EnumRange.
<static>  
baja.EnumRange.DEFAULT
Default EnumRange instance.
Fields borrowed from class baja.Value:
newCopy
Fields borrowed from class baja.Object:
equivalent, getIcon
Method Summary
Method Attributes Method Name and Description
 
Decode an EnumRange from a String.
 
Encode an EnumRange to a String.
 
get(arg)
Get the enum for the specified tag or ordinal.
 
Return the data type symbol.
 
Return the Type used for the frozen enum range or null if this range has no frozen ordinal/tag pairs.
 
Get the options for this range stored as a Facets instance.
 
Return all of the ordinals for the EnumRange.
 
getTag(ordinal)
Return the tag for the specified ordinal.
 
Return true if the ordinal is a valid ordinal in the dynamic range.
 
isFrozenOrdinal(ordinal)
Return true if the ordinal is a valid ordinal in the frozen range.
 
isOrdinal(ordinal)
Return true if the ordinal is valid in this EnumRange.
 
isTag(tag)
Return true if the tag is used within the EnumRange.
 
make(obj, frozen, ordinals, tags, facets)
Make an EnumRange.
<static>  
baja.EnumRange.make(obj, frozen, ordinals, tags, facets)
Make an EnumRange.
 
Convert the tag to its ordinal within the EnumRange.
Methods borrowed from class baja.Simple:
equals
Class Detail
baja.EnumRange()
Field Detail
<static> baja.EnumRange.BOOLEAN_RANGE
Boolean EnumRange.

<static> baja.EnumRange.DEFAULT
Default EnumRange instance.
Method Detail
{baja.EnumRange} decodeFromString(str)
Decode an EnumRange from a String.
Parameters:
{String} str
Returns:
{baja.EnumRange}

{String} encodeToString()
Encode an EnumRange to a String.
Returns:
{String}

{baja.DynamicEnum|baja.FrozenEnum|Boolean} get(arg)
Get the enum for the specified tag or ordinal.

This method is used to access an enum based upon a tag or ordinal.

Parameters:
{String|Number} arg
a tag or ordinal.
Throws:
error if the tag or ordinal is invalid.
Returns:
{baja.DynamicEnum|baja.FrozenEnum|Boolean} the enum for the tag or ordinal.

{String} getDataTypeSymbol()
Return the data type symbol.
Returns:
{String} data type symbol.

{Type} getFrozenType()
Return the Type used for the frozen enum range or null if this range has no frozen ordinal/tag pairs.
Returns:
{Type} the Type for the FrozenEnum or null.

{baja.Facets} getOptions()
Get the options for this range stored as a Facets instance.
Returns:
{baja.Facets} facets

{Array} getOrdinals()
Return all of the ordinals for the EnumRange.

The returned array contains both frozen and enum ordinals.

Returns:
{Array} an array of numbers that represents the ordinals for this EnumRange.

{String} getTag(ordinal)
Return the tag for the specified ordinal.

If the ordinal isn't valid then the ordinal is returned as a String.

Parameters:
{Number} ordinal
Returns:
{String} tag

{Boolean} isDynamicOrdinal(ordinal)
Return true if the ordinal is a valid ordinal in the dynamic range.
Parameters:
{Number} ordinal
Returns:
{Boolean} true if valid

{Boolean} isFrozenOrdinal(ordinal)
Return true if the ordinal is a valid ordinal in the frozen range.
Parameters:
{Number} ordinal
Returns:
{Boolean} true if valid.

{Boolean} isOrdinal(ordinal)
Return true if the ordinal is valid in this EnumRange.
Parameters:
{Number} ordinal
Returns:
{Boolean} true if valid

{Boolean} isTag(tag)
Return true if the tag is used within the EnumRange.
Parameters:
{String} tag
Returns:
{Boolean} true if valid.

{baja.EnumRange} make(obj, frozen, ordinals, tags, facets)
Make an EnumRange.

The TypeSpec for a FrozenEnum can be used as the first argument. If other arguments are required then an Object Literal is used to to specify the method's arguments.

  // For example...
  var er = baja.$("baja:EnumRange").make({
    ordinals: [0, 1, 2],
    tags: ["A", "B", "C"]
  });

Parameters:
{Object} obj Optional
the Object Literal that holds the method's arguments.
{String|Type} frozen Optional
the Type or TypeSpec for the FrozenEnum.
{Array} ordinals Optional
an array of numbers that specify the dynamic enum ordinals.
{Array} tags Optional
an array of strings that specify the dynamic enum tags.
{baja.Facets} facets Optional
optional facets.
Returns:
{baja.EnumRange} the EnumRange .

<static> {baja.EnumRange} baja.EnumRange.make(obj, frozen, ordinals, tags, facets)
Make an EnumRange.

The TypeSpec for a FrozenEnum can be used as the first argument. If other arguments are required then an Object Literal is used to to specify the method's arguments.

  // For example...
  var er = baja.EnumRange.make({
    ordinals: [0, 1, 2],
    tags: ["A", "B", "C"]
  });

Parameters:
{Object} obj Optional
the Object Literal that holds the method's arguments.
{String|Type} frozen Optional
the Type or TypeSpec for the FrozenEnum.
{Array} ordinals Optional
an array of numbers that specify the dynamic enum ordinals.
{Array} tags Optional
an array of strings that specify the dynamic enum tags.
{baja.Facets} facets Optional
optional facets.
Returns:
{baja.EnumRange} the EnumRange.

{Number} tagToOrdinal(tag)
Convert the tag to its ordinal within the EnumRange.
Parameters:
{String} tag
Throws:
error if the tag is invalid.
Returns:
{Number} ordinal for the tag.

Documentation generated by JsDoc Toolkit 2.3.2