Class: Relation

Relation


new Relation( GedCom )

Relation class get a relationship between two individuals.
Parameters:
Name Type Description
GedCom GedCom GedCom parser instance
Author:

Extends

Members


(private) constructors :Array.<string>

Class chaining.
Type:
  • Array.<string>
Inherited From:

(private) customDegreeCommon :Array

Custom functions on specific degrees. For example Degree 0 has getSpouses, getSiblingsInLaw etc.
Type:
  • Array

defaultLanguage :string

Id of default language file.
Type:
  • string

(private) degrees :Array

Degrees of relatives
Type:
  • Array

(private) gedcom :GedCom

GedCom parser instance.
Type:

(private) levels :Object

Levels of generations
Type:
  • Object

(private) relationship :Object

Relationship type from loaded RelationShipTypes.
Type:
  • Object

relationTable :Object

Cached relationship table.
Type:
  • Object

(private) textResponse :Object

Response of relationship type as natural text.
Type:
  • Object

Methods


areRelatives( id1 , id2 ) → {boolean}

Check two Indis are relatives.
Parameters:
Name Type Description
id1 string|Number|Indi Id of Indi or Indi to check
id2 string|Number|Indi Id of other Indi or other Indi to check
Returns:
  • {boolean} - Two Indis are relatives

extend( opts ) → {boolean}

Merge the contents of passed Object into the Self instance.
Parameters:
Name Type Description
opts Object Extended options
Inherited From:
Returns:
  • {boolean} - True if extending is succeeded, false otherwise
Example:
new Base().extend({
	<property>: <value>,
	<method>: function(){
	}
});

(private) getDegrees( ) → {Object}

Get degrees of relatives.
Returns:
  • {Object} - Degrees of relatives

(private) getLevels( ) → {Object}

Get levels of generation.
Returns:
  • {Object} - Levels of generation

(private) getMethodName( [instance] , method [, method [, indexInStack]] ) → {string}

Get the method name.
Parameters:
Name Type Argument Description
instance mixed <optional>
A class instance
method function The method
method string <optional>
Calling stack, only used in strict mode
indexInStack number <optional>
Caller method index in stack, only used in strict mode
Inherited From:
Returns:
  • {string} - The method name

(private) getMethodParams( [instance] , method ) → {Array.<string>}

Get the method params.
Parameters:
Name Type Argument Description
instance mixed <optional>
A class instance
method string The method name
Inherited From:
Returns:
  • {Array.<string>} - The method params

(private) getParseTime( startTime ) → {Number}

Get time of parsing.
Parameters:
Name Type Description
startTime Number Start time of parsing
Returns:
  • {Number} - Time of parsing as timestamp

getRelationShip( id1 , id2 [, returnCompleteStatus] ) → {boolean|string|Object}

Get the relationship between two Indis.
Parameters:
Name Type Argument Description
id1 string|Number|Indi Id of Indi or Indi to check
id2 string|Number|Indi Id of other Indi or other Indi to check
returnCompleteStatus boolean <optional>
Complete status as Object that contains level, degree, response text etc.
Returns:
  • {boolean|string|Object} - Returns false if two Indis are not relatives, returns relationship type from loaded RelationShipTypes or returns Object if returnCompleteStatus is true

(private) getRelationTable( person ) → {Object}

Get relationship into cache by an Indi
Parameters:
Name Type Description
person string|Number Id of Indi
Returns:
  • {Object} - Cached relationship table of passed Indi

(private) getTextResponse( person1 , person2 , person2 ) → {string}

Get natural text response from loaded RelationShipTypes
Parameters:
Name Type Description
person1 Indi Indi to check
person2 Indi other Indi to check
person2 boolean Two Indis are relatives
Returns:
  • {string} - Natural response text

getType( ) → {string}

Get the type of a class.
Inherited From:
Returns:
  • {string} - The type of a class
Examples:
new Properties(<gedcom>, <instance>).getType();
new List(<gedcom>, <instance>).getType();
new Data(<gedcom>, <instance>).getType();

(private) init( ) → {Relation}

Relation init.
Overrides:
Returns:

(private) loadLanguage( language )

Load RelationShipTypes by custom language code.
Parameters:
Name Type Description
language string Language code. Example: 'EN', 'HU' etc.

(private) setRelationTable( person , relative , notRelative , skipAddingRelative ) → {Object}

Set relationship into cache
Parameters:
Name Type Description
person Indi Indi to check
relative Indi other Indi to check
notRelative boolean Two Indis are relatives
skipAddingRelative boolean Ignore infinity loops
Returns:
  • {Object} - Cached relationship table