Permalink
Browse files

Merge pull request #91 from doug-martin/master

v0.2.2
  • Loading branch information...
2 parents 6625afd + 11f79aa commit 4b515accba130bbbcb04bfdc6967b5206ad8a292 @doug-martin doug-martin committed Nov 20, 2013
Showing with 13,336 additions and 8,722 deletions.
  1. +2 −0 docs-md/examples.md
  2. +11 −0 docs/History.html
  3. +2 −0 docs/examples.html
  4. +86 −20 docs/examples/browser/assets/conways.css
  5. +56 −70 docs/examples/browser/diagnose.html
  6. +3 −3 docs/examples/browser/fibonacci.html
  7. +35 −46 docs/examples/browser/manners.html
  8. +16 −0 docs/examples/browser/rules/sendMoreMoney.nools
  9. +106 −0 docs/examples/browser/sendMoreMoney.html
  10. +1 −1 docs/examples/browser/src/common.js
  11. +35 −23 docs/examples/browser/src/sudoku.js
  12. +26 −32 docs/examples/browser/sudoku.html
  13. +34 −44 docs/examples/browser/waltzDb.html
  14. +31 −1 docs/index.html
  15. +9 −8 docs/nools.js
  16. +86 −20 examples/browser/assets/conways.css
  17. +56 −70 examples/browser/diagnose.html
  18. +3 −3 examples/browser/fibonacci.html
  19. +35 −46 examples/browser/manners.html
  20. +16 −0 examples/browser/rules/sendMoreMoney.nools
  21. +106 −0 examples/browser/sendMoreMoney.html
  22. +1 −1 examples/browser/src/common.js
  23. +35 −23 examples/browser/src/sudoku.js
  24. +26 −32 examples/browser/sudoku.html
  25. +34 −44 examples/browser/waltzDb.html
  26. +9 −0 history.md
  27. +0 −1 lib/agenda.js
  28. +2 −1 lib/conflict.js
  29. +50 −15 lib/constraint.js
  30. +83 −19 lib/constraintMatcher.js
  31. +13 −1 lib/context.js
  32. +97 −1 lib/extended.js
  33. +27 −0 lib/linkedList.js
  34. +35 −0 lib/nodes/adapterNode.js
  35. +234 −0 lib/nodes/betaNode.js
  36. +3 −17 lib/nodes/equalityNode.js
  37. +99 −0 lib/nodes/existsFromNode.js
  38. +173 −0 lib/nodes/existsNode.js
  39. +5 −8 lib/nodes/fromNode.js
  40. +6 −12 lib/nodes/fromNotNode.js
  41. +24 −10 lib/nodes/index.js
  42. +16 −243 lib/nodes/joinNode.js
  43. +40 −75 lib/nodes/joinReferenceNode.js
  44. +1 −1 lib/nodes/leftAdapterNode.js
  45. +12 −0 lib/nodes/misc/leftMemory.js
  46. +219 −0 lib/nodes/misc/memory.js
  47. +12 −0 lib/nodes/misc/rightMemory.js
  48. +5 −7 lib/nodes/node.js
  49. +102 −115 lib/nodes/notNode.js
  50. +1 −1 lib/nodes/rightAdapterNode.js
  51. +1 −7 lib/nodes/terminalNode.js
  52. +2 −1 lib/nodes/typeNode.js
  53. +8 −6 lib/parser/nools/tokens.js
  54. +3 −1 lib/pattern.js
  55. +29 −1 lib/rule.js
  56. +8,908 −6,001 nools.js
  57. +9 −8 nools.min.js
  58. +2 −2 package.json
  59. +45 −0 readme.md
  60. +1 −1 test/browserling.js
  61. +65 −8 test/constraintMatcher.test.js
  62. +1 −3 test/flow.dsl.test.js
  63. +0 −1,667 test/flow.test.js
  64. +158 −0 test/flow/agendaGroups.test.js
  65. +45 −0 test/flow/async.test.js
  66. +77 −0 test/flow/events.test.js
  67. +291 −0 test/flow/exists.test.js
  68. +565 −0 test/flow/from.test.js
  69. +14 −0 test/flow/index.js
  70. +131 −0 test/flow/leftMemory.test.js
  71. +65 −0 test/flow/matchUntil.halt.js
  72. +185 −0 test/flow/not.test.js
  73. +176 −0 test/flow/or.test.js
  74. +130 −0 test/flow/rightMemory.test.js
  75. +49 −0 test/flow/rule.test.js
  76. +59 −0 test/flow/salience.test.js
  77. +49 −0 test/flow/scope.test.js
  78. +29 −0 test/flow/simple.test.js
  79. +67 −0 test/nools.test.js
  80. +20 −0 test/noolsParser.test.js
  81. +33 −2 test/rules.test.js
