Skip to content

Commit 11f79aa

Browse files
committed
v0.2.2
* Performance Upgrades * Added BetaNode indexing * Abstracted out JoinNode to extend BetaNode (Prevents the checking of constraints if there are not any constraints to check) * Refactored BetaNetwork * Created a new Memory Class to encapusulate left and right memory for BetaNodes * Added new `exists` logic operator to check for existence of fact (opposite of `not`)
1 parent 86eea5e commit 11f79aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+13336
-8722
lines changed

docs-md/examples.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
* [Sudoku](./examples/browser/sudoku.html)
66
* [Fibonacci](./examples/browser/fibonacci.html)
77
* [Miss Manners](./examples/browser/manners.html)
8+
* [Waltz DB](./examples/browser/waltzDb.html)
9+
* [Send More Money](./examples/browser/sendMoreMoney.html)
810
* [Diagnosis](./examples/browser/diagnose.html)

docs/History.html

+11
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,17 @@
178178

179179

180180

181+
<h1>0.2.2</h1>
182+
<ul>
183+
<li>Performance Upgrades<ul>
184+
<li>Added BetaNode indexing</li>
185+
<li>Abstracted out JoinNode to extend BetaNode (Prevents the checking of constraints if there are not any constraints to check)</li>
186+
<li>Refactored BetaNetwork</li>
187+
<li>Created a new Memory Class to encapusulate left and right memory for BetaNodes</li>
188+
</ul>
189+
</li>
190+
<li>Added new <code>exists</code> logic operator to check for existence of fact (opposite of <code>not</code>)</li>
191+
</ul>
181192
<h1>0.2.1</h1>
182193
<ul>
183194
<li>Added support for js expression in the <code>from</code> node addressing issue <a href="https://github.com/C2FO/nools/issues/86">#86</a></li>

docs/examples.html

+2
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ <h2>Examples</h2>
185185
<li><a href="./examples/browser/sudoku.html">Sudoku</a></li>
186186
<li><a href="./examples/browser/fibonacci.html">Fibonacci</a></li>
187187
<li><a href="./examples/browser/manners.html">Miss Manners</a></li>
188+
<li><a href="./examples/browser/waltzDb.html">Waltz DB</a></li>
189+
<li><a href="./examples/browser/sendMoreMoney.html">Send More Money</a></li>
188190
<li><a href="./examples/browser/diagnose.html">Diagnosis</a></li>
189191
</ul>
190192

docs/examples/browser/assets/conways.css

+86-20
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,91 @@ body {
1616
height: 100%;
1717
}
1818

19-
#fibonacci div.inline {
19+
.fibonacci div.inline {
2020
height: 100%;
2121
margin: 10px;
2222
}
2323

24-
#fibonacci #results_container {
24+
.fibonacci .results_container {
2525
word-wrap: break-word;
2626
max-width: 100%;
2727
line-height: 50px;
2828
}
2929

30-
#diagnose {
31-
width: 500px;
32-
padding: 10px;
33-
border: 1px solid rgba(0, 0, 0, 0.1);
34-
-webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
35-
-moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
36-
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
30+
.diagnose {
31+
width: 100%;
3732
}
3833

39-
#manners {
40-
width: 50%;
34+
.diagnose .diagnose-container{
35+
width: 49%;
36+
vertical-align: top;
4137
padding: 10px;
42-
border: 1px solid rgba(0, 0, 0, 0.1);
43-
-webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
44-
-moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
45-
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
38+
}
4639

40+
.waltz-db,
41+
.manners {
42+
width: 100%;
4743
}
4844

