39
|
1
|
|
2 export var invLabelPrefix = '<- ';
|
|
3 export var invNamePrefix = '-';
|
|
4 export var rawLabelPrefix = '(';
|
|
5 export var rawLabelPostfix = ')';
|
|
6
|
|
7 export class RelationType {
|
|
8 public name: string;
|
|
9 public label: string;
|
|
10 public outgoing: boolean;
|
|
11
|
|
12 constructor (name: string, isOutgoing: boolean, label?:string) {
|
|
13 this.name = name;
|
|
14 this.outgoing = isOutgoing;
|
|
15 if (label != null) {
|
|
16 this.label = label;
|
|
17 } else {
|
|
18 // create label using name
|
|
19 if (isOutgoing) {
|
|
20 this.label = rawLabelPrefix + name + rawLabelPostfix;
|
|
21 } else {
|
|
22 this.label = rawLabelPrefix + invLabelPrefix + name + rawLabelPostfix;
|
|
23 }
|
|
24 }
|
|
25 }
|
|
26
|
|
27 getLabel() {
|
|
28 return this.label;
|
|
29 }
|
|
30
|
|
31 getName() {
|
|
32 return this.name;
|
|
33 }
|
|
34
|
|
35 isOutgoing() {
|
|
36 return this.outgoing;
|
|
37 }
|
|
38 }
|