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;
|
40
|
9 public relType: string;
|
39
|
10 public label: string;
|
|
11 public outgoing: boolean;
|
|
12
|
40
|
13 constructor (relType: string, isOutgoing: boolean, label?:string) {
|
39
|
14 this.outgoing = isOutgoing;
|
40
|
15 this.relType = relType;
|
|
16 if (isOutgoing) {
|
|
17 this.name = relType;
|
|
18 } else {
|
|
19 this.name = invNamePrefix + relType;
|
|
20 }
|
39
|
21 if (label != null) {
|
|
22 this.label = label;
|
|
23 } else {
|
|
24 // create label using name
|
|
25 if (isOutgoing) {
|
40
|
26 this.label = rawLabelPrefix + relType + rawLabelPostfix;
|
39
|
27 } else {
|
40
|
28 this.label = rawLabelPrefix + invLabelPrefix + relType + rawLabelPostfix;
|
39
|
29 }
|
|
30 }
|
|
31 }
|
|
32
|
|
33 getLabel() {
|
|
34 return this.label;
|
|
35 }
|
|
36
|
|
37 getName() {
|
|
38 return this.name;
|
|
39 }
|
|
40
|
40
|
41 getRelType() {
|
|
42 return this.relType;
|
|
43 }
|
|
44
|
39
|
45 isOutgoing() {
|
|
46 return this.outgoing;
|
|
47 }
|
|
48 }
|