49-
#manners #results_container {
45+
.waltz-db .editor-container,
46+
.manners .editor-container,
47+
.diagnose .editor-container,
48+
.send-more-money .editor-container {
49+
width: 49%;
50+
height: 100%;
51+
display: inline-block;
52+
}
53+
54+
.waltz-db .results_container,
55+
.manners .results_container {
56+
width: 49%;
57+
vertical-align: top;
58+
display: inline-block;
59+
height: 100%;
5060
overflow: auto;
51-
height: 400px;
52-
width: 95%;
5361
background: #dfdfdf;
5462
color: #09C;
5563
font-family: Tahoma, Geneva, sans-serif;
64+
padding-left: 10px;
65+
}
66+
67+
.editor-container {
68+
width: 100%;
69+
height: 400px;
70+
position: relative;
71+
border: 1px solid lightgray;
72+
}
73+
74+
.editor-container .editor {
75+
width: 100%;
76+
height: 100%;
77+
position: relative;
78+
}
79+
80+
.send-more-money {
81+
width: 100%;
82+
}
83+
84+
.send-more-money .equation-container {
85+
vertical-align: top;
86+
width: 49%;
87+
}
88+
89+
.send-more-money .equation {
90+
font-size: 6em;
91+
text-align: right;
92+
width: 400px;
93+
}
94+
95+
.send-more-money .equation > div > span {
96+
width: 30px;
97+
display: inline-block;
98+
height: 50px;
5699
padding: 10px;
57-
border-radius: 10px;
100+
}
101+
102+
.send-more-money .equation > div:last-child {
103+
border-top: solid black 1px;
58104
}
59105

