123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <!DOCTYPE html>
- <html>
- <!--
- CertainTrust Demonstrator in JavaScript
- Demonstrates some capabilities of the CertainTrust SDK
- using a Java applet that interactively calculates
- AND and OR of two CertainTrust data objects and
- visually displays both the input objects and the output.
- @author Florian Volk <florian.volk@cased.de>
- -->
- <head>
- <meta charset="utf-8" />
- <title>CertainTrust Demonstrator in JavaScript</title>
- <style type="text/css">
- h1, p, td:nth-child(2n) { text-align: center; }
- table { margin: 50px 0; }
- </style>
- <!-- include these two scripts and the CSS to enable both CertainTrust and the HTI -->
- <script type="text/javascript" src="CertainTrust.js"></script>
- <script type="text/javascript" src="certainTrustHTI.js"></script>
- <link rel="stylesheet" type="text/css" href="certainTrustHTI.css"/>
- </head>
- <body>
- <h1>Demonstrator for CertainTrust</h1>
- <p>CertainTrust provides a means for the evaluation of propositional logic terms under uncertainty.</p>
- <table>
- <!-- Demonstrator for CertainTrust.cFusion -->
- <tr>
- <td id="cf-operand1"></td>
- <td>cFusion</td>
- <td id="cf-operand2"></td>
- <td>=</td>
- <td id="cf-result"></td>
- </tr>
-
- </table>
- <script type="text/javascript">
- // create an Array to hold the CertainTrust objects
- var CT_objects = [];
- var N = 10;
- var CT_names = ['cf-operand1','cf-operand2','cf-result'];
-
- // CFObserver is used for the conflicted fusion (cFusion) calculation
- var CFObserver = {
- update: function() {
- var fusTmp = new CertainTrust(5);
- var weight = [1,1];
- var fusArray = [];
- fusArray.push(CT_objects['cf-operand1']);
- fusArray.push(CT_objects['cf-operand2']);
-
- //cFusion operation
- var CT_result = fusTmp.cFusion(fusArray,weight);
-
- // update the HTI which displays the result
- CT_objects['cf-result'].setF(CT_result.getF());
- CT_objects['cf-result'].setTC(CT_result.getT(), CT_result.getC());
- }
- };
-
-
- // create the CertainTrust objects and the associated HTIs
- for (var i = 0, element; element = CT_names[i]; ++i) {
- var CT_object = new CertainTrust(N);
- // the result HTIs should be read-only
- var isResultHTI = (-1 !== element.indexOf('-result'));
- var HTI = new CertainTrustHTI(CT_object, {domParent: element, readonly: isResultHTI});
- // register our observers for the calculation
- if (!isResultHTI) {
- var isCF = (0 === element.indexOf('cf-'));
- if(isCF){
- CT_object.addObserver(CFObserver);
- }
-
- }
- // store the created objects for easy access in the Arrays
- CT_objects[element] = CT_object;
- }
- // trigger initial update to the result HTIs
- CFObserver.update();
- </script>
- <p>
- <img src="logo_tudarmstadt.png" alt="Technische Universität Darmstadt" width="176" height="73" />
- <img src="logo_softwarecluster.png" alt="Software-Cluster" width="212" height="73" />
- </p>
- </body>
- </html>
|