Mercurial > hg > ng2-query-ismi
comparison src/app/relation-type.ts @ 47:b65a031c4967 ng2-final
first step to angular2-final (2.4) version of the query browser.
author | casties |
---|---|
date | Fri, 17 Mar 2017 20:16:52 +0100 |
parents | app/relation-type.ts@896ae7eefb33 |
children |
comparison
equal
deleted
inserted
replaced
46:1f3fed01aef6 | 47:b65a031c4967 |
---|---|
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 relType: string; | |
10 public label: string; | |
11 public outgoing: boolean; | |
12 | |
13 constructor (relType: string, isOutgoing: boolean, label?:string) { | |
14 this.outgoing = isOutgoing; | |
15 this.relType = relType; | |
16 if (isOutgoing) { | |
17 this.name = relType; | |
18 } else { | |
19 this.name = invNamePrefix + relType; | |
20 } | |
21 if (label != null) { | |
22 this.label = label; | |
23 } else { | |
24 // create label using name | |
25 if (isOutgoing) { | |
26 this.label = rawLabelPrefix + relType + rawLabelPostfix; | |
27 } else { | |
28 this.label = rawLabelPrefix + invLabelPrefix + relType + rawLabelPostfix; | |
29 } | |
30 } | |
31 } | |
32 | |
33 getLabel() { | |
34 return this.label; | |
35 } | |
36 | |
37 getName() { | |
38 return this.name; | |
39 } | |
40 | |
41 getRelType() { | |
42 return this.relType; | |
43 } | |
44 | |
45 isOutgoing() { | |
46 return this.outgoing; | |
47 } | |
48 } |