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. |
- Source:
Methods
getAttribute(name) → {object|primitive|null|undefined}
Retrieves the value of the given attribute of the given node.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | the name of the attribute. |
- Source:
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.
getAttributeMeta(name) → {object}
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. |
- Source:
Returns:
The function returns the definition object, where type is always defined. For examples see the similar Core definition.
- Type
- object
getAttributeNames() → {Array.<string>}
Returns the names of the defined attributes of the node.
- Source:
Returns:
The function returns an array of the names of the attributes of the node.
getBaseId() → {string}
Returns the path of the base of the node.
- Source:
Returns:
The paths of the base of the node.
- Type
- string
getBaseTypeId() → {string|null}
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).
- Source:
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).
getChildrenIds() → {Array.<string>}
Collects the paths of all the children of the given node.
- Source:
Returns:
The function returns an array of the absolute paths of the children.
getChildrenRelids() → {Array.<string>}
Collects the relative ids of all the children of the given node.
- Source:
Returns:
The function returns an array of the relative ids.
getGuid() → {Core.GUID}
Get the GUID of a node.
- Source:
Returns:
Returns the globally unique identifier.
- Type
- Core.GUID
getId() → {string}
Returns the path of the given node.
- Source:
Returns:
The path of the node.
- Type
- string
getInheritorIds() → {Array.<string>}
Gathers the paths of instances of the node.
- Source:
Returns:
The paths of the instances of the node.
getMetaTypeId() → {string}
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).
- Source:
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) → {object|primitive|null|undefined}
Returns the value of the attribute defined for the given node.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | the name of the attribute. |
- Source:
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!!]
getOwnAttributeNames() → {Array.<string>}
Returns the names of the attributes of the node that have been first defined for the node and not for its bases.
- Source:
Returns:
The function returns an array of the names of the own attributes of the node.
getOwnPointerId(name) → {string|null|undefined}
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. |
- Source:
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.
getOwnPointerNames() → {Array.<string>}
Returns the list of the names of the pointers that were defined specifically for the node.
- Source:
Returns:
Returns an array of names of pointers defined specifically for the node.
getOwnRegistry(name) → {primitive|object|null|undefined}
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. |
- Source:
Returns:
The value of the registry entry.
getOwnValidAttributeNames() → {Array.<string>}
Returns the list of the META defined attribute names of the node that were specifically defined for the node.
- Source:
Returns:
The function returns the attribute names that are defined specifically for the node.
getParentId() → {string|null}
Returns the path of the parent of the node.
- Source:
Returns:
The path of the parent.
getPointerId(name) → {string|null|undefined}
Returns the path of the target node of the given pointer.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the pointer. |
- Source:
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.
getPointerNames() → {Array.<string>}
Retrieves a list of the defined pointer names of the node.
- Source:
Returns:
The function returns an array of the names of the pointers of the node.
getRegistry(name) → {primitive|object|null|undefined}
Returns the value of the given registry entry.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the registry entry. |
- Source:
Returns:
The value of the registry entry.
getRelid() → {string|null|undefined}
Returns the relative id of the node.
- Source:
Returns:
The relative id of the node.
getValidAttributeNames() → {Array.<string>}
Returns the list of the META defined attribute names of the node.
- Source:
Returns:
The function returns all the attribute names that are defined among the META rules of the node.
isInstanceOf(baseId) → {bool}
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. |
- Source:
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) → {bool}
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. |
- Source:
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) → {bool}
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. |
- Source:
Returns:
Returns true if a child of the given type can be created.
- Type
- bool
(static) getLibraryRootId(name) → {string|null}
Returns the Id of the root of the library in question.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | the name of the library. |
- Source:
Returns:
If the library is found then the return value will be the Id of its root, otherwise the function returns null.
(static) isValidNewBase(base) → {boolean}
Checks if base can be the new base of node.
Parameters:
Name | Type | Description |
---|---|---|
base |
string | null | undefined | the new base. |
- Source:
Returns:
True if the supplied base is a valid base for the node.
- Type
- boolean