forked from NatLabRockies/nodehaystack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHCol.js
More file actions
65 lines (58 loc) · 1.31 KB
/
HCol.js
File metadata and controls
65 lines (58 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// Copyright (c) 2015, Shawn Jacobson
// Licensed under the Academic Free License version 3.0
//
// Ported from @see {@link https://bitbucket.org/brianfrank/haystack-java|Haystack Java Toolkit}
//
// History:
// 21 Mar 2015 Shawn Jacobson Creation
//
/**
* HCol is a column in a HGrid.
* @see {@link http://project-haystack.org/doc/Grids|Project Haystack}
*
* @constructor
* @private
* @param {int} index
* @param {string} uname
* @param {HDict} dict
*/
function HCol(index, uname, dict) {
this.index = index;
this.uname = uname;
this.dict = dict;
}
module.exports = HCol;
var HStr = require('./HStr');
/**
* Return programmatic name of column
* @return {string}
*/
HCol.prototype.name = function() {
return this.uname;
};
/**
* Column meta-data tags
* @return {HDict}
*/
HCol.prototype.meta = function() {
return this.dict;
};
/**
* Return display name of column which is dict.dis or uname
* @return {string}
*/
HCol.prototype.dis = function() {
var dis = this.dict.get("dis", false);
if (dis instanceof HStr)
return dis.val;
return this.uname;
};
/**
* Equality is name and meta
* @param {HCol} that - object to be compared to
* @return {boolean}
*/
HCol.prototype.equals = function(that) {
return that instanceof HCol && this.uname === that.uname && this.dict.equals(that.dict);
};