linmeric 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +51 -0
- data/Rakefile +10 -0
- data/bin/help/Help.rb +184 -0
- data/bin/help/Help_inst.rb +244 -0
- data/bin/linguide +23 -0
- data/bin/linmeric +36 -70
- data/doc/Archive.html +352 -0
- data/doc/Calculator/Evaluator.html +477 -0
- data/doc/Calculator/Lexer.html +186 -0
- data/doc/Calculator/Token.html +257 -0
- data/doc/Calculator.html +181 -0
- data/doc/Dim.html +257 -0
- data/doc/Filename.html +246 -0
- data/doc/Fixnum.html +253 -0
- data/doc/Float.html +253 -0
- data/doc/Function.html +784 -0
- data/doc/InputError.html +102 -0
- data/doc/Instructions_en.txt +6 -7
- data/doc/Instructions_it.txt +6 -9
- data/doc/Integrators.html +436 -0
- data/doc/LU.html +435 -0
- data/doc/Lexer.html +261 -0
- data/doc/Linmeric.html +109 -0
- data/doc/Listener.html +605 -0
- data/doc/Matrix.html +1719 -0
- data/doc/MyArgError.html +102 -0
- data/doc/NilClass.html +202 -0
- data/doc/Numeric.html +251 -0
- data/doc/Parser.html +389 -0
- data/doc/PrintError.html +622 -0
- data/doc/README_md.html +142 -0
- data/doc/Scp.html +530 -0
- data/doc/Sizer.html +652 -0
- data/doc/String.html +540 -0
- data/doc/Token.html +341 -0
- data/doc/Tool.html +394 -0
- data/doc/created.rid +18 -0
- data/doc/css/fonts.css +167 -0
- data/doc/css/rdoc.css +590 -0
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +190 -0
- data/doc/js/darkfish.js +161 -0
- data/doc/js/jquery.js +9404 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +109 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +228 -0
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +834 -0
- data/lib/linmeric/Archive.rb +22 -1
- data/lib/linmeric/Calculator.rb +252 -0
- data/lib/linmeric/CnGal_Matrix_class.rb +130 -49
- data/lib/linmeric/CnGal_new_classes.rb +139 -37
- data/lib/linmeric/CnGal_tools.rb +23 -40
- data/lib/linmeric/Error_print.rb +35 -1
- data/lib/linmeric/Function_class.rb +70 -11
- data/lib/linmeric/Integrators.rb +81 -35
- data/lib/linmeric/LU.rb +26 -5
- data/lib/linmeric/Lexer.rb +19 -1
- data/lib/linmeric/Listener.rb +25 -5
- data/lib/linmeric/Parser.rb +23 -1
- data/lib/linmeric/Scopify.rb +52 -31
- data/lib/linmeric/Sizer.rb +43 -10
- data/lib/linmeric/Token.rb +23 -4
- data/lib/linmeric/version.rb +3 -0
- data/lib/linmeric.rb +10 -8
- data/lib/linmeric_bin.rb +12 -0
- metadata +126 -22
- data/doc/Instructions_en.html +0 -231
- data/doc/Instructions_it.html +0 -231
- data/doc/README_en.html +0 -177
- data/doc/README_en.txt +0 -30
- data/doc/README_it.html +0 -187
- data/doc/README_it.txt +0 -32
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Navigation allows movement using the arrow keys through the search results.
|
|
3
|
+
*
|
|
4
|
+
* When using this library you will need to set scrollIntoView to the
|
|
5
|
+
* appropriate function for your layout. Use scrollInWindow if the container
|
|
6
|
+
* is not scrollable and scrollInElement if the container is a separate
|
|
7
|
+
* scrolling region.
|
|
8
|
+
*/
|
|
9
|
+
Navigation = new function() {
|
|
10
|
+
this.initNavigation = function() {
|
|
11
|
+
var _this = this;
|
|
12
|
+
|
|
13
|
+
$(document).keydown(function(e) {
|
|
14
|
+
_this.onkeydown(e);
|
|
15
|
+
}).keyup(function(e) {
|
|
16
|
+
_this.onkeyup(e);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
this.navigationActive = true;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
this.setNavigationActive = function(state) {
|
|
23
|
+
this.navigationActive = state;
|
|
24
|
+
this.clearMoveTimeout();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
this.onkeyup = function(e) {
|
|
28
|
+
if (!this.navigationActive) return;
|
|
29
|
+
|
|
30
|
+
switch(e.keyCode) {
|
|
31
|
+
case 37: //Event.KEY_LEFT:
|
|
32
|
+
case 38: //Event.KEY_UP:
|
|
33
|
+
case 39: //Event.KEY_RIGHT:
|
|
34
|
+
case 40: //Event.KEY_DOWN:
|
|
35
|
+
this.clearMoveTimeout();
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
this.onkeydown = function(e) {
|
|
41
|
+
if (!this.navigationActive) return;
|
|
42
|
+
switch(e.keyCode) {
|
|
43
|
+
case 37: //Event.KEY_LEFT:
|
|
44
|
+
if (this.moveLeft()) e.preventDefault();
|
|
45
|
+
break;
|
|
46
|
+
case 38: //Event.KEY_UP:
|
|
47
|
+
if (e.keyCode == 38 || e.ctrlKey) {
|
|
48
|
+
if (this.moveUp()) e.preventDefault();
|
|
49
|
+
this.startMoveTimeout(false);
|
|
50
|
+
}
|
|
51
|
+
break;
|
|
52
|
+
case 39: //Event.KEY_RIGHT:
|
|
53
|
+
if (this.moveRight()) e.preventDefault();
|
|
54
|
+
break;
|
|
55
|
+
case 40: //Event.KEY_DOWN:
|
|
56
|
+
if (e.keyCode == 40 || e.ctrlKey) {
|
|
57
|
+
if (this.moveDown()) e.preventDefault();
|
|
58
|
+
this.startMoveTimeout(true);
|
|
59
|
+
}
|
|
60
|
+
break;
|
|
61
|
+
case 13: //Event.KEY_RETURN:
|
|
62
|
+
if (this.$current)
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
this.select(this.$current);
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
if (e.ctrlKey && e.shiftKey) this.select(this.$current);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
this.clearMoveTimeout = function() {
|
|
71
|
+
clearTimeout(this.moveTimeout);
|
|
72
|
+
this.moveTimeout = null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
this.startMoveTimeout = function(isDown) {
|
|
76
|
+
if (!$.browser.mozilla && !$.browser.opera) return;
|
|
77
|
+
if (this.moveTimeout) this.clearMoveTimeout();
|
|
78
|
+
var _this = this;
|
|
79
|
+
|
|
80
|
+
var go = function() {
|
|
81
|
+
if (!_this.moveTimeout) return;
|
|
82
|
+
_this[isDown ? 'moveDown' : 'moveUp']();
|
|
83
|
+
_this.moveTimout = setTimeout(go, 100);
|
|
84
|
+
}
|
|
85
|
+
this.moveTimeout = setTimeout(go, 200);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
this.moveRight = function() {
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
this.moveLeft = function() {
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
this.move = function(isDown) {
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
this.moveUp = function() {
|
|
98
|
+
return this.move(false);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
this.moveDown = function() {
|
|
102
|
+
return this.move(true);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/*
|
|
106
|
+
* Scrolls to the given element in the scrollable element view.
|
|
107
|
+
*/
|
|
108
|
+
this.scrollInElement = function(element, view) {
|
|
109
|
+
var offset, viewHeight, viewScroll, height;
|
|
110
|
+
offset = element.offsetTop;
|
|
111
|
+
height = element.offsetHeight;
|
|
112
|
+
viewHeight = view.offsetHeight;
|
|
113
|
+
viewScroll = view.scrollTop;
|
|
114
|
+
|
|
115
|
+
if (offset - viewScroll + height > viewHeight) {
|
|
116
|
+
view.scrollTop = offset - viewHeight + height;
|
|
117
|
+
}
|
|
118
|
+
if (offset < viewScroll) {
|
|
119
|
+
view.scrollTop = offset;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/*
|
|
124
|
+
* Scrolls to the given element in the window. The second argument is
|
|
125
|
+
* ignored
|
|
126
|
+
*/
|
|
127
|
+
this.scrollInWindow = function(element, ignored) {
|
|
128
|
+
var offset, viewHeight, viewScroll, height;
|
|
129
|
+
offset = element.offsetTop;
|
|
130
|
+
height = element.offsetHeight;
|
|
131
|
+
viewHeight = window.innerHeight;
|
|
132
|
+
viewScroll = window.scrollY;
|
|
133
|
+
|
|
134
|
+
if (offset - viewScroll + height > viewHeight) {
|
|
135
|
+
window.scrollTo(window.scrollX, offset - viewHeight + height);
|
|
136
|
+
}
|
|
137
|
+
if (offset < viewScroll) {
|
|
138
|
+
window.scrollTo(window.scrollX, offset);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
Binary file
|
data/doc/js/search.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
Search = function(data, input, result) {
|
|
2
|
+
this.data = data;
|
|
3
|
+
this.$input = $(input);
|
|
4
|
+
this.$result = $(result);
|
|
5
|
+
|
|
6
|
+
this.$current = null;
|
|
7
|
+
this.$view = this.$result.parent();
|
|
8
|
+
this.searcher = new Searcher(data.index);
|
|
9
|
+
this.init();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
Search.prototype = $.extend({}, Navigation, new function() {
|
|
13
|
+
var suid = 1;
|
|
14
|
+
|
|
15
|
+
this.init = function() {
|
|
16
|
+
var _this = this;
|
|
17
|
+
var observer = function(e) {
|
|
18
|
+
switch(e.originalEvent.keyCode) {
|
|
19
|
+
case 38: // Event.KEY_UP
|
|
20
|
+
case 40: // Event.KEY_DOWN
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
_this.search(_this.$input[0].value);
|
|
24
|
+
};
|
|
25
|
+
this.$input.keyup(observer);
|
|
26
|
+
this.$input.click(observer); // mac's clear field
|
|
27
|
+
|
|
28
|
+
this.searcher.ready(function(results, isLast) {
|
|
29
|
+
_this.addResults(results, isLast);
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
this.initNavigation();
|
|
33
|
+
this.setNavigationActive(false);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
this.search = function(value, selectFirstMatch) {
|
|
37
|
+
value = jQuery.trim(value).toLowerCase();
|
|
38
|
+
if (value) {
|
|
39
|
+
this.setNavigationActive(true);
|
|
40
|
+
} else {
|
|
41
|
+
this.setNavigationActive(false);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (value == '') {
|
|
45
|
+
this.lastQuery = value;
|
|
46
|
+
this.$result.empty();
|
|
47
|
+
this.$result.attr('aria-expanded', 'false');
|
|
48
|
+
this.setNavigationActive(false);
|
|
49
|
+
} else if (value != this.lastQuery) {
|
|
50
|
+
this.lastQuery = value;
|
|
51
|
+
this.$result.attr('aria-busy', 'true');
|
|
52
|
+
this.$result.attr('aria-expanded', 'true');
|
|
53
|
+
this.firstRun = true;
|
|
54
|
+
this.searcher.find(value);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
this.addResults = function(results, isLast) {
|
|
59
|
+
var target = this.$result.get(0);
|
|
60
|
+
if (this.firstRun && (results.length > 0 || isLast)) {
|
|
61
|
+
this.$current = null;
|
|
62
|
+
this.$result.empty();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
for (var i=0, l = results.length; i < l; i++) {
|
|
66
|
+
var item = this.renderItem.call(this, results[i]);
|
|
67
|
+
item.setAttribute('id', 'search-result-' + target.childElementCount);
|
|
68
|
+
target.appendChild(item);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
if (this.firstRun && results.length > 0) {
|
|
72
|
+
this.firstRun = false;
|
|
73
|
+
this.$current = $(target.firstChild);
|
|
74
|
+
this.$current.addClass('search-selected');
|
|
75
|
+
}
|
|
76
|
+
if (jQuery.browser.msie) this.$element[0].className += '';
|
|
77
|
+
|
|
78
|
+
if (isLast) this.$result.attr('aria-busy', 'false');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
this.move = function(isDown) {
|
|
82
|
+
if (!this.$current) return;
|
|
83
|
+
var $next = this.$current[isDown ? 'next' : 'prev']();
|
|
84
|
+
if ($next.length) {
|
|
85
|
+
this.$current.removeClass('search-selected');
|
|
86
|
+
$next.addClass('search-selected');
|
|
87
|
+
this.$input.attr('aria-activedescendant', $next.attr('id'));
|
|
88
|
+
this.scrollIntoView($next[0], this.$view[0]);
|
|
89
|
+
this.$current = $next;
|
|
90
|
+
this.$input.val($next[0].firstChild.firstChild.text);
|
|
91
|
+
this.$input.select();
|
|
92
|
+
}
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
this.hlt = function(html) {
|
|
97
|
+
return this.escapeHTML(html).
|
|
98
|
+
replace(/\u0001/g, '<em>').
|
|
99
|
+
replace(/\u0002/g, '</em>');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
this.escapeHTML = function(html) {
|
|
103
|
+
return html.replace(/[&<>]/g, function(c) {
|
|
104
|
+
return '&#' + c.charCodeAt(0) + ';';
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
});
|
|
109
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var search_data = {"index":{"searchIndex":["archive","calculator","evaluator","lexer","token","dim","filename","fixnum","float","function","inputerror","integrators","lu","lexer","linmeric","listener","matrix","myargerror","nilclass","numeric","parser","printerror","scp","sizer","string","token","tool","!=()","*()","**()","+()","-()","-()","/()","==()","l()","u()","[]()","[]=()","analyze()","attribute()","balanced_brackets?()","balanced_brackets?()","boole()","can_divide?()","can_divide?()","can_divide?()","can_divide?()","can_multiply?()","can_multiply?()","can_multiply?()","can_multiply?()","check_block()","clear_line()","coerce()","collect_single_key()","compact()","contain?()","contain_all?()","convert()","count()","count()","current_tk()","cursor_to()","default()","del_rwcl()","discard()","dx()","evaluate()","export()","extract()","extract()","extract_gen_exp()","f()","factorize()","float?()","from_file()","getcls()","getrws()","gets()","identity()","insert_b()","integer?()","integrate()","is_a?()","is_exp?()","is_keyword?()","is_similar?()","is_squared?()","keys()","laplace()","letters()","make_op()","me()","midpoint()","missing()","missing_expression_after_equal()","missing_general_string()","missing_integ_range()","missmatch()","name()","new()","new()","new()","new()","new()","new()","new()","new()","new()","new()","next_()","no_final_quotes()","norm()","numpoint_missing()","number?()","ok?()","operators()","parse()","parse()","position()","previous()","print()","print_stack()","priority()","read_char()","reduced()","remove()","reset()","reset()","reset()","rettdx()","rettsx()","scopify()","similar_to?()","similar_to?()","similar_to?()","simpson()","size()","solve()","solve()","state0_1()","state2()","store()","swap()","sx()","tag()","to_block()","to_file()","to_n()","to_s()","to_s()","to_s()","to_s()","tokenize()","tokenize()","tokenize()","top()","tr()","translate()","trapezi()","unexpected_token_in_solve()","unknown()","update()","value()","vars()","readme"],"longSearchIndex":["archive","calculator","calculator::evaluator","calculator::lexer","calculator::token","dim","filename","fixnum","float","function","inputerror","integrators","lu","lexer","linmeric","listener","matrix","myargerror","nilclass","numeric","parser","printerror","scp","sizer","string","token","tool","matrix#!=()","matrix#*()","matrix#**()","matrix#+()","matrix#-()","string#-()","matrix#/()","matrix#==()","lu::l()","lu::u()","matrix#[]()","matrix#[]=()","sizer#analyze()","token#attribute()","function#balanced_brackets?()","sizer#balanced_brackets?()","integrators::boole()","fixnum#can_divide?()","float#can_divide?()","matrix#can_divide?()","numeric#can_divide?()","fixnum#can_multiply?()","float#can_multiply?()","matrix#can_multiply?()","numeric#can_multiply?()","sizer#check_block()","listener#clear_line()","matrix#coerce()","listener#collect_single_key()","string#compact()","string#contain?()","string#contain_all?()","function#convert()","scp#count()","sizer#count()","calculator::evaluator#current_tk()","listener#cursor_to()","printerror::default()","matrix#del_rwcl()","scp#discard()","dim#dx()","calculator::evaluator#evaluate()","matrix#export()","parser#extract()","scp#extract()","lexer#extract_gen_exp()","tool::f()","lu::factorize()","string#float?()","matrix::from_file()","matrix#getcls()","matrix#getrws()","listener#gets()","matrix::identity()","scp#insert_b()","string#integer?()","function#integrate()","filename#is_a?()","tool::is_exp?()","tool::is_keyword?()","numeric#is_similar?()","matrix#is_squared?()","tool::keys()","matrix#laplace()","tool::letters()","calculator::evaluator#make_op()","token#me()","integrators::midpoint()","printerror::missing()","printerror::missing_expression_after_equal()","printerror::missing_general_string()","printerror::missing_integ_range()","printerror::missmatch()","filename#name()","archive::new()","calculator::token::new()","dim::new()","function::new()","listener::new()","matrix::new()","parser::new()","scp::new()","sizer::new()","token::new()","archive#next_()","printerror::no_final_quotes()","matrix#norm()","printerror::numpoint_missing()","string#number?()","function#ok?()","tool::operators()","calculator::evaluator#parse()","parser#parse()","token#position()","archive#previous()","printerror::print()","tool::print_stack()","calculator::evaluator#priority()","listener#read_char()","printerror::reduced()","string#remove()","lu::reset()","listener#reset()","parser#reset()","integrators::rettdx()","integrators::rettsx()","scp#scopify()","fixnum#similar_to?()","float#similar_to?()","matrix#similar_to?()","integrators::simpson()","nilclass#size()","calculator::solve()","lu::solve()","calculator::evaluator#state0_1()","calculator::evaluator#state2()","archive#store()","lu::swap()","dim#sx()","calculator::token#tag()","function#to_block()","matrix#to_file()","string#to_n()","filename#to_s()","function#to_s()","matrix#to_s()","nilclass#to_s()","calculator::lexer#tokenize()","function#tokenize()","lexer#tokenize()","archive#top()","matrix#tr()","function#translate()","integrators::trapezi()","printerror::unexpected_token_in_solve()","printerror::unknown()","matrix#update()","calculator::token#value()","function#vars()",""],"info":[["Archive","","Archive.html","","<p>This class provides a useful object to store the command history of\nlinmeric\n<p>Author — Massimiliano Dal …\n"],["Calculator","","Calculator.html","","<p>This file contains a simple expression evaluator to convert math binary\noperations in a result. It is …\n"],["Calculator::Evaluator","","Calculator/Evaluator.html","","<p>Evaluator parses and evaluates at the same time the stream of tokens\n<p>Author — Massimiliano Dal Mas (max.codeware@gmail.com …\n"],["Calculator::Lexer","","Calculator/Lexer.html","","<p>This lexser creates the tokens splitting the input string according to the\noperators (OP => see Calculator …\n"],["Calculator::Token","","Calculator/Token.html","","<p>Definition of a simple token with an attribute (@tag) and a value (@val)\n<p>Author — Massimiliano Dal Mas ( …\n"],["Dim","","Dim.html","","<p>Definition of a dimension (structure: from-to)\n<p>Author — Massimiliano Dal Mas (max.codeware@gmail.com)\n<p>License … — "],["Filename","","Filename.html","","<p>Defining a subclass of string to identify a fileneme\n<p>Author — Massimiliano Dal Mas (max.codeware@gmail.com …\n"],["Fixnum","","Fixnum.html","","<p>Overload of Fixnum class\n<p>Author — Massimiliano Dal Mas (max.codeware@gmail.com)\n<p>License — Distributed under …\n"],["Float","","Float.html","","<p>Overload of Float class\n<p>Author — Massimiliano Dal Mas (max.codeware@gmail.com)\n<p>License — Distributed under …\n"],["Function","","Function.html","","<p>This class provides a simple representation of a function and some method\nto manipulate it\n<p>Author — Massimiliano …\n"],["InputError","","InputError.html","",""],["Integrators","","Integrators.html","","<p>This module provides some method to integrate a function\n<p>Author — Massimiliano Dal Mas (max.codeware@gmail.com …\n"],["LU","","LU.html","","<p>This module provides some method to perform LU factorization on squared\nmatrices.\n<p>Author — Massimiliano …\n"],["Lexer","","Lexer.html","","<p>This simple Lexer tokenizes the input stream of commands for the sintax\nanalyzer\n<p>Author — Massimiliano …\n"],["Linmeric","","Linmeric.html","",""],["Listener","","Listener.html","","<p>This class works on the command line interface to allow the user to move\nthe cursor, modify the input …\n"],["Matrix","","Matrix.html","","<p>This class provides a simple representation of a matrix with the main\nfeatures, operations and some useful …\n"],["MyArgError","","MyArgError.html","",""],["NilClass","","NilClass.html","","<p>Overload of NilClass\n<p>Author — Massimiliano Dal Mas (max.codeware@gmail.com)\n<p>License — Distributed under MIT …\n"],["Numeric","","Numeric.html","","<p>Overload of Numeric class\n<p>Author — Massimiliano Dal Mas (max.codeware@gmail.com)\n<p>License — Distributed under …\n"],["Parser","","Parser.html","","<p>This is a stack-based parser that returns a tree in array format. Sub\narrays are operations with higher …\n"],["PrintError","","PrintError.html","","<p>This modue provides a set of error messages for linmeric\n<p>Author — Massimiliano Dal Mas (max.codeware@gmail.com …\n"],["Scp","","Scp.html","","<p>This class manipulates a string representing an algebric expression\nunderlining the higher priority operations …\n"],["Sizer","","Sizer.html","","<p>Sizer analyzes the sintax of the inserted commands printing errors if they\nare found, before the string …\n"],["String","","String.html","","<p>Overload of String class\n<p>Author — Massimiliano Dal Mas (max.codeware@gmail.com)\n<p>License — Distributed under …\n"],["Token","","Token.html","","<p>This class generates a token object with three parameters:\n<p>Attribute\n<p>Position\n"],["Tool","","Tool.html","","<p>Provides some useful procedure for linmeric\n<p>Author — Massimiliano Dal Mas (max.codeware@gmail.com)\n<p>License … — "],["!=","Matrix","Matrix.html#method-i-21-3D","(obj)","<p>Checks if this matrix is different from another object\n<p>*<strong>argument</strong>*: `Object` to be compared with\n<p>*<strong>returns</strong> …\n"],["*","Matrix","Matrix.html#method-i-2A","(ob)","<p>Multiplies the current matrix to another\n<p>*<strong>argument</strong>*: `Matrix` to be multiplied to\n<p>*<strong>returns</strong>*: `Matrix` object …\n"],["**","Matrix","Matrix.html#method-i-2A-2A","(obj)","<p>Elevates each element of the current matrix to a `Numeric` exponent\n<p>*<strong>argument</strong>*: `Numeric`\n<p>*<strong>returns</strong>*: `Matrix` …\n"],["+","Matrix","Matrix.html#method-i-2B","(m)","<p>Sums the current matrix to another\n<p>*<strong>argument</strong>*: `Matrix` to be summed to\n<p>*<strong>returns</strong>*: `Matrix` object\n"],["-","Matrix","Matrix.html#method-i-2D","(m)","<p>Subtracts the current matrix to another\n<p>*<strong>argument</strong>*: `Matrix` to be subtracted to\n<p>*<strong>returns</strong>*: `Matrix` object …\n"],["-","String","String.html#method-i-2D","(str)","<p>Subtracts the substring to the main\n<p>*<strong>argument</strong>*: substring\n<p>*<strong>returns</strong>*: new string\n"],["/","Matrix","Matrix.html#method-i-2F","(obj)","<p>Divides each element of the current matrix to a `Numeric` value\n<p>*<strong>argument</strong>*: `Numeric`\n<p>*<strong>returns</strong>*: `Matrix` …\n"],["==","Matrix","Matrix.html#method-i-3D-3D","(obj)","<p>Compares the current matrix with another object\n<p>*<strong>argument</strong>*: `Object` to be compared with\n<p>*<strong>returns</strong>*: <code>true</code> …\n"],["L","LU","LU.html#method-c-L","()","<p>Returns the `L` matrix\n"],["U","LU","LU.html#method-c-U","()","<p>Returns the `U` matrix\n"],["[]","Matrix","Matrix.html#method-i-5B-5D","(x,y)","<p>Gives access to each component of a matrix. It accepts two kinds of\narguments: `Fixnum` or `Range` to …\n"],["[]=","Matrix","Matrix.html#method-i-5B-5D-3D","(i,j,val)","<p>Allows direct overwriting of a component\n<p>*<strong>argument</strong>*: `Fixnum` of row number\n<p>*<strong>argument</strong>*: `Fixnum` of column …\n"],["analyze","Sizer","Sizer.html#method-i-analyze","(string, equal = true)","<p>Analyzes the stream of tokens to check the sintax. It uses a turing machine\nto find errors.\n<p>*<strong>argument</strong> …\n"],["attribute","Token","Token.html#method-i-attribute","()","<p>*<strong>returns</strong>*: token attribute\n\n"],["balanced_brackets?","Function","Function.html#method-i-balanced_brackets-3F","(expr)","<p>Checks if the brackets are balanced in the input function\n<p>*<strong>argument</strong>*: array of the function components …\n"],["balanced_brackets?","Sizer","Sizer.html#method-i-balanced_brackets-3F","(exp)","<p>checks if the input expression has balanced brackets\n<p>*<strong>argument</strong>*: expression (string) to check\n<p>*<strong>returns</strong> …\n"],["boole","Integrators","Integrators.html#method-c-boole","(a,b,n)","<p>Implementation of Boole's method\n<p>*<strong>argument</strong>*: left range value\n<p>*<strong>argument</strong>*: right range value\n"],["can_divide?","Fixnum","Fixnum.html#method-i-can_divide-3F","(obj)","<p>Checks if the fixnum value can be divided by a given object\n<p>*<strong>argument</strong>*: object for the checking\n<p>*<strong>returns</strong> …\n"],["can_divide?","Float","Float.html#method-i-can_divide-3F","(obj)","<p>Checks if the float value can be divided by a given object\n<p>*<strong>argument</strong>*: object for the checking\n<p>*<strong>returns</strong> …\n"],["can_divide?","Matrix","Matrix.html#method-i-can_divide-3F","(obj)","<p>Checks if the given object can divide the current matrix\n<p>*<strong>argument</strong>*: `Object`\n<p>*<strong>returns</strong>*: <code>true</code> if `obj` …\n"],["can_divide?","Numeric","Numeric.html#method-i-can_divide-3F","(obj)","<p>Checks if the numeric value can be divided by a given object\n<p>*<strong>argument</strong>*: object for the checking\n<p>*<strong>returns</strong> …\n"],["can_multiply?","Fixnum","Fixnum.html#method-i-can_multiply-3F","(obj)","<p>Checks if the fixnum value can be multiplied by a given object\n<p>*<strong>argument</strong>*: object for the checking\n<p>*<strong>returns</strong> …\n"],["can_multiply?","Float","Float.html#method-i-can_multiply-3F","(obj)","<p>Checks if the float value can be multiplied by a given object\n<p>*<strong>argument</strong>*: object for the checking\n<p>*<strong>returns</strong> …\n"],["can_multiply?","Matrix","Matrix.html#method-i-can_multiply-3F","(obj)","<p>Checks if the given object can be multiplied to the matrix\n<p>*<strong>argument</strong>*: `Object`\n<p>*<strong>returns</strong>*: <code>true</code>+ if `obj` …\n"],["can_multiply?","Numeric","Numeric.html#method-i-can_multiply-3F","(obj)","<p>Checks if the numeric value can be multiplied by a given object\n<p>*<strong>argument</strong>*: object for the checking\n<p>*<strong>returns</strong> …\n"],["check_block","Sizer","Sizer.html#method-i-check_block","(token)","<p>Checks the sintax of a block, that is: QUOTES-STRING-QUOTES\n<p>*<strong>argument</strong>*: stream of tokens\n<p>*<strong>returns</strong>*: <code>true</code> …\n"],["clear_line","Listener","Listener.html#method-i-clear_line","()","<p>Clears the current line (deletes the typed input)\n"],["coerce","Matrix","Matrix.html#method-i-coerce","(val)",""],["collect_single_key","Listener","Listener.html#method-i-collect_single_key","()","<p>according to the collected key decides what to do: moving the cursor,\nsurfing the history, or simply …\n"],["compact","String","String.html#method-i-compact","()","<p>Deletes spaces from a string\n<p>*<strong>returns</strong>*: new string\n\n"],["contain?","String","String.html#method-i-contain-3F","(str)","<p>Checks if the string contains at least a character of the given one.\n<p>*<strong>argument</strong>*: string for the checking …\n"],["contain_all?","String","String.html#method-i-contain_all-3F","(str)","<p>Checks if the string contains all the characters of the given one.\n<p>*<strong>argument</strong>*: string for the checking …\n"],["convert","Function","Function.html#method-i-convert","(str)","<p>Converts the function inerted by the user in a function written in Ruby\nlanguage\n<p>*<strong>argument</strong>*: input function …\n"],["count","Scp","Scp.html#method-i-count","()","<p>Returns the current value of the counter\n"],["count","Sizer","Sizer.html#method-i-count","()",""],["current_tk","Calculator::Evaluator","Calculator/Evaluator.html#method-i-current_tk","()","<p>*<strong>returns</strong>*: token of the current pointer value\n\n"],["cursor_to","Listener","Listener.html#method-i-cursor_to","(pos)","<p>Moves the cursor backward of the number of specified position\n<p>*<strong>argument</strong>*: number of position the cursor …\n\n"],["default","PrintError","PrintError.html#method-c-default","(token,expression)","<p>*<strong>argument</strong>*: unexpected Token\n<p>*<strong>argument</strong>*: expression (commands) where the error has been\nfound\n\n"],["del_rwcl","Matrix","Matrix.html#method-i-del_rwcl","(mx,rw,cl)","<p>Private method to delete rows and columns from a matrix\n<p>*<strong>argument</strong>*: `Matrix`\n<p>*<strong>argument</strong>*: row number (`Fixnum`) …\n"],["discard","Scp","Scp.html#method-i-discard","(expr)","<p>Extracts the content between quotes\n<p>*<strong>argument</strong>*: string to extract the content from\n<p>*<strong>returns</strong>*: content (substring) …\n"],["dx","Dim","Dim.html#method-i-dx","()","<p>*<strong>returns</strong>*: right dimension value\n\n"],["evaluate","Calculator::Evaluator","Calculator/Evaluator.html#method-i-evaluate","(stream)","<p>Evaluates the global expression\n<p>*<strong>argument</strong>*: stream of tokens (Array)\n<p>*<strong>returns</strong>*: result of the operations; …\n"],["export","Matrix","Matrix.html#method-i-export","()","<p>*<strong>returns</strong>*: `Array` on which the matrix is saved\n\n"],["extract","Parser","Parser.html#method-i-extract","(expr)","<p>Extracts the content between quotes (it must not be parsed)\n<p>*<strong>argument</strong>*: string to extract the sub-string …\n"],["extract","Scp","Scp.html#method-i-extract","(expr)","<p>Extracts the subexpression between brackets\n<p>*<strong>argument</strong>*: string to extract the sub expression from\n<p>*<strong>returns</strong> …\n"],["extract_gen_exp","Lexer","Lexer.html#method-i-extract_gen_exp","(string)","<p>Reads all the content between quotes so that it can be classified as string\n<p>*<strong>argument</strong>*: string to extract …\n"],["f","Tool","Tool.html#method-c-f","()","<p>*<strong>returns</strong>*: array of the supported math functions; see:\nFunction\n"],["factorize","LU","LU.html#method-c-factorize","(mx,sol)","<p>Performs LU factorization calculating L and U matrices\n<p>*<strong>argument</strong>*: squared matrix to factorize\n<p>*<strong>argument</strong> …\n"],["float?","String","String.html#method-i-float-3F","()","<p>Checks if the strings represents a `Float` value\n<p>*<strong>returns</strong>*: <code>true</code> if the string represents a\n`Float`; …\n\n"],["from_file","Matrix","Matrix.html#method-c-from_file","(filename = \"\")","<p>Creates a new matrix loading it from a .csv file\n<p>*<strong>argument</strong>*: `String` of the file path\n<p>*<strong>returns</strong>*: new matrix …\n"],["getCls","Matrix","Matrix.html#method-i-getCls","()","<p>*<strong>returns</strong>*: `Fixnum` of number of columns\n\n"],["getRws","Matrix","Matrix.html#method-i-getRws","()","<p>*<strong>returns</strong>*: `Fixnum` of number of rows\n\n"],["gets","Listener","Listener.html#method-i-gets","()","<p>main function that can be used. It returns the stream the user wrote on the\ncommand line after they pressed …\n"],["identity","Matrix","Matrix.html#method-c-identity","(n)","<p>Builds an identity matrix\n<p>*<strong>argument</strong>*: `Fixnum` of the matrix dimension\n<p>*<strong>returns</strong>*: `Matrix` object\n"],["insert_b","Scp","Scp.html#method-i-insert_b","(expr)","<p>Inserts a couple of brackets `()` before non-binary sum and diff. operators\n<p>*<strong>argument</strong>*: string to be checked …\n"],["integer?","String","String.html#method-i-integer-3F","()","<p>Checks if the strings represents a `Fixnum` value\n<p>*<strong>returns</strong>*: <code>true</code> if the string represents a\n`Fixnum`; …\n\n"],["integrate","Function","Function.html#method-i-integrate","(r,n,m = 'simpson')","<p>Integrates the function according to the specified method (see:\nIntegrators)\n<p>*<strong>argument</strong>*: dimension of …\n"],["is_a?","Filename","Filename.html#method-i-is_a-3F","(obj)","<p>*<strong>argument</strong>*: class name\n<p>*<strong>returns</strong>*: <code>true</code> if `self.class` = `obj`;\n<code>false</code> else\n\n"],["is_exp?","Tool","Tool.html#method-c-is_exp-3F","(str)","<p>Dummy function to ckeck if a string represents an expression (may not work\nproperly)\n<p>*<strong>argument</strong>*: string …\n"],["is_keyword?","Tool","Tool.html#method-c-is_keyword-3F","(ob)","<p>Checks if a string represents a keyword\n<p>*<strong>argument</strong>*: object to check\n<p>*<strong>returns</strong>*: <code>true</code> if `ob` represents …\n"],["is_similar?","Numeric","Numeric.html#method-i-is_similar-3F","(obj)","<p>Compares the value with another object\n<p>*<strong>argument</strong>*: object for the comparison\n<p>*<strong>returns</strong>*: <code>true</code> if the object …\n"],["is_squared?","Matrix","Matrix.html#method-i-is_squared-3F","()","<p>Checks if the matrix is squared\n<p>*<strong>returns</strong>*: <code>true</code> if the matrix is squared;\n<code>false</code> else\n\n"],["keys","Tool","Tool.html#method-c-keys","()","<p>*<strong>returns</strong>*: array of all the keywords used by linmeric\n\n"],["laplace","Matrix","Matrix.html#method-i-laplace","()","<p>Calulates the determinant of the matrix using the Laplace's algorithm\n<p>*<strong>returns</strong>*: `Numeric` value\n\n"],["letters","Tool","Tool.html#method-c-letters","()","<p>*<strong>returns</strong>*: alphabet in string format\n\n"],["make_op","Calculator::Evaluator","Calculator/Evaluator.html#method-i-make_op","()","<p>Solves the operations saved in @op\n"],["me","Token","Token.html#method-i-me","()","<p>*<strong>returns</strong>*: token value\n\n"],["midpoint","Integrators","Integrators.html#method-c-midpoint","(a,b,n)","<p>Implementation of midpoint method\n<p>*<strong>argument</strong>*: left range value\n<p>*<strong>argument</strong>*: right range value\n"],["missing","PrintError","PrintError.html#method-c-missing","(token,expression)","<p>*<strong>argument</strong>*: Token arguments are missing for\n<p>*<strong>argument</strong>*: expression (commands) where the error has been\n…\n\n"],["missing_expression_after_equal","PrintError","PrintError.html#method-c-missing_expression_after_equal","(pos,expression)","<p>*<strong>argument</strong>*: position where the error is located\n<p>*<strong>argument</strong>*: expression (commands) where the error has …\n\n"],["missing_general_string","PrintError","PrintError.html#method-c-missing_general_string","(position,expression)","<p>*<strong>argument</strong>*: position where the error is located\n<p>*<strong>argument</strong>*: expression (commands) where the error has …\n\n"],["missing_integ_range","PrintError","PrintError.html#method-c-missing_integ_range","(pos,expression)","<p>*<strong>argument</strong>*: position where the error is located\n<p>*<strong>argument</strong>*: expression (commands) where the error has …\n\n"],["missmatch","PrintError","PrintError.html#method-c-missmatch","(token,expression,expectation)","<p>*<strong>argument</strong>*: missmatched Token found\n<p>*<strong>argument</strong>*: expression (commands) where the error has been\nfound\n<p>* …\n"],["name","Filename","Filename.html#method-i-name","()","<p>*<strong>returns</strong>*: name of the file (`String`)\n\n"],["new","Archive","Archive.html#method-c-new","()","<p>Creates a new Archive objects\n"],["new","Calculator::Token","Calculator/Token.html#method-c-new","(value)","<p>*<strong>argument</strong>*: value to tokenize (String)\n\n"],["new","Dim","Dim.html#method-c-new","(str)","<p>*<strong>argument</strong>*: string to be converted to a dimension\n\n"],["new","Function","Function.html#method-c-new","(str)","<p>Creates a new `Function` object\n<p>*<strong>argument</strong>*: string to be converted (and representing a\nfunction)\n\n"],["new","Listener","Listener.html#method-c-new","()","<p>Creates the main variables\n"],["new","Matrix","Matrix.html#method-c-new","(rws = 0,cls = 0)","<p>Initialization of new matrix in two different ways (chosen by the user):\n<p>a block can be given to create …\n"],["new","Parser","Parser.html#method-c-new","()","<p>Initialize two new variables: a counter and a boolean one to report errors\nand stop the parser\n"],["new","Scp","Scp.html#method-c-new","()","<p>Initializes a new counter\n"],["new","Sizer","Sizer.html#method-c-new","()","<p>Builds a new lexer\n"],["new","Token","Token.html#method-c-new","(to_token,pos,sugg = \"\")","<p>Creates a new token object\n<p>*<strong>argument</strong>*: token value to name\n<p>*<strong>argument</strong>*: token position\n"],["next_","Archive","Archive.html#method-i-next_","()","<p>Returns the next item compared to the pointer position\n<p>*<strong>returns</strong>*: saved object; “” if the pointer …\n\n"],["no_final_quotes","PrintError","PrintError.html#method-c-no_final_quotes","(expression,position)","<p>*<strong>argument</strong>*: expression (commands) where the error has been\nfound\n<p>*<strong>argument</strong>*: position where the error …\n\n"],["norm","Matrix","Matrix.html#method-i-norm","()","<p>Calculates the norm of a matrix, defined as sqrt(sum(m**2))\n<p>*<strong>returns</strong>*: `Float` value\n\n"],["numPoint_missing","PrintError","PrintError.html#method-c-numPoint_missing","(position,expression)","<p>*<strong>argument</strong>*: position where the error is located\n<p>*<strong>argument</strong>*: expression (commands) where the error has …\n\n"],["number?","String","String.html#method-i-number-3F","()","<p>Checks if the string represents a number\n<p>*<strong>returns</strong>: <code>true</code> if the string represents a\nnumber; <code>false</code> else …\n\n"],["ok?","Function","Function.html#method-i-ok-3F","()","<p>Tells whether the function has been correctly converted from the string\nformat\n<p>*<strong>returns</strong>*: <code>true</code> if the …\n\n"],["operators","Tool","Tool.html#method-c-operators","()","<p>*<strong>returns</strong>*: array of all the operators\n\n"],["parse","Calculator::Evaluator","Calculator/Evaluator.html#method-i-parse","(m_end = nil)","<p>It parses the stream of tokens\n<p>*<strong>argument</strong>*: specific end-token (<code>nil</code> default)\n<p>*<strong>returns</strong>*: result of the operations; …\n"],["parse","Parser","Parser.html#method-i-parse","(expr)","<p>Main function that parses the string\n<p>*<strong>argument</strong>*: string to be parsed; the string must be the\n\n<p>output of …\n"],["position","Token","Token.html#method-i-position","()","<p>*<strong>returns</strong>*: token position\n\n"],["previous","Archive","Archive.html#method-i-previous","()","<p>Returns the previous item compared to the pointer position\n<p>*<strong>returns</strong>*: saved object; “” if the …\n\n"],["print","PrintError","PrintError.html#method-c-print","(message,expression,pos)","<p>Main function that prints the error message\n<p>*<strong>argument</strong>*: message to be printed (string)\n<p>*<strong>argument</strong>*: expression …\n"],["print_stack","Tool","Tool.html#method-c-print_stack","(stack)","<p>Prints the hash of the variables\n<p>*<strong>argument</strong>*: hash to be printed\n\n"],["priority","Calculator::Evaluator","Calculator/Evaluator.html#method-i-priority","(op)","<p>Returns the operator priority\n<p>*<strong>argument</strong>*: operator (string)\n<p>*<strong>returns</strong>*: priority (fixnum)\n"],["read_char","Listener","Listener.html#method-i-read_char","()","<p>Reads a single char from the command line\n"],["reduced","PrintError","PrintError.html#method-c-reduced","(token,expression)","<p>*<strong>argument</strong>*: unexpected Token\n<p>*<strong>argument</strong>*: expression (commands) where the error has been\nfound\n\n"],["remove","String","String.html#method-i-remove","(index)","<p>Removes a character at the given index\n<p>*<strong>argument</strong>*: index of the character (`Fixnum`)\n<p>*<strong>returns</strong>*: new string …\n"],["reset","LU","LU.html#method-c-reset","()","<p>Sets to nil @L and @U variables\n"],["reset","Listener","Listener.html#method-i-reset","()","<p>reinitializates three main variables\n"],["reset","Parser","Parser.html#method-i-reset","()","<p>Re initializes the counter and the boolean variable\n"],["rettdx","Integrators","Integrators.html#method-c-rettdx","(a,b,n)","<p>Implementation of right rectangles method\n<p>*<strong>argument</strong>*: left range value\n<p>*<strong>argument</strong>*: right range value\n"],["rettsx","Integrators","Integrators.html#method-c-rettsx","(a,b,n)","<p>Implementation of left rectangles method\n<p>*<strong>argument</strong>*: left range value\n<p>*<strong>argument</strong>*: right range value\n"],["scopify","Scp","Scp.html#method-i-scopify","(expr)","<p>Main function that analyzes the string and puts the brackets where it is\nnecessary.\n<p>*<strong>argument</strong>*: string …\n"],["similar_to?","Fixnum","Fixnum.html#method-i-similar_to-3F","(obj)","<p>Compares the value with another object\n<p>*<strong>argument</strong>*: object for the comparison\n<p>*<strong>returns</strong>*: <code>true</code> if the object …\n"],["similar_to?","Float","Float.html#method-i-similar_to-3F","(obj)","<p>Compares the value with another object\n<p>*<strong>argument</strong>*: object for the comparison\n<p>*<strong>returns</strong>*: <code>true</code> if the object …\n"],["similar_to?","Matrix","Matrix.html#method-i-similar_to-3F","(obj)","<p>Checks if this matrix and the given object have the same features\n<p>*<strong>argument</strong>*: `Object`\n<p>*<strong>returns</strong>*: <code>true</code> …\n"],["simpson","Integrators","Integrators.html#method-c-simpson","(a,b,n)","<p>Implementation of Simpson's method\n<p>*<strong>argument</strong>*: left range value\n<p>*<strong>argument</strong>*: right range value\n"],["size","NilClass","NilClass.html#method-i-size","()","<p>*<strong>returns</strong>*: 0\n\n"],["solve","Calculator","Calculator.html#method-c-solve","(exp)","<p>It solves the expression in string format\n<p>*<strong>argument</strong>*: expression to evaluate\n<p>*<strong>returns</strong>*: result of the expression; …\n"],["solve","LU","LU.html#method-c-solve","(sol)","<p>Finds the solutions of the linear system\n<p>*<strong>argument</strong>*: n x 1 matrix of known values of the linear\nsystem …\n"],["state0_1","Calculator::Evaluator","Calculator/Evaluator.html#method-i-state0_1","(state = 1)","<p>State0_1 accepts only numbers or '('\n<p>*<strong>argument</strong>*: specification of which state must be runned (1\n…\n"],["state2","Calculator::Evaluator","Calculator/Evaluator.html#method-i-state2","()","<p>State2 accepts only operators\n<p>*<strong>returns</strong>*: next state (symbol)\n\n"],["store","Archive","Archive.html#method-i-store","(str)","<p>Adds a new item to the archive (it keeps the last 20 items which have been\ninserted).\n<p>*<strong>argument</strong>*: item …\n\n"],["swap","LU","LU.html#method-c-swap","(mx,r1,r2)","<p>Swaps two rows of a matrix (pivoting)\n<p>*<strong>argument</strong>*: matrix the rows must be swapped on\n<p>*<strong>argument</strong>*: first …\n"],["sx","Dim","Dim.html#method-i-sx","()","<p>*<strong>returns</strong>*: left dimension value\n\n"],["tag","Calculator::Token","Calculator/Token.html#method-i-tag","()","<p>*<strong>returns</strong>*: tag of the token\n\n"],["to_block","Function","Function.html#method-i-to_block","(n = 0)","<p>Returns the function as a ruby block ({ |…| … })\n<p>*<strong>argument</strong>*: number of variables needed for the block; …\n"],["to_file","Matrix","Matrix.html#method-i-to_file","(filename = \"\")","<p>Writes the matrix on a file\n<p>*<strong>argument</strong>*: `String` of the file path\n\n"],["to_n","String","String.html#method-i-to_n","()","<p>Converts a string to a number\n<p>*<strong>returns</strong>*: `Float` value if the string represents a float\n\n<p>`Fixnum` value …\n"],["to_s","Filename","Filename.html#method-i-to_s","()",""],["to_s","Function","Function.html#method-i-to_s","()","<p>*<strong>returns</strong>*: string representation of the function\n\n"],["to_s","Matrix","Matrix.html#method-i-to_s","()","<p>converts this matrix object to a string\n"],["to_s","NilClass","NilClass.html#method-i-to_s","()","<p>*<strong>returns</strong>*: string representation of <code>nil</code>\n\n"],["tokenize","Calculator::Lexer","Calculator/Lexer.html#method-i-tokenize","(string)","<p>It creates the tokens according to `OP` or '(' and ')'\n<p>*<strong>argument</strong>*: the string that needs …\n"],["tokenize","Function","Function.html#method-i-tokenize","(str)","<p>Splits the input string into its components (variables,operators…)\n<p>*<strong>argument</strong>*: input function in string …\n"],["tokenize","Lexer","Lexer.html#method-i-tokenize","(expr)","<p>Tokenizes the input stream according to particular tokenizer symbols which\ndetermine the end of an element.Eg …\n"],["top","Archive","Archive.html#method-i-top","()","<p>Moves the pointer to the top of the archive (the last element inserted)\n"],["tr","Matrix","Matrix.html#method-i-tr","()","<p>Trasposes a matrix\n<p>*<strong>returns</strong>*: `Matrix` object\n"],["translate","Function","Function.html#method-i-translate","(str,open_b = false)","<p>Translates the function from linmeric language to Ruby language using a\nturing machine to detect possible …\n"],["trapezi","Integrators","Integrators.html#method-c-trapezi","(a,b,n)","<p>Implementation of trapezes method\n<p>*<strong>argument</strong>*: left range value\n<p>*<strong>argument</strong>*: right range value\n"],["unexpected_token_in_solve","PrintError","PrintError.html#method-c-unexpected_token_in_solve","(token,expression)","<p>*<strong>argument</strong>*: unexpected Token found\n<p>*<strong>argument</strong>*: expression (commands) where the error has been\nfound\n\n"],["unknown","PrintError","PrintError.html#method-c-unknown","(token,expression)","<p>*<strong>argument</strong>*: unknown Token found\n<p>*<strong>argument</strong>*: expression (commands) where the error has been\nfound\n\n"],["update","Matrix","Matrix.html#method-i-update","(mat,rws,cls)","<p>Updates this matrix after the array in which it was saved has been manually\nmodified\n<p>*<strong>argument</strong>*: `Array` …\n"],["value","Calculator::Token","Calculator/Token.html#method-i-value","()","<p>*<strong>returns</strong>*: value of the token\n\n"],["vars","Function","Function.html#method-i-vars","(n = 0)","<p>Builds the list of the variables needed for the block\n<p>*<strong>argument</strong>*: number of variables needed for the block …\n"],["README","","README_md.html","","<p>Linmeric\n<p>This simple numeric calulator provides an easy command line user interface\nto make operations …\n"]]}}
|
|
Binary file
|
data/doc/js/searcher.js
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
Searcher = function(data) {
|
|
2
|
+
this.data = data;
|
|
3
|
+
this.handlers = [];
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
Searcher.prototype = new function() {
|
|
7
|
+
// search is performed in chunks of 1000 for non-blocking user input
|
|
8
|
+
var CHUNK_SIZE = 1000;
|
|
9
|
+
// do not try to find more than 100 results
|
|
10
|
+
var MAX_RESULTS = 100;
|
|
11
|
+
var huid = 1;
|
|
12
|
+
var suid = 1;
|
|
13
|
+
var runs = 0;
|
|
14
|
+
|
|
15
|
+
this.find = function(query) {
|
|
16
|
+
var queries = splitQuery(query);
|
|
17
|
+
var regexps = buildRegexps(queries);
|
|
18
|
+
var highlighters = buildHilighters(queries);
|
|
19
|
+
var state = { from: 0, pass: 0, limit: MAX_RESULTS, n: suid++};
|
|
20
|
+
var _this = this;
|
|
21
|
+
|
|
22
|
+
this.currentSuid = state.n;
|
|
23
|
+
|
|
24
|
+
if (!query) return;
|
|
25
|
+
|
|
26
|
+
var run = function() {
|
|
27
|
+
// stop current search thread if new search started
|
|
28
|
+
if (state.n != _this.currentSuid) return;
|
|
29
|
+
|
|
30
|
+
var results =
|
|
31
|
+
performSearch(_this.data, regexps, queries, highlighters, state);
|
|
32
|
+
var hasMore = (state.limit > 0 && state.pass < 4);
|
|
33
|
+
|
|
34
|
+
triggerResults.call(_this, results, !hasMore);
|
|
35
|
+
if (hasMore) {
|
|
36
|
+
setTimeout(run, 2);
|
|
37
|
+
}
|
|
38
|
+
runs++;
|
|
39
|
+
};
|
|
40
|
+
runs = 0;
|
|
41
|
+
|
|
42
|
+
// start search thread
|
|
43
|
+
run();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* ----- Events ------ */
|
|
47
|
+
this.ready = function(fn) {
|
|
48
|
+
fn.huid = huid;
|
|
49
|
+
this.handlers.push(fn);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* ----- Utilities ------ */
|
|
53
|
+
function splitQuery(query) {
|
|
54
|
+
return jQuery.grep(query.split(/(\s+|::?|\(\)?)/), function(string) {
|
|
55
|
+
return string.match(/\S/)
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function buildRegexps(queries) {
|
|
60
|
+
return jQuery.map(queries, function(query) {
|
|
61
|
+
return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i')
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function buildHilighters(queries) {
|
|
66
|
+
return jQuery.map(queries, function(query) {
|
|
67
|
+
return jQuery.map(query.split(''), function(l, i) {
|
|
68
|
+
return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2);
|
|
69
|
+
}).join('');
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// function longMatchRegexp(index, longIndex, regexps) {
|
|
74
|
+
// for (var i = regexps.length - 1; i >= 0; i--){
|
|
75
|
+
// if (!index.match(regexps[i]) && !longIndex.match(regexps[i])) return false;
|
|
76
|
+
// };
|
|
77
|
+
// return true;
|
|
78
|
+
// }
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
/* ----- Mathchers ------ */
|
|
82
|
+
|
|
83
|
+
/*
|
|
84
|
+
* This record matches if the index starts with queries[0] and the record
|
|
85
|
+
* matches all of the regexps
|
|
86
|
+
*/
|
|
87
|
+
function matchPassBeginning(index, longIndex, queries, regexps) {
|
|
88
|
+
if (index.indexOf(queries[0]) != 0) return false;
|
|
89
|
+
for (var i=1, l = regexps.length; i < l; i++) {
|
|
90
|
+
if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
|
|
91
|
+
return false;
|
|
92
|
+
};
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/*
|
|
97
|
+
* This record matches if the longIndex starts with queries[0] and the
|
|
98
|
+
* longIndex matches all of the regexps
|
|
99
|
+
*/
|
|
100
|
+
function matchPassLongIndex(index, longIndex, queries, regexps) {
|
|
101
|
+
if (longIndex.indexOf(queries[0]) != 0) return false;
|
|
102
|
+
for (var i=1, l = regexps.length; i < l; i++) {
|
|
103
|
+
if (!longIndex.match(regexps[i]))
|
|
104
|
+
return false;
|
|
105
|
+
};
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/*
|
|
110
|
+
* This record matches if the index contains queries[0] and the record
|
|
111
|
+
* matches all of the regexps
|
|
112
|
+
*/
|
|
113
|
+
function matchPassContains(index, longIndex, queries, regexps) {
|
|
114
|
+
if (index.indexOf(queries[0]) == -1) return false;
|
|
115
|
+
for (var i=1, l = regexps.length; i < l; i++) {
|
|
116
|
+
if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
|
|
117
|
+
return false;
|
|
118
|
+
};
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/*
|
|
123
|
+
* This record matches if regexps[0] matches the index and the record
|
|
124
|
+
* matches all of the regexps
|
|
125
|
+
*/
|
|
126
|
+
function matchPassRegexp(index, longIndex, queries, regexps) {
|
|
127
|
+
if (!index.match(regexps[0])) return false;
|
|
128
|
+
for (var i=1, l = regexps.length; i < l; i++) {
|
|
129
|
+
if (!index.match(regexps[i]) && !longIndex.match(regexps[i]))
|
|
130
|
+
return false;
|
|
131
|
+
};
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
/* ----- Highlighters ------ */
|
|
137
|
+
function highlightRegexp(info, queries, regexps, highlighters) {
|
|
138
|
+
var result = createResult(info);
|
|
139
|
+
for (var i=0, l = regexps.length; i < l; i++) {
|
|
140
|
+
result.title = result.title.replace(regexps[i], highlighters[i]);
|
|
141
|
+
result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
|
|
142
|
+
};
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function hltSubstring(string, pos, length) {
|
|
147
|
+
return string.substring(0, pos) + '\u0001' + string.substring(pos, pos + length) + '\u0002' + string.substring(pos + length);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function highlightQuery(info, queries, regexps, highlighters) {
|
|
151
|
+
var result = createResult(info);
|
|
152
|
+
var pos = 0;
|
|
153
|
+
var lcTitle = result.title.toLowerCase();
|
|
154
|
+
|
|
155
|
+
pos = lcTitle.indexOf(queries[0]);
|
|
156
|
+
if (pos != -1) {
|
|
157
|
+
result.title = hltSubstring(result.title, pos, queries[0].length);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
result.namespace = result.namespace.replace(regexps[0], highlighters[0]);
|
|
161
|
+
for (var i=1, l = regexps.length; i < l; i++) {
|
|
162
|
+
result.title = result.title.replace(regexps[i], highlighters[i]);
|
|
163
|
+
result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
|
|
164
|
+
};
|
|
165
|
+
return result;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function createResult(info) {
|
|
169
|
+
var result = {};
|
|
170
|
+
result.title = info[0];
|
|
171
|
+
result.namespace = info[1];
|
|
172
|
+
result.path = info[2];
|
|
173
|
+
result.params = info[3];
|
|
174
|
+
result.snippet = info[4];
|
|
175
|
+
return result;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* ----- Searching ------ */
|
|
179
|
+
function performSearch(data, regexps, queries, highlighters, state) {
|
|
180
|
+
var searchIndex = data.searchIndex;
|
|
181
|
+
var longSearchIndex = data.longSearchIndex;
|
|
182
|
+
var info = data.info;
|
|
183
|
+
var result = [];
|
|
184
|
+
var i = state.from;
|
|
185
|
+
var l = searchIndex.length;
|
|
186
|
+
var togo = CHUNK_SIZE;
|
|
187
|
+
var matchFunc, hltFunc;
|
|
188
|
+
|
|
189
|
+
while (state.pass < 4 && state.limit > 0 && togo > 0) {
|
|
190
|
+
if (state.pass == 0) {
|
|
191
|
+
matchFunc = matchPassBeginning;
|
|
192
|
+
hltFunc = highlightQuery;
|
|
193
|
+
} else if (state.pass == 1) {
|
|
194
|
+
matchFunc = matchPassLongIndex;
|
|
195
|
+
hltFunc = highlightQuery;
|
|
196
|
+
} else if (state.pass == 2) {
|
|
197
|
+
matchFunc = matchPassContains;
|
|
198
|
+
hltFunc = highlightQuery;
|
|
199
|
+
} else if (state.pass == 3) {
|
|
200
|
+
matchFunc = matchPassRegexp;
|
|
201
|
+
hltFunc = highlightRegexp;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
for (; togo > 0 && i < l && state.limit > 0; i++, togo--) {
|
|
205
|
+
if (info[i].n == state.n) continue;
|
|
206
|
+
if (matchFunc(searchIndex[i], longSearchIndex[i], queries, regexps)) {
|
|
207
|
+
info[i].n = state.n;
|
|
208
|
+
result.push(hltFunc(info[i], queries, regexps, highlighters));
|
|
209
|
+
state.limit--;
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
if (searchIndex.length <= i) {
|
|
213
|
+
state.pass++;
|
|
214
|
+
i = state.from = 0;
|
|
215
|
+
} else {
|
|
216
|
+
state.from = i;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return result;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function triggerResults(results, isLast) {
|
|
223
|
+
jQuery.each(this.handlers, function(i, fn) {
|
|
224
|
+
fn.call(this, results, isLast)
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
Binary file
|