View
@@ -5,4 +5,6 @@
* [Sudoku](./examples/browser/sudoku.html)
* [Fibonacci](./examples/browser/fibonacci.html)
* [Miss Manners](./examples/browser/manners.html)
+ * [Waltz DB](./examples/browser/waltzDb.html)
+ * [Send More Money](./examples/browser/sendMoreMoney.html)
* [Diagnosis](./examples/browser/diagnose.html)
View
@@ -178,6 +178,17 @@
+<h1>0.2.2</h1>
+<ul>
+<li>Performance Upgrades<ul>
+<li>Added BetaNode indexing</li>
+<li>Abstracted out JoinNode to extend BetaNode (Prevents the checking of constraints if there are not any constraints to check)</li>
+<li>Refactored BetaNetwork</li>
+<li>Created a new Memory Class to encapusulate left and right memory for BetaNodes</li>
+</ul>
+</li>
+<li>Added new <code>exists</code> logic operator to check for existence of fact (opposite of <code>not</code>)</li>
+</ul>
<h1>0.2.1</h1>
<ul>
<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>
View
@@ -185,6 +185,8 @@
<li><a href="./examples/browser/sudoku.html">Sudoku</a></li>
<li><a href="./examples/browser/fibonacci.html">Fibonacci</a></li>
<li><a href="./examples/browser/manners.html">Miss Manners</a></li>
+<li><a href="./examples/browser/waltzDb.html">Waltz DB</a></li>
+<li><a href="./examples/browser/sendMoreMoney.html">Send More Money</a></li>
<li><a href="./examples/browser/diagnose.html">Diagnosis</a></li>
</ul>
@@ -16,45 +16,91 @@ body {
height: 100%;
}
-#fibonacci div.inline {
+.fibonacci div.inline {
height: 100%;
margin: 10px;
}
-#fibonacci #results_container {
+.fibonacci .results_container {
word-wrap: break-word;
max-width: 100%;
line-height: 50px;
}
-#diagnose {
- width: 500px;
- padding: 10px;
- border: 1px solid rgba(0, 0, 0, 0.1);
- -webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
- -moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
- box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
+.diagnose {
+ width: 100%;
}
-#manners {
- width: 50%;
+.diagnose .diagnose-container{
+ width: 49%;
+ vertical-align: top;
padding: 10px;
- border: 1px solid rgba(0, 0, 0, 0.1);
- -webkit-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
- -moz-box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
- box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
+}
+.waltz-db,
+.manners {
+ width: 100%;
}
-#manners #results_container {
+.waltz-db .editor-container,
+.manners .editor-container,
+.diagnose .editor-container,
+.send-more-money .editor-container {
+ width: 49%;
+ height: 100%;
+ display: inline-block;
+}
+
+.waltz-db .results_container,
+.manners .results_container {
+ width: 49%;
+ vertical-align: top;
+ display: inline-block;
+ height: 100%;
overflow: auto;
- height: 400px;
- width: 95%;
background: #dfdfdf;
color: #09C;
font-family: Tahoma, Geneva, sans-serif;
+ padding-left: 10px;
+}
+
+.editor-container {
+ width: 100%;
+ height: 400px;
+ position: relative;
+ border: 1px solid lightgray;
+}
+
+.editor-container .editor {
+ width: 100%;
+ height: 100%;
+ position: relative;
+}
+
+.send-more-money {
+ width: 100%;
+}
+
+.send-more-money .equation-container {
+ vertical-align: top;
+ width: 49%;
+}
+
+.send-more-money .equation {
+ font-size: 6em;
+ text-align: right;
+ width: 400px;
+}
+
+.send-more-money .equation > div > span {
+ width: 30px;
+ display: inline-block;
+ height: 50px;
padding: 10px;
- border-radius: 10px;
+}
+
+.send-more-money .equation > div:last-child {
+ border-top: solid black 1px;
}
.container > header {
@@ -108,6 +154,12 @@ input[type="submit"], input[type="button"] {
margin: 10px;
}
+input[type="submit"]:disabled,
+input[type="button"]:disabled {
+ background-color: lightgray;
+ cursor: not-allowed;
+}
+
#grid {
overflow: hidden;
@@ -136,6 +188,7 @@ input[type="submit"], input[type="button"] {
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
position: absolute;
bottom: 5px;
+ right: 5px;
}
.row {
@@ -152,6 +205,10 @@ input[type="submit"], input[type="button"] {
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2);
}
+.sudoku {
+ width: 100%;
+}
+
.sudoku .col {
width: 50px;
height: 50px;
@@ -164,11 +221,20 @@ input[type="submit"], input[type="button"] {
background-color: rgba(255, 0, 0, 0.43);
}
-.sudoku #grid{
+.sudoku #grid {
width: 465px;
height: 470px;
}
+.sudoku .grid-container {
+ vertical-align: top;
+ width: 49%;
+}
+
+.sudoku .editor-container {
+ width: 49%;
+}
+
.col.live {
background-color: black;
}
@@ -11,56 +11,58 @@
<body>
-<div id="diagnose" class="middle">
- <h1>Diagnose Me <input type="button" id="edit" value="Edit Rules"/></h1>
-
-
- <form action="#">
- <div class="errors"></div>
- <label for="name">Patient Name</label>
- <input type="text" id="name"/>
- <label for="fever">Fever</label>
- <select id="fever">
- <option value="">None</option>
- <option value="high">High</option>
- <option value="mild">Mild</option>
- </select>
-
- <div>
- <label for="spots">Spots</label>
- <input type="checkbox" id="spots"/>
- </div>
- <div>
- <label for="rash">Rash</label>
- <input type="checkbox" id="rash"/>
- </div>
- <div>
- <label for="sore_throat">Sore Throat</label>
- <input type="checkbox" id="sore_throat"/>
- </div>
- <div>
- <label for="innoculated">Innoculated</label>
- <input type="checkbox" id="innoculated"/>
- </div>
- <input type="submit" value="Diagnose"/>
- </form>
- <hr/>
- <h2>Diagnoses</h2>
-
- <div id="results_container"></div>
+<div class="diagnose middle">
+ <div class="header">
+ <h1>Diagnose Me</h1>
+ </div>
+
+ <div class="editor-container">
+ <div id="editor"></div>
+ </div>
+
+ <div class="diagnose-container inline">
+ <form action="#">
+ <div class="errors"></div>
+ <label for="name">Patient Name</label>
+ <input type="text" id="name"/>
+ <label for="fever">Fever</label>
+ <select id="fever">
+ <option value="">None</option>
+ <option value="high">High</option>
+ <option value="mild">Mild</option>
+ </select>
+
+ <div>
+ <label for="spots">Spots</label>
+ <input type="checkbox" id="spots"/>
+ </div>
+ <div>
+ <label for="rash">Rash</label>
+ <input type="checkbox" id="rash"/>
+ </div>
+ <div>
+ <label for="sore_throat">Sore Throat</label>
+ <input type="checkbox" id="sore_throat"/>
+ </div>
+ <div>
+ <label for="innoculated">Innoculated</label>
+ <input type="checkbox" id="innoculated"/>
+ </div>
+ <input type="submit" value="Diagnose"/>
+ </form>
+ <hr/>
+ <h2>Diagnoses</h2>
+
+ <div id="results_container"></div>
+ </div>
</div>
-<div id="editor-dialog">
- <div id="editor"></div>
-</div>
-
<script type="text/javascript" src="//code.jquery.com/jquery-1.10.1.min.js"></script>
-<script type="text/javascript" src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
-<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/ace/0.2.0/ace.js"></script>
+<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/ace/1.1.01/ace.js"></script>
+<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/ace/1.1.01/mode-javascript.js"></script>
<script type="text/javascript" src="../../nools.js"></script>
<script type="text/javascript" src="./src/common.js"></script>
-<script type="text/javascript" src="./src/guests.js"></script>
<script type="text/javascript">
$(document).ready(function () {
@@ -126,35 +128,19 @@
return false;
});
- $("#edit").on("click", function () {
- $("#editor-dialog").dialog("open");
- return false;
- });
+ var height = $(document).height() - $("#manners .header").height() - 100;
+ $(".editor-container").height(height);
+
+ var editor = ace.edit("editor");
+ //editor.setTheme("ace/theme/monokai");
+ var session = editor.getSession();
+ session.setMode("ace/mode/javascript");
+ session.setValue(res);
+ editor.setReadOnly(true);
- $("#editor-dialog").dialog({
- autoOpen: false,
- modal: true,
- width: window.innerWidth * 0.9,
- height: window.innerHeight * 0.9,
- open: function () {
- (editor = ace.edit("editor").getSession()).setValue(flowStr);
- },
- buttons: {
- "Save": function () {
- $(this).dialog("close");
- nools.deleteFlow("diagnosis");
- stop();
- flow = nools.compile((flowStr = editor.getValue()), {name: "diagnosis"});
- },
- Cancel: function () {
- $(this).dialog("close");
- }
- }
- });
});
- })
- ;
+ });
</script>
</body>
@@ -9,7 +9,7 @@
</head>
<body>
-<div id="fibonacci" class="middle">
+<div class="fibonacci middle">
<h1>Fibonacci</h1>
@@ -20,7 +20,7 @@
<div class="inline">
<div class="large"><span>=</span></div>
</div>
- <div class="inline large" id="results_container">
+ <div class="inline large results_container">
</div>
</form>
</div>
@@ -90,7 +90,7 @@
}
- var resultsContainer = $("#results_container"), valInput = $("#val");
+ var resultsContainer = $(".results_container"), valInput = $("#val");
$("#fibonacci_form").on('submit', function () {
var num = parseInt(valInput.val(), 10);
resultsContainer.text("Calculating...");
Oops, something went wrong.

0 comments on commit 4b515ac

Please sign in to comment.