# Class: GMENode

## GMENode

#### new GMENode(_id, logger, state, storeNode)

  This class provides the API for getting information about a gme node in the model. To get hold of such object use the getNode function. !!! The documentation of the functions of the class are not complete!!! The functions of this class are aligned with the functions of the Core.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `_id` | string | Path of node.
  `logger` | GmeLogger | logger.
  `state` | object | state of the client.
  `storeNode` | function | invoked when storing new nodes.

### Methods

#### <static> getLibraryRootId(name)

  Returns the Id of the root of the library in question.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `name` | string | the name of the library.

  ##### Returns:

  If the library is found then the return value will be the Id of its root, otherwise the function returns null.

  Type
    string | null

#### <static> isValidNewBase(base)

  Checks if base can be the new base of node.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `base` | string | null | undefined | the new base.

  ##### Returns:

  True if the supplied base is a valid base for the node.

  Type
    boolean

#### getAttribute(name)

  Retrieves the value of the given attribute of the given node.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `name` | string | the name of the attribute.

  ##### Returns:

  The function returns the value of the attribute of the node. The value can be an object or any primitive type. If the value is undefined that means the node do not have such attribute defined.

  Type
    object | primitive | null | undefined

#### getAttributeMeta(name)

  Returns the definition object of an attribute from the META rules of the node.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `name` | string | the name of the attribute.

  ##### Returns:

  The function returns the definition object, where type is always defined. For examples see the similar Core definition.

  Type
    object

#### getAttributeNames()

  Returns the names of the defined attributes of the node.

  ##### Returns:

  The function returns an array of the names of the attributes of the node.

  Type
    Array.<string>

#### getBaseId()

  Returns the path of the base of the node.

  ##### Returns:

  The paths of the base of the node.

  Type
    string

#### getBaseTypeId()

  Returns the id of the meta-node of the node in question, that is the first base node that is part of the meta. (Aliased getMetaTypeId).

  ##### Returns:

  Returns the id of the first node (including itself) among the inheritance chain that is a META node. It returns null if it does not find such node (ideally the only node with this result is the ROOT).

  Type
    string | null

#### getChildrenIds()

  Collects the paths of all the children of the given node.

  ##### Returns:

  The function returns an array of the absolute paths of the children.

  Type
    Array.<string>

#### getChildrenRelids()

  Collects the relative ids of all the children of the given node.

  ##### Returns:

  The function returns an array of the relative ids.

  Type
    Array.<string>

#### getGuid()

  Get the GUID of a node.

  ##### Returns:

  Returns the globally unique identifier.

  Type
    Core.GUID

#### getId()

  Returns the path of the given node.

  ##### Returns:

  The path of the node.

  Type
    string

#### getInheritorIds()

  Gathers the paths of instances of the node.

  ##### Returns:

  The paths of the instances of the node.

  Type
    Array.<string>

#### getMetaTypeId()

  Returns the id of meta-node of the node in question, that is the first base node that is part of the meta. (Aliased getBaseTypeId).

  ##### Returns:

  Returns the id of the first node (including itself) among the inheritance chain that is a META node. It returns null if it does not find such node (ideally the only node with this result is the ROOT).

  Type
    string

#### getOwnAttribute(name)

  Returns the value of the attribute defined for the given node.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `name` | string | the name of the attribute.

  ##### Returns:

  Returns the value of the attribute defined specifically for the node. If undefined then it means that there is no such attribute defined directly for the node, meaning that it either inherits some value or there is no such attribute at all. [The retrieved attribute should not be modified as is - it should be copied first!!]

  Type
    object | primitive | null | undefined

#### getOwnAttributeNames()

  Returns the names of the attributes of the node that have been first defined for the node and not for its bases.

  ##### Returns:

  The function returns an array of the names of the own attributes of the node.

  Type
    Array.<string>

#### getOwnPointerId(name)

  Returns the path of the target node of the given pointer defined for this specific node.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `name` | string | The name of the pointer.

  ##### Returns:

  The path of the target node. If the response is null, then the pointer is defined but has no target, if undefined, it is not defined.

  Type
    string | null | undefined

#### getOwnPointerNames()

  Returns the list of the names of the pointers that were defined specifically for the node.

  ##### Returns:

  Returns an array of names of pointers defined specifically for the node.

  Type
    Array.<string>

#### getOwnRegistry(name)

  Returns the value of the registry entry defined for the given node. Please note that this return value should not be mutated!

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `name` | string | The name of the registry entry.

  ##### Returns:

  The value of the registry entry.

  Type
    primitive | object | null | undefined

#### getOwnValidAttributeNames()

  Returns the list of the META defined attribute names of the node that were specifically defined for the node.

  ##### Returns:

  The function returns the attribute names that are defined specifically for the node.

  Type
    Array.<string>

#### getParentId()

  Returns the path of the parent of the node.

  ##### Returns:

  The path of the parent.

  Type
    string | null

#### getPointerId(name)

  Returns the path of the target node of the given pointer.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `name` | string | The name of the pointer.

  ##### Returns:

  The path of the target node. If the response is null, then the pointer is defined but has no target, if undefined, it is not defined.

  Type
    string | null | undefined

#### getPointerNames()

  Retrieves a list of the defined pointer names of the node.

  ##### Returns:

  The function returns an array of the names of the pointers of the node.

  Type
    Array.<string>

#### getRegistry(name)

  Returns the value of the given registry entry.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `name` | string | The name of the registry entry.

  ##### Returns:

  The value of the registry entry.

  Type
    primitive | object | null | undefined

#### getRelid()

  Returns the relative id of the node.

  ##### Returns:

  The relative id of the node.

  Type
    string | null | undefined

#### getValidAttributeNames()

  Returns the list of the META defined attribute names of the node.

  ##### Returns:

  The function returns all the attribute names that are defined among the META rules of the node.

  Type
    Array.<string>

#### isInstanceOf(baseId)

  Checks if the node is an instance of the node at base Id.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `baseId` | string | Id to the base node we want to check.

  ##### Returns:

  Returns true if the base is on the inheritance chain of node. A node is considered to be an instance of itself here.

  Type
    bool

#### isTypeOf(typeId)

  Checks if the given node in any way inherits type-node. In addition to checking if the node "isInstanceOf" of type-node, this methods also takes mixins into account.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `typeId` | string | Id to the type node we want to check.

  ##### Returns:

  The function returns true if the type-node is a base node, or a mixin of any of the base nodes, of the node. Every node is considered to be a type of itself.

  Type
    bool

#### isValidNewChild(baseId)

  Checks if the node can have a child of the given type without causing containment inheritance loop.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `baseId` | string | Id to the base node that would be the type of the child.

  ##### Returns:

  Returns true if a child of the given type can be created.

  Type
    bool

#### Search results