Class pvr.controller.value.Value

Represents a value of a particular type and provides convenience methods for converting it to or comparing it with values of other types.

This class is designed to be extended to support custom types. Creator functions can be registered to create new pvr.controller.value.Value objects. Converter functions can be registered for converting pvr.controller.value.Value objects of one type to anothers. Comparator functions can be registered for comparing pvr.controller.value.Value objects with each other.


Defined in: <pvr\controller\value\Value.js>.

Constructor Summary

Constructor Attributes Constructor Name and Description
 

Method Summary

Method Attributes Method Name and Description
 
addComparator(fromType, toType, func)
Registers a comparator function for comparing pvr.controller.value.Value objects of differing types.
 
addConverter(fromType, toType, func)
Registers a converter function for converting pvr.controller.value.Value objects of one type to another.
 
addCreator(func)
Registers a creator function for creating pvr.controller.value.Value objects of a particular type.
 
as(type, settings)
Converts this pvr.controller.value.Value object to a pvr.controller.value.Value object of another type as specified by the settings.
 
compare(value)
Compares this pvr.controller.value.Value object with another.
 
equals(value)
Indicates whether this pvr.controller.value.Value object is equal to another.
 
is(type)
Indicates whether this pvr.controller.value.Value object has the specified type.
 
similar(value)
Indicates whether this pvr.controller.value.Value object can be considered equal to another even if their types are different.
 
to(type, settings)
Converts this pvr.controller.value.Value object to a primitive value of another type as specified by the settings.

Constructor Detail

pvr.controller.value.Value()

Method Detail

addComparator(fromType, toType, func)

Registers a comparator function for comparing pvr.controller.value.Value objects of differing types.
Parameters:
fromType
The type to convert from.
toType
The type to convert to. This argument can be omitted if both types are the same.
func
The comparator function.

addConverter(fromType, toType, func)

Registers a converter function for converting pvr.controller.value.Value objects of one type to another.
Parameters:
fromType
The type to convert from.
toType
The type to convert to. This argument can be omitted of both types are the same.
func
The converter function.

addCreator(func)

Registers a creator function for creating pvr.controller.value.Value objects of a particular type.
Parameters:
func
The creator function.

as(type, settings)

Converts this pvr.controller.value.Value object to a pvr.controller.value.Value object of another type as specified by the settings.
Parameters:
type
The type to convert to.
settings
The settings.
Returns:
The converted pvr.controller.value.Value object. The converted value type will be "undefined" if the conversion fails.

compare(value)

Compares this pvr.controller.value.Value object with another.
Parameters:
value
The value to compare with.
Returns:
0 if the values are equal, -1 if this value is less than the other, or 1 if this value is greater than the other.

equals(value)

Indicates whether this pvr.controller.value.Value object is equal to another.
Parameters:
value
The value to compare with.
Returns:
true if the values are equal.

is(type)

Indicates whether this pvr.controller.value.Value object has the specified type.
Parameters:
type
The type.
Returns:
true if this pvr.controller.value.Value object has the specified type.

similar(value)

Indicates whether this pvr.controller.value.Value object can be considered equal to another even if their types are different.
Parameters:
value
The value to compare with.
Returns:
true if the values are similar.

to(type, settings)

Converts this pvr.controller.value.Value object to a primitive value of another type as specified by the settings.
Parameters:
type
The type to convert to.
settings
The settings.
Returns:
The converted primitive value or undefined if the conversion fails.