|
| 1 | +% MixIn class for NIX entites with basic dynamic properties. |
| 2 | +% |
| 3 | +% In addition to the properties defined by nix.Entity most entities of the NIX data model |
| 4 | +% further provide the properties id, name, type and definition. |
| 5 | +% |
| 6 | +% The id property of an entity is automatically assigned and serves as a machine readable |
| 7 | +% unique identifier. The name property of an entity serves as a human readable identifier |
| 8 | +% and can be set at the creation of an entity. The type property is used to allow the |
| 9 | +% specification of additional semantic meaning for an entity and therefore can introduce |
| 10 | +% domain-specificity into the generic data model. The optional definition property allows |
| 11 | +% the user to add a freely assignable textual definition to the entity. |
| 12 | +% |
| 13 | +% Dynamic properties: |
| 14 | +% id (char): read-only, automatically created id of the entity. |
| 15 | +% name (char): read-only, name of the entity. |
| 16 | +% type (char): read-write, type can be used to give semantic meaning to an |
| 17 | +% entity and expose it to search methods in a broader context. |
| 18 | +% definition (char): read-write, additional description of the entity. |
| 19 | +% |
| 20 | +% See also: nix.Block, nix.Group, nix.DataArray, nix.Source, nix.Tag, |
| 21 | +% nix.MultiTag, nix.Section. |
| 22 | +% |
| 23 | +% |
1 | 24 | % Copyright (c) 2016, German Neuroinformatics Node (G-Node)
|
2 | 25 | %
|
3 | 26 | % All rights reserved.
|
|
7 | 30 | % LICENSE file in the root of the Project.
|
8 | 31 |
|
9 | 32 | classdef NamedEntity < nix.Entity
|
10 |
| - % NamedEntity |
11 |
| - % base class for nix entities with name/type/definition |
12 | 33 |
|
13 | 34 | methods
|
14 | 35 | function obj = NamedEntity(h)
|
|
22 | 43 | end
|
23 | 44 |
|
24 | 45 | function r = compare(obj, entity)
|
25 |
| - % Compares first name and second id, return > 0 if the entity |
26 |
| - % is larger than the other, 0 if both are equal, and < 0 otherwise. |
| 46 | + % Checks two NIX entities of the same class for equality. |
| 47 | + % |
| 48 | + % The name property is the first comparison. If they are the same, |
| 49 | + % the ids of the entities will be compared. |
| 50 | + % |
| 51 | + % Returns: (double) 0 if both entities are equal. |
| 52 | + % > or < 0 if the entities are different. |
| 53 | + % |
| 54 | + % Example: check = currSource.compare(otherSource); |
| 55 | + |
27 | 56 | if (~isa(obj, class(entity)))
|
28 | 57 | err.identifier = 'NIXMX:InvalidArgument';
|
29 | 58 | err.message = 'Only entities of the same class can be compared.';
|
|
0 commit comments