60106
.container > header {
@@ -108,6 +154,12 @@ input[type="submit"], input[type="button"] {
108154
margin: 10px;
109155
}
110156

157+
input[type="submit"]:disabled,
158+
input[type="button"]:disabled {
159+
background-color: lightgray;
160+
cursor: not-allowed;
161+
}
162+
111163
#grid {
112164

113165
overflow: hidden;
@@ -136,6 +188,7 @@ input[type="submit"], input[type="button"] {
136188
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
137189
position: absolute;
138190
bottom: 5px;
191+
right: 5px;
139192
}
140193

141194
.row {
@@ -152,6 +205,10 @@ input[type="submit"], input[type="button"] {
152205
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
153206
}
154207

208+
.sudoku {
209+
width: 100%;
210+
}
211+
155212
.sudoku .col {
156213
width: 50px;
157214
height: 50px;
@@ -164,11 +221,20 @@ input[type="submit"], input[type="button"] {
164221
background-color: rgba(255, 0, 0, 0.43);
165222
}
166223

167-
.sudoku #grid{
224+
.sudoku #grid {
168225
width: 465px;
169226
height: 470px;
170227
}
171228

229+
.sudoku .grid-container {
230+
vertical-align: top;
231+
width: 49%;
232+
}
233+
234+
.sudoku .editor-container {
235+
width: 49%;
236+
}
237+
172238
.col.live {
173239
background-color: black;
174240
}

docs/examples/browser/diagnose.html

+56-70
Original file line numberDiff line numberDiff line change
@@ -11,56 +11,58 @@
1111
<body>
1212

1313

14-
<div id="diagnose" class="middle">
15-
<h1>Diagnose Me <input type="button" id="edit" value="Edit Rules"/></h1>
16-
17-
18-
<form action="#">
19-
<div class="errors"></div>
20-
<label for="name">Patient Name</label>
21-
<input type="text" id="name"/>
22-
<label for="fever">Fever</label>
23-
<select id="fever">
24-
<option value="">None</option>
25-
<option value="high">High</option>
26-
<option value="mild">Mild</option>
27-
</select>
28-
29-
<div>
30-
<label for="spots">Spots</label>
31-
<input type="checkbox" id="spots"/>
32-
</div>
33-
<div>
34-
<label for="rash">Rash</label>
35-
<input type="checkbox" id="rash"/>
36-
</div>
37-
<div>
38-
<label for="sore_throat">Sore Throat</label>
39-
<input type="checkbox" id="sore_throat"/>
40-
</div>
41-
<div>
42-
<label for="innoculated">Innoculated</label>
43-
<input type="checkbox" id="innoculated"/>
44-
</div>
45-
<input type="submit" value="Diagnose"/>
46-
</form>
47-
<hr/>
48-
<h2>Diagnoses</h2>
49-
50-
<div id="results_container"></div>
14+
<div class="diagnose middle">
15+
<div class="header">
16+
<h1>Diagnose Me</h1>
17+
</div>
18+
19+
<div class="editor-container">
20+
<div id="editor"></div>
21+
</div>
22+
23+
<div class="diagnose-container inline">
24+
<form action="#">
25+
<div class="errors"></div>
26+
<label for="name">Patient Name</label>
27+
<input type="text" id="name"/>
28+
<label for="fever">Fever</label>
29+
<select id="fever">
30+
<option value="">None</option>
31+
<option value="high">High</option>
32+
<option value="mild">Mild</option>
33+
</select>
34+
35+
<div>
36+
<label for="spots">Spots</label>
37+
<input type="checkbox" id="spots"/>
38+
</div>
39+
<div>
40+
<label for="rash">Rash</label>
41+
<input type="checkbox" id="rash"/>
42+
</div>
43+
<div>
44+
<label for="sore_throat">Sore Throat</label>
45+
<input type="checkbox" id="sore_throat"/>
46+
</div>
47+
<div>
48+
<label for="innoculated">Innoculated</label>
49+
<input type="checkbox" id="innoculated"/>
50+
</div>
51+
<input type="submit" value="Diagnose"/>
52+
</form>
53+
<hr/>
54+
<h2>Diagnoses</h2>
55+
56+
<div id="results_container"></div>
57+
</div>
5158

5259
</div>
5360

54-
<div id="editor-dialog">
55-
<div id="editor"></div>
56-
</div>
57-
5861
<script type="text/javascript" src="//code.jquery.com/jquery-1.10.1.min.js"></script>
59-
<script type="text/javascript" src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
60-
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/ace/0.2.0/ace.js"></script>
62+
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/ace/1.1.01/ace.js"></script>
63+
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/ace/1.1.01/mode-javascript.js"></script>
6164
<script type="text/javascript" src="../../nools.js"></script>
6265
<script type="text/javascript" src="./src/common.js"></script>
63-
<script type="text/javascript" src="./src/guests.js"></script>
6466
<script type="text/javascript">
6567

6668
$(document).ready(function () {
@@ -126,35 +128,19 @@ <h2>Diagnoses</h2>
126128
return false;
127129
});
128130

129-
$("#edit").on("click", function () {
130-
$("#editor-dialog").dialog("open");
131-
return false;
132-
});
131+
var height = $(document).height() - $("#manners .header").height() - 100;
132+
$(".editor-container").height(height);
133+
134+
var editor = ace.edit("editor");
135+
//editor.setTheme("ace/theme/monokai");
136+
var session = editor.getSession();
137+
session.setMode("ace/mode/javascript");
138+
session.setValue(res);
139+
editor.setReadOnly(true);
133140

134-
$("#editor-dialog").dialog({
135-
autoOpen: false,
136-
modal: true,
137-
width: window.innerWidth * 0.9,
138-
height: window.innerHeight * 0.9,
139-
open: function () {
140-
(editor = ace.edit("editor").getSession()).setValue(flowStr);
141-
},
142-
buttons: {
143-
"Save": function () {
144-
$(this).dialog("close");
145-
nools.deleteFlow("diagnosis");
146-
stop();
147-
flow = nools.compile((flowStr = editor.getValue()), {name: "diagnosis"});
148-
},
149-
Cancel: function () {
150-
$(this).dialog("close");
151-
}
152-
}
153-
});
154141

155142
});
156-
})
157-
;
143+
});
158144
</script>
159145

160146
</body>

docs/examples/browser/fibonacci.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</head>
1010
<body>
1111

12-
<div id="fibonacci" class="middle">
12+
<div class="fibonacci middle">
1313

1414
<h1>Fibonacci</h1>
1515

@@ -20,7 +20,7 @@ <h1>Fibonacci</h1>
2020
<div class="inline">
2121
<div class="large"><span>=</span></div>
2222
</div>
23-
<div class="inline large" id="results_container">
23+
<div class="inline large results_container">
2424
</div>
2525
</form>
2626
</div>
@@ -90,7 +90,7 @@ <h1>Fibonacci</h1>
9090
}
9191

9292

93-
var resultsContainer = $("#results_container"), valInput = $("#val");
93+
var resultsContainer = $(".results_container"), valInput = $("#val");
9494
$("#fibonacci_form").on('submit', function () {
9595
var num = parseInt(valInput.val(), 10);
9696
resultsContainer.text("Calculating...");

0 commit comments

Comments
 (0)