Mercurial > hg > ng2-query-ismi
comparison app/relation-type.ts @ 40:896ae7eefb33
fix relation type queries.
author | casties |
---|---|
date | Mon, 15 Feb 2016 11:10:08 +0100 |
parents | 7578b21cdf2e |
children |
comparison
equal
deleted
inserted
replaced
39:7578b21cdf2e | 40:896ae7eefb33 |
---|---|
4 export var rawLabelPrefix = '('; | 4 export var rawLabelPrefix = '('; |
5 export var rawLabelPostfix = ')'; | 5 export var rawLabelPostfix = ')'; |
6 | 6 |
7 export class RelationType { | 7 export class RelationType { |
8 public name: string; | 8 public name: string; |
9 public relType: string; | |
9 public label: string; | 10 public label: string; |
10 public outgoing: boolean; | 11 public outgoing: boolean; |
11 | 12 |
12 constructor (name: string, isOutgoing: boolean, label?:string) { | 13 constructor (relType: string, isOutgoing: boolean, label?:string) { |
13 this.name = name; | |
14 this.outgoing = isOutgoing; | 14 this.outgoing = isOutgoing; |
15 this.relType = relType; | |
16 if (isOutgoing) { | |
17 this.name = relType; | |
18 } else { | |
19 this.name = invNamePrefix + relType; | |
20 } | |
15 if (label != null) { | 21 if (label != null) { |
16 this.label = label; | 22 this.label = label; |
17 } else { | 23 } else { |
18 // create label using name | 24 // create label using name |
19 if (isOutgoing) { | 25 if (isOutgoing) { |
20 this.label = rawLabelPrefix + name + rawLabelPostfix; | 26 this.label = rawLabelPrefix + relType + rawLabelPostfix; |
21 } else { | 27 } else { |
22 this.label = rawLabelPrefix + invLabelPrefix + name + rawLabelPostfix; | 28 this.label = rawLabelPrefix + invLabelPrefix + relType + rawLabelPostfix; |
23 } | 29 } |
24 } | 30 } |
25 } | 31 } |
26 | 32 |
27 getLabel() { | 33 getLabel() { |
30 | 36 |
31 getName() { | 37 getName() { |
32 return this.name; | 38 return this.name; |
33 } | 39 } |
34 | 40 |
41 getRelType() { | |
42 return this.relType; | |
43 } | |
44 | |
35 isOutgoing() { | 45 isOutgoing() { |
36 return this.outgoing; | 46 return this.outgoing; |
37 } | 47 } |
38 } | 48 } |