Mercurial > hg > ng2-query-ismi
view app/relation-type.ts @ 39:7578b21cdf2e
make relation types configurable.
relations can have custom labels for incoming or outgoing direction.
author | casties |
---|---|
date | Sun, 14 Feb 2016 19:40:07 +0100 |
parents | |
children | 896ae7eefb33 |
line wrap: on
line source
export var invLabelPrefix = '<- '; export var invNamePrefix = '-'; export var rawLabelPrefix = '('; export var rawLabelPostfix = ')'; export class RelationType { public name: string; public label: string; public outgoing: boolean; constructor (name: string, isOutgoing: boolean, label?:string) { this.name = name; this.outgoing = isOutgoing; if (label != null) { this.label = label; } else { // create label using name if (isOutgoing) { this.label = rawLabelPrefix + name + rawLabelPostfix; } else { this.label = rawLabelPrefix + invLabelPrefix + name + rawLabelPostfix; } } } getLabel() { return this.label; } getName() { return this.name; } isOutgoing() { return this.outgoing; } }