Module.SortedVector

A vector of strings that can be reordered

usage:
var labels=ravel.handle.sliceLabels;

methods:
resize(newSize)
resizes the vector. If newSize>size(), then the new positions will have empty labels. So this method is more useful for trimming entries off the end of the list. The order attribute is preserved, however any custom permutation is lost.
clear()
Clears the vector. Equivalent to resize(0).
push_back(label)
pushes a new label onto the vector. Ordering is preserved, as described under resize().
size()
returns the number of labels

getOrder()
The order attribute is an enum Module.Order with the following values:
Module.Order.none
The order is in the same order the labels were originally added to the vector, or in custom order if a custom permutation is applied.
Module.Order.forward
The labels are in lexicographic order
Module.Order.reverse
The labels are in reverse lexicographic order
Module.Order.numForward
The labels are in numerical order. If two labels have equal numerical prefix, they are ordered lexicographically.
Module.Order.numReverse
The labels are in reverse numerical order.
setOrder(order)
sets the order attribute

customPermutation(perm)
Apply a custom permutation to the sorting order. This overrides the effects of the order attribute. perm is an array of the integers 0..size() in some permuted order.
isPermValid()
returns true if the applied customPermutation is a valid permutation.
get()
returns a javascript array of labels
set(labels)
sets the vector to the array of labels

Ravelation Pty Ldt