Class $k.Cause

Provides additional details about a hit returned by a query

Class Summary
Constructor Attributes Constructor Name and Description
 
$k.Cause(quality, causeProperties)
Creates a new cause

Method Summary

Class Detail

$k.Cause(quality, causeProperties)
Creates a new cause
Parameters:
{number} quality Optional
Quality of the cause
{object} causeProperties Optional
Properties of the cause
Throws:
{$k.exception.InvalidValue}
If the quality is not between 0 and 1

Method Detail

  • property(name)
    Returns the value of the named property, or undefined if the property does not exist
    Parameters:
    {string} name
    Throws:
    {$k.exception.TypeError}
    If the name is not a string
    {$k.exception.InvalidValue}
    If the value of the property cannot be converted to an object
  • {number} quality()
    Returns the quality of the cause, a number between 0 (worst quality) and 1 (best quality)
    Returns:
    {number}
  • setProperties(properties)
    Set the properties of the cause
    Parameters:
    {object} properties
    Throws:
    {$k.exception.InvalidValue}
    If the value is not a valid property value
  • setProperty(name, value)
    Set the value of the named property
    Parameters:
    {string} name
    value
    Throws:
    {$k.exception.TypeError}
    If the name is not a string
    {$k.exception.InvalidValue}
    If the value is not a valid property value
  • setQuality(quality)
    Set the quality, a number between 0 and 1
    Parameters:
    {number} quality
    Throws:
    {$k.exception.InvalidValue}
    If the quality is not between 0 and 1
  • setType(type)
    Set the type
    Parameters:
    {string} type
    Throws:
    {RangeError}
    If this is a system-defined cause
  • {string} type()
    Returns the type of the cause, e.g. 'semantic'
    Returns:
    {string}