Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
morpheus.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Daria Zenkova
morpheus.js
Commits
5845108e
Commit
5845108e
authored
May 17, 2016
by
Joshua Gould
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
empty check
parent
7ad195e9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
93 deletions
+93
-93
src/matrix/sort_key.js
src/matrix/sort_key.js
+93
-93
No files found.
src/matrix/sort_key.js
View file @
5845108e
morpheus
.
MatchesOnTopSortKey
=
function
(
project
,
modelIndices
,
name
)
{
morpheus
.
MatchesOnTopSortKey
=
function
(
project
,
modelIndices
,
name
)
{
var
modelHighlight
=
{};
var
modelHighlight
=
{};
var
p
=
project
;
var
p
=
project
;
var
viewIndices
=
[];
var
viewIndices
=
[];
...
@@ -6,7 +6,7 @@ morpheus.MatchesOnTopSortKey = function(project, modelIndices, name) {
...
@@ -6,7 +6,7 @@ morpheus.MatchesOnTopSortKey = function(project, modelIndices, name) {
modelHighlight
[
modelIndices
[
i
]]
=
true
;
modelHighlight
[
modelIndices
[
i
]]
=
true
;
viewIndices
.
push
(
i
);
viewIndices
.
push
(
i
);
}
}
this
.
comparator
=
function
(
i1
,
i2
)
{
this
.
comparator
=
function
(
i1
,
i2
)
{
var
a
=
modelHighlight
[
i1
]
===
undefined
?
0
:
1
;
var
a
=
modelHighlight
[
i1
]
===
undefined
?
0
:
1
;
var
b
=
modelHighlight
[
i2
]
==
undefined
?
0
:
1
;
var
b
=
modelHighlight
[
i2
]
==
undefined
?
0
:
1
;
return
(
a
>
b
?
-
1
:
(
a
===
b
?
0
:
1
));
return
(
a
>
b
?
-
1
:
(
a
===
b
?
0
:
1
));
...
@@ -15,22 +15,22 @@ morpheus.MatchesOnTopSortKey = function(project, modelIndices, name) {
...
@@ -15,22 +15,22 @@ morpheus.MatchesOnTopSortKey = function(project, modelIndices, name) {
this
.
name
=
name
;
this
.
name
=
name
;
};
};
morpheus
.
MatchesOnTopSortKey
.
prototype
=
{
morpheus
.
MatchesOnTopSortKey
.
prototype
=
{
init
:
function
()
{
init
:
function
()
{
},
},
getSortOrder
:
function
()
{
getSortOrder
:
function
()
{
return
2
;
return
2
;
},
},
getComparator
:
function
()
{
getComparator
:
function
()
{
return
this
.
comparator
;
return
this
.
comparator
;
},
},
getValue
:
function
(
i
)
{
getValue
:
function
(
i
)
{
return
i
;
return
i
;
},
},
toString
:
function
(
i
)
{
toString
:
function
(
i
)
{
return
this
.
name
;
return
this
.
name
;
}
}
};
};
morpheus
.
SortKey
=
function
(
field
,
sortOrder
)
{
morpheus
.
SortKey
=
function
(
field
,
sortOrder
)
{
if
(
typeof
sortOrder
===
'
string
'
)
{
if
(
typeof
sortOrder
===
'
string
'
)
{
sortOrder
=
morpheus
.
SortKey
.
SortOrder
[
sortOrder
.
toUpperCase
()];
sortOrder
=
morpheus
.
SortKey
.
SortOrder
[
sortOrder
.
toUpperCase
()];
}
}
...
@@ -42,16 +42,16 @@ morpheus.SortKey = function(field, sortOrder) {
...
@@ -42,16 +42,16 @@ morpheus.SortKey = function(field, sortOrder) {
};
};
morpheus
.
SortKey
.
SortOrder
=
{
morpheus
.
SortKey
.
SortOrder
=
{
ASCENDING
:
0
,
ASCENDING
:
0
,
DESCENDING
:
1
,
DESCENDING
:
1
,
UNSORTED
:
2
,
UNSORTED
:
2
,
CUSTOM
:
3
,
CUSTOM
:
3
,
TOP_N
:
4
TOP_N
:
4
};
};
morpheus
.
SortKey
.
ASCENDING_COMPARATOR
=
function
(
a
,
b
)
{
morpheus
.
SortKey
.
ASCENDING_COMPARATOR
=
function
(
a
,
b
)
{
// we want NaNs to end up at the bottom
// we want NaNs to end up at the bottom
var
aNaN
=
(
a
==
null
||
_
.
isNumber
(
a
)
&&
isNaN
(
a
));
var
aNaN
=
(
a
==
null
||
_
.
isNumber
(
a
)
&&
isNaN
(
a
)
||
a
.
length
===
0
);
var
bNaN
=
(
b
==
null
||
_
.
isNumber
(
b
)
&&
isNaN
(
b
));
var
bNaN
=
(
b
==
null
||
_
.
isNumber
(
b
)
&&
isNaN
(
b
)
||
b
.
length
===
0
);
if
(
aNaN
&&
bNaN
)
{
if
(
aNaN
&&
bNaN
)
{
return
0
;
return
0
;
}
}
...
@@ -71,10 +71,10 @@ morpheus.SortKey.ASCENDING_COMPARATOR = function(a, b) {
...
@@ -71,10 +71,10 @@ morpheus.SortKey.ASCENDING_COMPARATOR = function(a, b) {
return
(
a
===
b
?
0
:
(
a
<
b
?
-
1
:
1
));
return
(
a
===
b
?
0
:
(
a
<
b
?
-
1
:
1
));
};
};
morpheus
.
SortKey
.
DESCENDING_COMPARATOR
=
function
(
a
,
b
)
{
morpheus
.
SortKey
.
DESCENDING_COMPARATOR
=
function
(
a
,
b
)
{
var
aNaN
=
(
a
==
null
||
_
.
isNumber
(
a
)
&&
isNaN
(
a
));
var
aNaN
=
(
a
==
null
||
_
.
isNumber
(
a
)
&&
isNaN
(
a
)
||
a
.
length
===
0
);
var
bNaN
=
(
b
==
null
||
_
.
isNumber
(
b
)
&&
isNaN
(
b
));
var
bNaN
=
(
b
==
null
||
_
.
isNumber
(
b
)
&&
isNaN
(
b
))
||
b
.
length
===
0
;
if
(
aNaN
&&
bNaN
)
{
if
(
aNaN
&&
bNaN
)
{
return
0
;
return
0
;
}
}
...
@@ -87,7 +87,7 @@ morpheus.SortKey.DESCENDING_COMPARATOR = function(a, b) {
...
@@ -87,7 +87,7 @@ morpheus.SortKey.DESCENDING_COMPARATOR = function(a, b) {
return
(
a
===
b
?
0
:
(
a
<
b
?
1
:
-
1
));
return
(
a
===
b
?
0
:
(
a
<
b
?
1
:
-
1
));
};
};
morpheus
.
SortKey
.
NUMBER_ASCENDING_COMPARATOR
=
function
(
a
,
b
)
{
morpheus
.
SortKey
.
NUMBER_ASCENDING_COMPARATOR
=
function
(
a
,
b
)
{
// we want NaNs to end up at the bottom
// we want NaNs to end up at the bottom
var
aNaN
=
(
a
==
null
||
isNaN
(
a
));
var
aNaN
=
(
a
==
null
||
isNaN
(
a
));
var
bNaN
=
(
b
==
null
||
isNaN
(
b
));
var
bNaN
=
(
b
==
null
||
isNaN
(
b
));
...
@@ -103,7 +103,7 @@ morpheus.SortKey.NUMBER_ASCENDING_COMPARATOR = function(a, b) {
...
@@ -103,7 +103,7 @@ morpheus.SortKey.NUMBER_ASCENDING_COMPARATOR = function(a, b) {
return
(
a
===
b
?
0
:
(
a
<
b
?
-
1
:
1
));
return
(
a
===
b
?
0
:
(
a
<
b
?
-
1
:
1
));
};
};
morpheus
.
SortKey
.
NUMBER_DESCENDING_COMPARATOR
=
function
(
a
,
b
)
{
morpheus
.
SortKey
.
NUMBER_DESCENDING_COMPARATOR
=
function
(
a
,
b
)
{
var
aNaN
=
(
a
==
null
||
isNaN
(
a
));
var
aNaN
=
(
a
==
null
||
isNaN
(
a
));
var
bNaN
=
(
b
==
null
||
isNaN
(
b
));
var
bNaN
=
(
b
==
null
||
isNaN
(
b
));
if
(
aNaN
&&
bNaN
)
{
if
(
aNaN
&&
bNaN
)
{
...
@@ -118,18 +118,18 @@ morpheus.SortKey.NUMBER_DESCENDING_COMPARATOR = function(a, b) {
...
@@ -118,18 +118,18 @@ morpheus.SortKey.NUMBER_DESCENDING_COMPARATOR = function(a, b) {
return
(
a
===
b
?
0
:
(
a
<
b
?
1
:
-
1
));
return
(
a
===
b
?
0
:
(
a
<
b
?
1
:
-
1
));
};
};
morpheus
.
SortKey
.
STRING_ASCENDING_COMPARATOR
=
function
(
a
,
b
)
{
morpheus
.
SortKey
.
STRING_ASCENDING_COMPARATOR
=
function
(
a
,
b
)
{
a
=
(
a
==
null
||
a
.
toLowerCase
===
undefined
)
?
null
:
a
.
toLowerCase
();
a
=
(
a
==
null
||
a
.
toLowerCase
===
undefined
)
?
null
:
a
.
toLowerCase
();
b
=
(
b
==
null
||
b
.
toLowerCase
===
undefined
)
?
null
:
b
.
toLowerCase
();
b
=
(
b
==
null
||
b
.
toLowerCase
===
undefined
)
?
null
:
b
.
toLowerCase
();
return
(
a
===
b
?
0
:
(
a
<
b
?
-
1
:
1
));
return
(
a
===
b
?
0
:
(
a
<
b
?
-
1
:
1
));
};
};
morpheus
.
SortKey
.
STRING_DESCENDING_COMPARATOR
=
function
(
a
,
b
)
{
morpheus
.
SortKey
.
STRING_DESCENDING_COMPARATOR
=
function
(
a
,
b
)
{
a
=
(
a
==
null
||
a
.
toLowerCase
===
undefined
)
?
null
:
a
.
toLowerCase
();
a
=
(
a
==
null
||
a
.
toLowerCase
===
undefined
)
?
null
:
a
.
toLowerCase
();
b
=
(
b
==
null
||
b
.
toLowerCase
===
undefined
)
?
null
:
b
.
toLowerCase
();
b
=
(
b
==
null
||
b
.
toLowerCase
===
undefined
)
?
null
:
b
.
toLowerCase
();
return
(
a
===
b
?
0
:
(
a
<
b
?
1
:
-
1
));
return
(
a
===
b
?
0
:
(
a
<
b
?
1
:
-
1
));
};
};
morpheus
.
SortKey
.
ELEMENT_ASCENDING_COMPARATOR
=
function
(
obj1
,
obj2
)
{
morpheus
.
SortKey
.
ELEMENT_ASCENDING_COMPARATOR
=
function
(
obj1
,
obj2
)
{
var
a
=
+
obj1
;
var
a
=
+
obj1
;
var
b
=
+
obj2
;
var
b
=
+
obj2
;
var
aNaN
=
isNaN
(
a
);
var
aNaN
=
isNaN
(
a
);
...
@@ -148,7 +148,7 @@ morpheus.SortKey.ELEMENT_ASCENDING_COMPARATOR = function(obj1, obj2) {
...
@@ -148,7 +148,7 @@ morpheus.SortKey.ELEMENT_ASCENDING_COMPARATOR = function(obj1, obj2) {
if
(
obj1
.
toObject
&&
obj2
.
toObject
)
{
if
(
obj1
.
toObject
&&
obj2
.
toObject
)
{
var
a1
=
obj1
.
toObject
();
var
a1
=
obj1
.
toObject
();
var
b1
=
obj2
.
toObject
();
var
b1
=
obj2
.
toObject
();
for
(
var
name
in
a1
)
{
for
(
var
name
in
a1
)
{
a
=
a1
[
name
];
a
=
a1
[
name
];
b
=
b1
[
name
];
b
=
b1
[
name
];
...
@@ -162,7 +162,7 @@ morpheus.SortKey.ELEMENT_ASCENDING_COMPARATOR = function(obj1, obj2) {
...
@@ -162,7 +162,7 @@ morpheus.SortKey.ELEMENT_ASCENDING_COMPARATOR = function(obj1, obj2) {
return
(
a
===
b
?
0
:
(
a
<
b
?
-
1
:
1
));
return
(
a
===
b
?
0
:
(
a
<
b
?
-
1
:
1
));
};
};
morpheus
.
SortKey
.
ELEMENT_DESCENDING_COMPARATOR
=
function
(
obj1
,
obj2
)
{
morpheus
.
SortKey
.
ELEMENT_DESCENDING_COMPARATOR
=
function
(
obj1
,
obj2
)
{
// we want NaNs to end up at the bottom
// we want NaNs to end up at the bottom
var
a
=
+
obj1
;
var
a
=
+
obj1
;
var
b
=
+
obj2
;
var
b
=
+
obj2
;
...
@@ -181,7 +181,7 @@ morpheus.SortKey.ELEMENT_DESCENDING_COMPARATOR = function(obj1, obj2) {
...
@@ -181,7 +181,7 @@ morpheus.SortKey.ELEMENT_DESCENDING_COMPARATOR = function(obj1, obj2) {
if
(
obj1
.
toObject
&&
obj2
.
toObject
)
{
if
(
obj1
.
toObject
&&
obj2
.
toObject
)
{
var
a1
=
obj1
.
toObject
();
var
a1
=
obj1
.
toObject
();
var
b1
=
obj2
.
toObject
();
var
b1
=
obj2
.
toObject
();
for
(
var
name
in
a1
)
{
for
(
var
name
in
a1
)
{
a
=
a1
[
name
];
a
=
a1
[
name
];
b
=
b1
[
name
];
b
=
b1
[
name
];
var
c
=
(
a
===
b
?
0
:
(
a
<
b
?
1
:
-
1
));
var
c
=
(
a
===
b
?
0
:
(
a
<
b
?
1
:
-
1
));
...
@@ -193,7 +193,7 @@ morpheus.SortKey.ELEMENT_DESCENDING_COMPARATOR = function(obj1, obj2) {
...
@@ -193,7 +193,7 @@ morpheus.SortKey.ELEMENT_DESCENDING_COMPARATOR = function(obj1, obj2) {
}
}
return
(
a
===
b
?
0
:
(
a
<
b
?
1
:
-
1
));
return
(
a
===
b
?
0
:
(
a
<
b
?
1
:
-
1
));
};
};
morpheus
.
SortKey
.
BOX_PLOT_SUMMARY_FUNCTION
=
function
(
array
)
{
morpheus
.
SortKey
.
BOX_PLOT_SUMMARY_FUNCTION
=
function
(
array
)
{
var
box
=
array
.
box
;
var
box
=
array
.
box
;
if
(
box
==
null
)
{
if
(
box
==
null
)
{
var
v
=
morpheus
.
VectorUtil
.
arrayAsVector
(
array
);
var
v
=
morpheus
.
VectorUtil
.
arrayAsVector
(
array
);
...
@@ -206,7 +206,7 @@ morpheus.SortKey.BOX_PLOT_SUMMARY_FUNCTION = function(array) {
...
@@ -206,7 +206,7 @@ morpheus.SortKey.BOX_PLOT_SUMMARY_FUNCTION = function(array) {
return
box
.
q3
;
return
box
.
q3
;
};
};
morpheus
.
SortKey
.
ARRAY_MAX_SUMMARY_FUNCTION
=
function
(
array
)
{
morpheus
.
SortKey
.
ARRAY_MAX_SUMMARY_FUNCTION
=
function
(
array
)
{
var
a
=
0
;
var
a
=
0
;
if
(
array
!=
null
)
{
if
(
array
!=
null
)
{
var
aPosMax
=
-
Number
.
MAX_VALUE
;
var
aPosMax
=
-
Number
.
MAX_VALUE
;
...
@@ -231,8 +231,8 @@ morpheus.SortKey.ARRAY_MAX_SUMMARY_FUNCTION = function(array) {
...
@@ -231,8 +231,8 @@ morpheus.SortKey.ARRAY_MAX_SUMMARY_FUNCTION = function(array) {
}
}
return
a
;
return
a
;
};
};
morpheus
.
SortKey
.
ARRAY_ASCENDING_COMPARATOR
=
function
(
summary
)
{
morpheus
.
SortKey
.
ARRAY_ASCENDING_COMPARATOR
=
function
(
summary
)
{
return
function
(
a
,
b
)
{
return
function
(
a
,
b
)
{
var
aNaN
=
a
==
null
;
var
aNaN
=
a
==
null
;
var
bNaN
=
b
==
null
;
var
bNaN
=
b
==
null
;
if
(
aNaN
&&
bNaN
)
{
if
(
aNaN
&&
bNaN
)
{
...
@@ -261,8 +261,8 @@ morpheus.SortKey.ARRAY_ASCENDING_COMPARATOR = function(summary) {
...
@@ -261,8 +261,8 @@ morpheus.SortKey.ARRAY_ASCENDING_COMPARATOR = function(summary) {
};
};
};
};
morpheus
.
SortKey
.
ARRAY_DESCENDING_COMPARATOR
=
function
(
summary
)
{
morpheus
.
SortKey
.
ARRAY_DESCENDING_COMPARATOR
=
function
(
summary
)
{
return
function
(
a
,
b
)
{
return
function
(
a
,
b
)
{
var
aNaN
=
a
==
null
;
var
aNaN
=
a
==
null
;
var
bNaN
=
b
==
null
;
var
bNaN
=
b
==
null
;
if
(
aNaN
&&
bNaN
)
{
if
(
aNaN
&&
bNaN
)
{
...
@@ -291,18 +291,18 @@ morpheus.SortKey.ARRAY_DESCENDING_COMPARATOR = function(summary) {
...
@@ -291,18 +291,18 @@ morpheus.SortKey.ARRAY_DESCENDING_COMPARATOR = function(summary) {
};
};
};
};
morpheus
.
SortKey
.
reverseComparator
=
function
(
c
)
{
morpheus
.
SortKey
.
reverseComparator
=
function
(
c
)
{
return
function
(
a
,
b
)
{
return
function
(
a
,
b
)
{
return
c
(
b
,
a
);
return
c
(
b
,
a
);
};
};
};
};
morpheus
.
SortKey
.
prototype
=
{
morpheus
.
SortKey
.
prototype
=
{
init
:
function
(
dataset
)
{
init
:
function
(
dataset
)
{
this
.
v
=
dataset
.
getRowMetadata
().
getByName
(
this
.
field
);
this
.
v
=
dataset
.
getRowMetadata
().
getByName
(
this
.
field
);
if
(
!
this
.
v
)
{
if
(
!
this
.
v
)
{
this
.
v
=
{};
this
.
v
=
{};
this
.
v
.
getValue
=
function
()
{
this
.
v
.
getValue
=
function
()
{
return
0
;
return
0
;
};
};
this
.
c
=
this
.
sortOrder
===
morpheus
.
SortKey
.
SortOrder
.
ASCENDING
?
morpheus
.
SortKey
.
ASCENDING_COMPARATOR
this
.
c
=
this
.
sortOrder
===
morpheus
.
SortKey
.
SortOrder
.
ASCENDING
?
morpheus
.
SortKey
.
ASCENDING_COMPARATOR
...
@@ -326,19 +326,19 @@ morpheus.SortKey.prototype = {
...
@@ -326,19 +326,19 @@ morpheus.SortKey.prototype = {
}
}
}
}
},
},
getComparator
:
function
()
{
getComparator
:
function
()
{
return
this
.
c
;
return
this
.
c
;
},
},
getValue
:
function
(
i
)
{
getValue
:
function
(
i
)
{
return
this
.
v
.
getValue
(
i
);
return
this
.
v
.
getValue
(
i
);
},
},
setSortOrder
:
function
(
sortOrder
)
{
setSortOrder
:
function
(
sortOrder
)
{
this
.
sortOrder
=
sortOrder
;
this
.
sortOrder
=
sortOrder
;
},
},
getSortOrder
:
function
()
{
getSortOrder
:
function
()
{
return
this
.
sortOrder
;
return
this
.
sortOrder
;
},
},
toString
:
function
()
{
toString
:
function
()
{
return
this
.
field
;
return
this
.
field
;
}
}
};
};
...
@@ -348,7 +348,7 @@ morpheus.SortKey.prototype = {
...
@@ -348,7 +348,7 @@ morpheus.SortKey.prototype = {
* @param isColumnSort -
* @param isColumnSort -
* sort columns by selected rows.
* sort columns by selected rows.
*/
*/
morpheus
.
SortByValuesKey
=
function
(
modelIndices
,
sortOrder
,
isColumnSort
)
{
morpheus
.
SortByValuesKey
=
function
(
modelIndices
,
sortOrder
,
isColumnSort
)
{
this
.
field
=
'
selection
'
;
this
.
field
=
'
selection
'
;
this
.
bothCount
=
10
;
this
.
bothCount
=
10
;
this
.
modelIndices
=
modelIndices
;
this
.
modelIndices
=
modelIndices
;
...
@@ -358,14 +358,14 @@ morpheus.SortByValuesKey = function(modelIndices, sortOrder, isColumnSort) {
...
@@ -358,14 +358,14 @@ morpheus.SortByValuesKey = function(modelIndices, sortOrder, isColumnSort) {
};
};
morpheus
.
SortByValuesKey
.
prototype
=
{
morpheus
.
SortByValuesKey
.
prototype
=
{
init
:
function
(
dataset
,
visibleModelIndices
)
{
init
:
function
(
dataset
,
visibleModelIndices
)
{
// isColumnSort-sort columns by selected rows
// isColumnSort-sort columns by selected rows
// dataset is transposed if !isColumnSort
// dataset is transposed if !isColumnSort
this
.
dataset
=
morpheus
.
DatasetUtil
.
slicedView
(
dataset
,
null
,
this
.
dataset
=
morpheus
.
DatasetUtil
.
slicedView
(
dataset
,
null
,
this
.
modelIndices
);
this
.
modelIndices
);
this
.
rowView
=
new
morpheus
.
DatasetRowView
(
this
.
dataset
);
this
.
rowView
=
new
morpheus
.
DatasetRowView
(
this
.
dataset
);
this
.
summaryFunction
=
this
.
modelIndices
.
length
>
1
?
morpheus
.
Median
this
.
summaryFunction
=
this
.
modelIndices
.
length
>
1
?
morpheus
.
Median
:
function
(
row
)
{
:
function
(
row
)
{
return
row
.
getValue
(
0
);
return
row
.
getValue
(
0
);
};
};
if
(
this
.
sortOrder
===
morpheus
.
SortKey
.
SortOrder
.
TOP_N
)
{
if
(
this
.
sortOrder
===
morpheus
.
SortKey
.
SortOrder
.
TOP_N
)
{
...
@@ -377,8 +377,8 @@ morpheus.SortByValuesKey.prototype = {
...
@@ -377,8 +377,8 @@ morpheus.SortByValuesKey.prototype = {
var
value
=
this
.
summaryFunction
(
this
.
rowView
.
setIndex
(
index
));
var
value
=
this
.
summaryFunction
(
this
.
rowView
.
setIndex
(
index
));
if
(
!
isNaN
(
value
))
{
if
(
!
isNaN
(
value
))
{
pairs
.
push
({
pairs
.
push
({
index
:
index
,
index
:
index
,
value
:
value
value
:
value
});
});
}
else
{
}
else
{
missingIndices
.
push
(
index
);
missingIndices
.
push
(
index
);
...
@@ -386,7 +386,7 @@ morpheus.SortByValuesKey.prototype = {
...
@@ -386,7 +386,7 @@ morpheus.SortByValuesKey.prototype = {
}
}
// sort values in descending order
// sort values in descending order
pairs
pairs
.
sort
(
function
(
a
,
b
)
{
.
sort
(
function
(
a
,
b
)
{
return
(
a
.
value
<
b
.
value
?
1
return
(
a
.
value
<
b
.
value
?
1
:
(
a
.
value
===
b
.
value
?
0
:
-
1
));
:
(
a
.
value
===
b
.
value
?
0
:
-
1
));
});
});
...
@@ -408,8 +408,8 @@ morpheus.SortByValuesKey.prototype = {
...
@@ -408,8 +408,8 @@ morpheus.SortByValuesKey.prototype = {
}
}
var
indexCounterPairs
=
[];
var
indexCounterPairs
=
[];
for
(
var
i
=
0
;
i
<
nInGroup
&&
bottomIndex
>=
0
;
i
++
,
bottomIndex
--
,
counter
++
)
{
for
(
var
i
=
0
;
i
<
nInGroup
&&
bottomIndex
>=
0
;
i
++
,
bottomIndex
--
,
counter
++
)
{
indexCounterPairs
.
push
([
bottomPairs
[
bottomIndex
].
index
,
indexCounterPairs
.
push
([
bottomPairs
[
bottomIndex
].
index
,
counter
]);
counter
]);
}
}
for
(
var
i
=
indexCounterPairs
.
length
-
1
,
j
=
0
;
i
>=
0
;
i
--
,
j
++
)
{
for
(
var
i
=
indexCounterPairs
.
length
-
1
,
j
=
0
;
i
>=
0
;
i
--
,
j
++
)
{
var
item_i
=
indexCounterPairs
[
i
];
var
item_i
=
indexCounterPairs
[
i
];
...
@@ -429,14 +429,14 @@ morpheus.SortByValuesKey.prototype = {
...
@@ -429,14 +429,14 @@ morpheus.SortByValuesKey.prototype = {
delete
this
.
modelIndexToValue
;
delete
this
.
modelIndexToValue
;
}
}
},
},
getComparator
:
function
()
{
getComparator
:
function
()
{
return
this
.
c
;
return
this
.
c
;
},
},
getValue
:
function
(
i
)
{
getValue
:
function
(
i
)
{
return
this
.
modelIndexToValue
?
this
.
modelIndexToValue
[
i
]
:
this
return
this
.
modelIndexToValue
?
this
.
modelIndexToValue
[
i
]
:
this
.
summaryFunction
(
this
.
rowView
.
setIndex
(
i
));
.
summaryFunction
(
this
.
rowView
.
setIndex
(
i
));
},
},
setSortOrder
:
function
(
sortOrder
)
{
setSortOrder
:
function
(
sortOrder
)
{
if
(
typeof
sortOrder
===
'
string
'
)
{
if
(
typeof
sortOrder
===
'
string
'
)
{
sortOrder
=
morpheus
.
SortKey
.
SortOrder
[
sortOrder
.
toUpperCase
()];
sortOrder
=
morpheus
.
SortKey
.
SortOrder
[
sortOrder
.
toUpperCase
()];
}
}
...
@@ -450,10 +450,10 @@ morpheus.SortByValuesKey.prototype = {
...
@@ -450,10 +450,10 @@ morpheus.SortByValuesKey.prototype = {
}
}
},
},
getSortOrder
:
function
()
{
getSortOrder
:
function
()
{
return
this
.
sortOrder
;
return
this
.
sortOrder
;
},
},
toString
:
function
()
{
toString
:
function
()
{
return
'
values
'
;
return
'
values
'
;
}
}
};
};
...
@@ -467,7 +467,7 @@ morpheus.SortByValuesKey.prototype = {
...
@@ -467,7 +467,7 @@ morpheus.SortByValuesKey.prototype = {
* @param name
* @param name
* This sort key name
* This sort key name
*/
*/
morpheus
.
SpecifiedModelSortOrder
=
function
(
modelIndices
,
nvisible
,
name
)
{
morpheus
.
SpecifiedModelSortOrder
=
function
(
modelIndices
,
nvisible
,
name
)
{
this
.
nvisible
=
nvisible
;
this
.
nvisible
=
nvisible
;
var
modelIndexToValue
=
[];
var
modelIndexToValue
=
[];
for
(
var
i
=
0
,
length
=
modelIndices
.
length
;
i
<
length
;
i
++
)
{
for
(
var
i
=
0
,
length
=
modelIndices
.
length
;
i
<
length
;
i
++
)
{
...
@@ -478,27 +478,27 @@ morpheus.SpecifiedModelSortOrder = function(modelIndices, nvisible, name) {
...
@@ -478,27 +478,27 @@ morpheus.SpecifiedModelSortOrder = function(modelIndices, nvisible, name) {
this
.
c
=
morpheus
.
SortKey
.
ASCENDING_COMPARATOR
;
this
.
c
=
morpheus
.
SortKey
.
ASCENDING_COMPARATOR
;
};
};
morpheus
.
SpecifiedModelSortOrder
.
prototype
=
{
morpheus
.
SpecifiedModelSortOrder
.
prototype
=
{
init
:
function
(
dataset
)
{
init
:
function
(
dataset
)
{
},
},
getComparator
:
function
(
a
,
b
)
{
getComparator
:
function
(
a
,
b
)
{
return
this
.
c
;
return
this
.
c
;
},
},
getValue
:
function
(
i
)
{
getValue
:
function
(
i
)
{
return
this
.
modelIndexToValue
[
i
];
return
this
.
modelIndexToValue
[
i
];
},
},
setSortOrder
:
function
(
sortOrder
)
{
setSortOrder
:
function
(
sortOrder
)
{
this
.
sortOrder
=
sortOrder
;
this
.
sortOrder
=
sortOrder
;
this
.
c
=
this
.
sortOrder
===
morpheus
.
SortKey
.
SortOrder
.
ASCENDING
?
morpheus
.
SortKey
.
NUMBER_ASCENDING_COMPARATOR
this
.
c
=
this
.
sortOrder
===
morpheus
.
SortKey
.
SortOrder
.
ASCENDING
?
morpheus
.
SortKey
.
NUMBER_ASCENDING_COMPARATOR
:
morpheus
.
SortKey
.
NUMBER_DESCENDING_COMPARATOR
;
:
morpheus
.
SortKey
.
NUMBER_DESCENDING_COMPARATOR
;
},
},
getSortOrder
:
function
()
{
getSortOrder
:
function
()
{
return
this
.
sortOrder
;
return
this
.
sortOrder
;
},
},
getName
:
function
()
{
getName
:
function
()
{
return
this
.
name
;
return
this
.
name
;
}
}
};
};
morpheus
.
SortKey
.
keepExistingSortKeys
=
function
(
newSortKeys
,
existingSortKeys
)
{
morpheus
.
SortKey
.
keepExistingSortKeys
=
function
(
newSortKeys
,
existingSortKeys
)
{
// keep MatchesOnTopSortKey and dendrogram
// keep MatchesOnTopSortKey and dendrogram
// var existingOnTopSortKey = null;
// var existingOnTopSortKey = null;
var
existingSpecifiedSortKey
=
null
;
var
existingSpecifiedSortKey
=
null
;
...
@@ -539,28 +539,28 @@ morpheus.SortKey.keepExistingSortKeys = function(newSortKeys, existingSortKeys)
...
@@ -539,28 +539,28 @@ morpheus.SortKey.keepExistingSortKeys = function(newSortKeys, existingSortKeys)
*
*
* @param values
* @param values
*/
*/
morpheus
.
SpecifiedGroupByKey
=
function
(
clusterIds
)
{
morpheus
.
SpecifiedGroupByKey
=
function
(
clusterIds
)
{
this
.
clusterIds
=
clusterIds
;
this
.
clusterIds
=
clusterIds
;
this
.
c
=
function
(
a
,
b
)
{
this
.
c
=
function
(
a
,
b
)
{
return
(
a
===
b
?
0
:
// Values are equal
return
(
a
===
b
?
0
:
// Values are equal
(
a
<
b
?
-
1
:
// (-0.0, 0.0) or (!NaN, NaN)
(
a
<
b
?
-
1
:
// (-0.0, 0.0) or (!NaN, NaN)
1
));
1
));
};
};
};
};
morpheus
.
SpecifiedGroupByKey
.
prototype
=
{
morpheus
.
SpecifiedGroupByKey
.
prototype
=
{
init
:
function
(
dataset
)
{
init
:
function
(
dataset
)
{
},
},
getComparator
:
function
(
a
,
b
)
{
getComparator
:
function
(
a
,
b
)
{
return
this
.
c
;
return
this
.
c
;
},
},
getValue
:
function
(
i
)
{
getValue
:
function
(
i
)
{
return
this
.
clusterIds
[
i
];
return
this
.
clusterIds
[
i
];
},
},
setSortOrder
:
function
(
sortOrder
)
{
setSortOrder
:
function
(
sortOrder
)
{
},
},
getSortOrder
:
function
()
{
getSortOrder
:
function
()
{
},
},
getName
:
function
()
{
getName
:
function
()
{
return
'
Dendrogram Cut
'
;
return
'
Dendrogram Cut
'
;
}
}
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment