SlideShare a Scribd company logo
1 of 5
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=windows-1250">
 <meta name="generator" content="PSPad editor, www.pspad.com">
 <title></title>
 </head>
 <body>
 <script>
  //****************Sugar*********************
  Function.prototype.method = function (name, func) {
    this.prototype[name] = func;
    return this;
  };

  Function.method('inherits', function (parent) {
  var d = {}, p = (this.prototype = new parent());
  this.method('uber', function uber(name) {
     if (!(name in d)) {
        d[name] = 0;
     }
     var f, r, t = d[name], v = parent.prototype;
     if (t) {
        while (t) {
            v = v.constructor.prototype;
            t -= 1;
        }
        f = v[name];
     } else {
        f = p[name];
        if (f == this[name]) {
            f = v[name];
        }
     }
     d[name] += 1;
     r = f.apply(this, Array.prototype.slice.apply(arguments, [1]));
     d[name] -= 1;
     return r;
  });
  return this;
  });


  Function.method('swiss', function (parent) {
     for (var i = 1; i < arguments.length; i += 1) {
        var name = arguments[i];
        this.prototype[name] = parent.prototype[name];
     }
     return this;
  });
  //******************************************
  //*************LogicEquation object*********
//var resolveKeys = new Array(Equation, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T,
W, X, Y, Z);

  function LogicEquation()
  {
    this.resolveKeys = new Array("Equation", "A", "B", "C", "D", "E", "F",
                      "G", "H", "I", "J", "K", "L", "M", "N",
                      "O", "P", "Q", "R", "S", "T", "W", "X",
                      "Y", "Z");
    this.equationProducts = new ListOfLogicProducts();
    this.strEquation;
  }

  LogicEquation.prototype.cons = function(value){
    this.strEquation = value;
  }

  LogicEquation.prototype.getEquation = function(){
    return this.strEquation;
  }

  LogicEquation.method("setEquation", function(value){
   this.strEquation = value;
  });

  LogicEquation.method("getEquationProducts", function(){
   return this.equationProducts.strLogicProducts;
  });

  LogicEquation.method("tokenizeEquation", function(){
   this.equationProducts.cons(this.strEquation.split("+"));
  });

  LogicEquation.method("resolveEquationKeys", function(args){
   for(var ctr=1;ctr<args.length;ctr++)
   {
     var eqKey = args[ctr];
     var tmpRegEx = new RegExp(this.resolveKeys[ctr], "g");
     this.strEquation = this.strEquation.replace(tmpRegEx, eqKey);
   }
  });

  LogicEquation.method("resolveEquation", function(){
    return this.equationProducts.resolve();
  });
  //***************************************************
  //***************ListOfEquationProduct***************
  function ListOfLogicProducts()
  {
    this.logicProducts = [];
    this.strLogicProducts;
  }
ListOfLogicProducts.prototype.cons = function(value){
  for(var ctr=0;ctr<value.length;ctr++)
  {
    this.logicProducts[ctr] = new LogicProduct();
    this.logicProducts[ctr].cons(value[ctr]);
  }
  this.strLogicProducts = value;
}

ListOfLogicProducts.method("resolve", function(){
 var result = false;

 for(var ctr=0;ctr<this.logicProducts.length;ctr++)
 {
   var tmpResult = this.logicProducts[ctr].resolve();

     if(result||tmpResult == true) result = true;
     else result = false;
 }

  return result;
});
//**************************************************
//****************LogicProduct**********************
function LogicProduct()
{
  this.productElements = new ListOfProductElements()//[];
  this.strProductElements;
}

LogicProduct.method("cons", function(value){
 this.productElements.cons(value.replace(/^[|]$/g,""));
 this.strProductElements = value;
});

LogicProduct.prototype.resolve = function(){
  return this.productElements.resolve();
}
//**************************************************
//***************ListOfProductElements**************
function ListOfProductElements()
{
  this.listOfElements;
  this.strListOfElements;
}

ListOfProductElements.prototype.cons = function(value){
  this.listOfElements = value.split("*");
  this.strListOfElements = value;
}
ListOfProductElements.method("resolve", function(){
  var result = true;

    for(var ctr=0;ctr<this.listOfElements.length;ctr++)
    {
      var tmpResult = this.listOfElements[ctr];

      if(/^!/.test(tmpResult))
      {
        var temp = tmpResult.replace(/^!/g, "");
        if(temp == "true") tmpResult = "false";
        else tmpResult = "true";
      }

      if(tmpResult == "true")
      {
        if(result == true) {result = true;}
        else {result = false;}
      }
      else {result = false;}

  }
  return result;
});
//**************************************************
//***************the program************************

function equationAnalyzer(args)
{
  try
  {
    var logEq = new LogicEquation();

     logEq.cons(args[0]);
     //logEq.setEquation("[!true*!false*true]+[true*true*!false]"); //"[A*B*!C]+[A*B*C]"

     //alert(logEq.getEquation());
     //alert(logEq.getEquationProducts());

     logEq.resolveEquationKeys(args);
     logEq.tokenizeEquation();

     alert(logEq.resolveEquation());
    }
    catch(e)
    {
      alert(e.description);
    }
}

function main()
{
var args=new Array()

   args[0]='[!A*!B*C*D*E*F*G*H]+[A*B*!C*D*E*F*G*H]+[A*B*!C*D*E*F*G*H]';
   args[1]=true; //A = true
   args[2]=true; //B = false
   args[3]=false; //C = false
   args[4]=true; //D = true
   args[5]=true; //E = true
   args[6]=true; //F = true
   args[7]=true; //G = true
   args[8]=false; //H = true

    equationAnalyzer(args);
  }
 </script>
 <button TYPE=BUTTON onclick="main()">EvalueLogicEquation
 </button>
 </body>
</html>

More Related Content

What's hot

[Droid knights 2019] Tensorflow Lite 부터 ML Kit, Mobile GPU 활용 까지
[Droid knights 2019] Tensorflow Lite 부터 ML Kit, Mobile GPU 활용 까지[Droid knights 2019] Tensorflow Lite 부터 ML Kit, Mobile GPU 활용 까지
[Droid knights 2019] Tensorflow Lite 부터 ML Kit, Mobile GPU 활용 까지Jeongah Shin
 
How to practice functional programming in react
How to practice functional programming in reactHow to practice functional programming in react
How to practice functional programming in reactNetta Bondy
 
Groovy collection api
Groovy collection apiGroovy collection api
Groovy collection apitrygvea
 
The Ring programming language version 1.6 book - Part 82 of 189
The Ring programming language version 1.6 book - Part 82 of 189The Ring programming language version 1.6 book - Part 82 of 189
The Ring programming language version 1.6 book - Part 82 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 76 of 181
The Ring programming language version 1.5.2 book - Part 76 of 181The Ring programming language version 1.5.2 book - Part 76 of 181
The Ring programming language version 1.5.2 book - Part 76 of 181Mahmoud Samir Fayed
 
TDC2016SP - Código funcional em Java: superando o hype
TDC2016SP - Código funcional em Java: superando o hypeTDC2016SP - Código funcional em Java: superando o hype
TDC2016SP - Código funcional em Java: superando o hypetdc-globalcode
 
とある断片の超動的言語
とある断片の超動的言語とある断片の超動的言語
とある断片の超動的言語Kiyotaka Oku
 
Retrieving data from database using result set (1)
Retrieving data from database using result set (1)Retrieving data from database using result set (1)
Retrieving data from database using result set (1)rishisingh190
 
SparkSQLの構文解析
SparkSQLの構文解析SparkSQLの構文解析
SparkSQLの構文解析ゆり 井上
 
Is java8 a true functional programming language
Is java8 a true functional programming languageIs java8 a true functional programming language
Is java8 a true functional programming languageSQLI
 
Is java8a truefunctionallanguage
Is java8a truefunctionallanguageIs java8a truefunctionallanguage
Is java8a truefunctionallanguageSamir Chekkal
 
Currying and Partial Function Application (PFA)
Currying and Partial Function Application (PFA)Currying and Partial Function Application (PFA)
Currying and Partial Function Application (PFA)Dhaval Dalal
 
Shipping Pseudocode to Production VarnaLab
Shipping Pseudocode to Production VarnaLabShipping Pseudocode to Production VarnaLab
Shipping Pseudocode to Production VarnaLabDobromir Nikolov
 
Ramda, a functional JavaScript library
Ramda, a functional JavaScript libraryRamda, a functional JavaScript library
Ramda, a functional JavaScript libraryDerek Willian Stavis
 
Ramda lets write declarative js
Ramda   lets write declarative jsRamda   lets write declarative js
Ramda lets write declarative jsPivorak MeetUp
 
The Ring programming language version 1.9 book - Part 92 of 210
The Ring programming language version 1.9 book - Part 92 of 210The Ring programming language version 1.9 book - Part 92 of 210
The Ring programming language version 1.9 book - Part 92 of 210Mahmoud Samir Fayed
 

What's hot (20)

Base de-datos
Base de-datosBase de-datos
Base de-datos
 
[Droid knights 2019] Tensorflow Lite 부터 ML Kit, Mobile GPU 활용 까지
[Droid knights 2019] Tensorflow Lite 부터 ML Kit, Mobile GPU 활용 까지[Droid knights 2019] Tensorflow Lite 부터 ML Kit, Mobile GPU 활용 까지
[Droid knights 2019] Tensorflow Lite 부터 ML Kit, Mobile GPU 활용 까지
 
はじめてのGroovy
はじめてのGroovyはじめてのGroovy
はじめてのGroovy
 
How to practice functional programming in react
How to practice functional programming in reactHow to practice functional programming in react
How to practice functional programming in react
 
Groovy collection api
Groovy collection apiGroovy collection api
Groovy collection api
 
The Ring programming language version 1.6 book - Part 82 of 189
The Ring programming language version 1.6 book - Part 82 of 189The Ring programming language version 1.6 book - Part 82 of 189
The Ring programming language version 1.6 book - Part 82 of 189
 
The Ring programming language version 1.5.2 book - Part 76 of 181
The Ring programming language version 1.5.2 book - Part 76 of 181The Ring programming language version 1.5.2 book - Part 76 of 181
The Ring programming language version 1.5.2 book - Part 76 of 181
 
TDC2016SP - Código funcional em Java: superando o hype
TDC2016SP - Código funcional em Java: superando o hypeTDC2016SP - Código funcional em Java: superando o hype
TDC2016SP - Código funcional em Java: superando o hype
 
Clojure functions midje
Clojure functions midjeClojure functions midje
Clojure functions midje
 
とある断片の超動的言語
とある断片の超動的言語とある断片の超動的言語
とある断片の超動的言語
 
Retrieving data from database using result set (1)
Retrieving data from database using result set (1)Retrieving data from database using result set (1)
Retrieving data from database using result set (1)
 
SparkSQLの構文解析
SparkSQLの構文解析SparkSQLの構文解析
SparkSQLの構文解析
 
Is java8 a true functional programming language
Is java8 a true functional programming languageIs java8 a true functional programming language
Is java8 a true functional programming language
 
Is java8a truefunctionallanguage
Is java8a truefunctionallanguageIs java8a truefunctionallanguage
Is java8a truefunctionallanguage
 
Currying and Partial Function Application (PFA)
Currying and Partial Function Application (PFA)Currying and Partial Function Application (PFA)
Currying and Partial Function Application (PFA)
 
Shipping Pseudocode to Production VarnaLab
Shipping Pseudocode to Production VarnaLabShipping Pseudocode to Production VarnaLab
Shipping Pseudocode to Production VarnaLab
 
Ramda, a functional JavaScript library
Ramda, a functional JavaScript libraryRamda, a functional JavaScript library
Ramda, a functional JavaScript library
 
Ramda lets write declarative js
Ramda   lets write declarative jsRamda   lets write declarative js
Ramda lets write declarative js
 
PathOfMostResistance
PathOfMostResistancePathOfMostResistance
PathOfMostResistance
 
The Ring programming language version 1.9 book - Part 92 of 210
The Ring programming language version 1.9 book - Part 92 of 210The Ring programming language version 1.9 book - Part 92 of 210
The Ring programming language version 1.9 book - Part 92 of 210
 

Viewers also liked

Object Oriented Approach Within Siebel Boundaries
Object Oriented Approach Within Siebel BoundariesObject Oriented Approach Within Siebel Boundaries
Object Oriented Approach Within Siebel BoundariesRoman Agaev
 
Common Redirection Mechanism
Common Redirection MechanismCommon Redirection Mechanism
Common Redirection MechanismRoman Agaev
 
It Project And Agile
It Project And AgileIt Project And Agile
It Project And AgileRoman Agaev
 
Guidance 4 Days Configuration
Guidance   4 Days   ConfigurationGuidance   4 Days   Configuration
Guidance 4 Days ConfigurationRoman Agaev
 
Siebel client side integrator (SCSI)
Siebel client side integrator (SCSI)Siebel client side integrator (SCSI)
Siebel client side integrator (SCSI)Roman Agaev
 
Integration Within Several Projects
Integration Within Several ProjectsIntegration Within Several Projects
Integration Within Several ProjectsRoman Agaev
 
Potential Solutions Co Existence
Potential Solutions   Co ExistencePotential Solutions   Co Existence
Potential Solutions Co ExistenceRoman Agaev
 
Siebel deployment
Siebel deploymentSiebel deployment
Siebel deploymentRoman Agaev
 

Viewers also liked (9)

Object Oriented Approach Within Siebel Boundaries
Object Oriented Approach Within Siebel BoundariesObject Oriented Approach Within Siebel Boundaries
Object Oriented Approach Within Siebel Boundaries
 
Common Redirection Mechanism
Common Redirection MechanismCommon Redirection Mechanism
Common Redirection Mechanism
 
It Project And Agile
It Project And AgileIt Project And Agile
It Project And Agile
 
Guidance 4 Days Configuration
Guidance   4 Days   ConfigurationGuidance   4 Days   Configuration
Guidance 4 Days Configuration
 
Design Results
Design ResultsDesign Results
Design Results
 
Siebel client side integrator (SCSI)
Siebel client side integrator (SCSI)Siebel client side integrator (SCSI)
Siebel client side integrator (SCSI)
 
Integration Within Several Projects
Integration Within Several ProjectsIntegration Within Several Projects
Integration Within Several Projects
 
Potential Solutions Co Existence
Potential Solutions   Co ExistencePotential Solutions   Co Existence
Potential Solutions Co Existence
 
Siebel deployment
Siebel deploymentSiebel deployment
Siebel deployment
 

Similar to Logic Equations Resolver J Script

TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript IntroductionDmitry Sheiko
 
java compilerCompiler1.javajava compilerCompiler1.javaimport.docx
java compilerCompiler1.javajava compilerCompiler1.javaimport.docxjava compilerCompiler1.javajava compilerCompiler1.javaimport.docx
java compilerCompiler1.javajava compilerCompiler1.javaimport.docxpriestmanmable
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs偉格 高
 
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docxsrcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docxwhitneyleman54422
 
JSConf: All You Can Leet
JSConf: All You Can LeetJSConf: All You Can Leet
JSConf: All You Can Leetjohndaviddalton
 
JavaScript - i och utanför webbläsaren (2010-03-03)
JavaScript - i och utanför webbläsaren (2010-03-03)JavaScript - i och utanför webbläsaren (2010-03-03)
JavaScript - i och utanför webbläsaren (2010-03-03)Anders Jönsson
 
Ian 20150116 java script oop
Ian 20150116 java script oopIan 20150116 java script oop
Ian 20150116 java script oopLearningTech
 
Js 单元测试框架介绍
Js 单元测试框架介绍Js 单元测试框架介绍
Js 单元测试框架介绍louieuser
 
Web Optimization Summit: Coding for Performance
Web Optimization Summit: Coding for PerformanceWeb Optimization Summit: Coding for Performance
Web Optimization Summit: Coding for Performancejohndaviddalton
 
Ast transformations
Ast transformationsAst transformations
Ast transformationsHamletDRC
 
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEDarwin Durand
 
FrontDays #3. Иван Федяев, Эволюция JavaScript. Обзор нововведений ECMAScript 6
FrontDays #3. Иван Федяев, Эволюция JavaScript. Обзор нововведений ECMAScript 6FrontDays #3. Иван Федяев, Эволюция JavaScript. Обзор нововведений ECMAScript 6
FrontDays #3. Иван Федяев, Эволюция JavaScript. Обзор нововведений ECMAScript 6FrontDays
 
JavaScript Classes and Inheritance
JavaScript Classes and InheritanceJavaScript Classes and Inheritance
JavaScript Classes and Inheritancemarcheiligers
 
Productaccess m
Productaccess mProductaccess m
Productaccess mAdil Usman
 
Object-Oriented JavaScript
Object-Oriented JavaScriptObject-Oriented JavaScript
Object-Oriented JavaScriptkvangork
 
Object-Oriented Javascript
Object-Oriented JavascriptObject-Oriented Javascript
Object-Oriented Javascriptkvangork
 

Similar to Logic Equations Resolver J Script (20)

Say It With Javascript
Say It With JavascriptSay It With Javascript
Say It With Javascript
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
java compilerCompiler1.javajava compilerCompiler1.javaimport.docx
java compilerCompiler1.javajava compilerCompiler1.javaimport.docxjava compilerCompiler1.javajava compilerCompiler1.javaimport.docx
java compilerCompiler1.javajava compilerCompiler1.javaimport.docx
 
Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs
 
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docxsrcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
 
JSConf: All You Can Leet
JSConf: All You Can LeetJSConf: All You Can Leet
JSConf: All You Can Leet
 
JavaScript - i och utanför webbläsaren (2010-03-03)
JavaScript - i och utanför webbläsaren (2010-03-03)JavaScript - i och utanför webbläsaren (2010-03-03)
JavaScript - i och utanför webbläsaren (2010-03-03)
 
Ian 20150116 java script oop
Ian 20150116 java script oopIan 20150116 java script oop
Ian 20150116 java script oop
 
Js 单元测试框架介绍
Js 单元测试框架介绍Js 单元测试框架介绍
Js 单元测试框架介绍
 
Web Optimization Summit: Coding for Performance
Web Optimization Summit: Coding for PerformanceWeb Optimization Summit: Coding for Performance
Web Optimization Summit: Coding for Performance
 
Ast transformations
Ast transformationsAst transformations
Ast transformations
 
Week 12 code
Week 12 codeWeek 12 code
Week 12 code
 
Google guava
Google guavaGoogle guava
Google guava
 
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
 
FrontDays #3. Иван Федяев, Эволюция JavaScript. Обзор нововведений ECMAScript 6
FrontDays #3. Иван Федяев, Эволюция JavaScript. Обзор нововведений ECMAScript 6FrontDays #3. Иван Федяев, Эволюция JavaScript. Обзор нововведений ECMAScript 6
FrontDays #3. Иван Федяев, Эволюция JavaScript. Обзор нововведений ECMAScript 6
 
JavaScript Classes and Inheritance
JavaScript Classes and InheritanceJavaScript Classes and Inheritance
JavaScript Classes and Inheritance
 
Productaccess m
Productaccess mProductaccess m
Productaccess m
 
25-functions.ppt
25-functions.ppt25-functions.ppt
25-functions.ppt
 
Object-Oriented JavaScript
Object-Oriented JavaScriptObject-Oriented JavaScript
Object-Oriented JavaScript
 
Object-Oriented Javascript
Object-Oriented JavascriptObject-Oriented Javascript
Object-Oriented Javascript
 

More from Roman Agaev

Client/Server Paradigm And Its Implementation
Client/Server Paradigm And Its ImplementationClient/Server Paradigm And Its Implementation
Client/Server Paradigm And Its ImplementationRoman Agaev
 
Order Management Plus Integration Topics
Order Management Plus Integration TopicsOrder Management Plus Integration Topics
Order Management Plus Integration TopicsRoman Agaev
 
Workflow Usage Best Practices
Workflow Usage Best PracticesWorkflow Usage Best Practices
Workflow Usage Best PracticesRoman Agaev
 
Workflow On The Fly Monitoring Solution
Workflow On The Fly Monitoring SolutionWorkflow On The Fly Monitoring Solution
Workflow On The Fly Monitoring SolutionRoman Agaev
 
Potential Vpn Solution
Potential Vpn SolutionPotential Vpn Solution
Potential Vpn SolutionRoman Agaev
 
Potential Customer Data Model Solution Telco
Potential Customer Data Model Solution   TelcoPotential Customer Data Model Solution   Telco
Potential Customer Data Model Solution TelcoRoman Agaev
 
General Logging Approach
General Logging ApproachGeneral Logging Approach
General Logging ApproachRoman Agaev
 
General Error Handling Approach
General Error Handling ApproachGeneral Error Handling Approach
General Error Handling ApproachRoman Agaev
 
Common System Parameters
Common System ParametersCommon System Parameters
Common System ParametersRoman Agaev
 
Common Global Parameters
Common Global ParametersCommon Global Parameters
Common Global ParametersRoman Agaev
 
Common Msisdn Resource Number Management
Common Msisdn Resource   Number ManagementCommon Msisdn Resource   Number Management
Common Msisdn Resource Number ManagementRoman Agaev
 
Guidance 4 Days Configuration Presentation
Guidance   4 Days   Configuration   PresentationGuidance   4 Days   Configuration   Presentation
Guidance 4 Days Configuration PresentationRoman Agaev
 
Siebel Web Architecture
Siebel Web ArchitectureSiebel Web Architecture
Siebel Web ArchitectureRoman Agaev
 
Enterprise Integration Application
Enterprise Integration ApplicationEnterprise Integration Application
Enterprise Integration ApplicationRoman Agaev
 

More from Roman Agaev (15)

Client/Server Paradigm And Its Implementation
Client/Server Paradigm And Its ImplementationClient/Server Paradigm And Its Implementation
Client/Server Paradigm And Its Implementation
 
Order Management Plus Integration Topics
Order Management Plus Integration TopicsOrder Management Plus Integration Topics
Order Management Plus Integration Topics
 
Workflow Usage Best Practices
Workflow Usage Best PracticesWorkflow Usage Best Practices
Workflow Usage Best Practices
 
Workflow On The Fly Monitoring Solution
Workflow On The Fly Monitoring SolutionWorkflow On The Fly Monitoring Solution
Workflow On The Fly Monitoring Solution
 
Potential Vpn Solution
Potential Vpn SolutionPotential Vpn Solution
Potential Vpn Solution
 
Potential Customer Data Model Solution Telco
Potential Customer Data Model Solution   TelcoPotential Customer Data Model Solution   Telco
Potential Customer Data Model Solution Telco
 
General Logging Approach
General Logging ApproachGeneral Logging Approach
General Logging Approach
 
General Error Handling Approach
General Error Handling ApproachGeneral Error Handling Approach
General Error Handling Approach
 
Common System Parameters
Common System ParametersCommon System Parameters
Common System Parameters
 
Common Global Parameters
Common Global ParametersCommon Global Parameters
Common Global Parameters
 
Common Msisdn Resource Number Management
Common Msisdn Resource   Number ManagementCommon Msisdn Resource   Number Management
Common Msisdn Resource Number Management
 
Guidance 4 Days Configuration Presentation
Guidance   4 Days   Configuration   PresentationGuidance   4 Days   Configuration   Presentation
Guidance 4 Days Configuration Presentation
 
Analysis
AnalysisAnalysis
Analysis
 
Siebel Web Architecture
Siebel Web ArchitectureSiebel Web Architecture
Siebel Web Architecture
 
Enterprise Integration Application
Enterprise Integration ApplicationEnterprise Integration Application
Enterprise Integration Application
 

Recently uploaded

Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 

Recently uploaded (20)

Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Logic Equations Resolver J Script

  • 1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=windows-1250"> <meta name="generator" content="PSPad editor, www.pspad.com"> <title></title> </head> <body> <script> //****************Sugar********************* Function.prototype.method = function (name, func) { this.prototype[name] = func; return this; }; Function.method('inherits', function (parent) { var d = {}, p = (this.prototype = new parent()); this.method('uber', function uber(name) { if (!(name in d)) { d[name] = 0; } var f, r, t = d[name], v = parent.prototype; if (t) { while (t) { v = v.constructor.prototype; t -= 1; } f = v[name]; } else { f = p[name]; if (f == this[name]) { f = v[name]; } } d[name] += 1; r = f.apply(this, Array.prototype.slice.apply(arguments, [1])); d[name] -= 1; return r; }); return this; }); Function.method('swiss', function (parent) { for (var i = 1; i < arguments.length; i += 1) { var name = arguments[i]; this.prototype[name] = parent.prototype[name]; } return this; }); //****************************************** //*************LogicEquation object*********
  • 2. //var resolveKeys = new Array(Equation, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, W, X, Y, Z); function LogicEquation() { this.resolveKeys = new Array("Equation", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "W", "X", "Y", "Z"); this.equationProducts = new ListOfLogicProducts(); this.strEquation; } LogicEquation.prototype.cons = function(value){ this.strEquation = value; } LogicEquation.prototype.getEquation = function(){ return this.strEquation; } LogicEquation.method("setEquation", function(value){ this.strEquation = value; }); LogicEquation.method("getEquationProducts", function(){ return this.equationProducts.strLogicProducts; }); LogicEquation.method("tokenizeEquation", function(){ this.equationProducts.cons(this.strEquation.split("+")); }); LogicEquation.method("resolveEquationKeys", function(args){ for(var ctr=1;ctr<args.length;ctr++) { var eqKey = args[ctr]; var tmpRegEx = new RegExp(this.resolveKeys[ctr], "g"); this.strEquation = this.strEquation.replace(tmpRegEx, eqKey); } }); LogicEquation.method("resolveEquation", function(){ return this.equationProducts.resolve(); }); //*************************************************** //***************ListOfEquationProduct*************** function ListOfLogicProducts() { this.logicProducts = []; this.strLogicProducts; }
  • 3. ListOfLogicProducts.prototype.cons = function(value){ for(var ctr=0;ctr<value.length;ctr++) { this.logicProducts[ctr] = new LogicProduct(); this.logicProducts[ctr].cons(value[ctr]); } this.strLogicProducts = value; } ListOfLogicProducts.method("resolve", function(){ var result = false; for(var ctr=0;ctr<this.logicProducts.length;ctr++) { var tmpResult = this.logicProducts[ctr].resolve(); if(result||tmpResult == true) result = true; else result = false; } return result; }); //************************************************** //****************LogicProduct********************** function LogicProduct() { this.productElements = new ListOfProductElements()//[]; this.strProductElements; } LogicProduct.method("cons", function(value){ this.productElements.cons(value.replace(/^[|]$/g,"")); this.strProductElements = value; }); LogicProduct.prototype.resolve = function(){ return this.productElements.resolve(); } //************************************************** //***************ListOfProductElements************** function ListOfProductElements() { this.listOfElements; this.strListOfElements; } ListOfProductElements.prototype.cons = function(value){ this.listOfElements = value.split("*"); this.strListOfElements = value; }
  • 4. ListOfProductElements.method("resolve", function(){ var result = true; for(var ctr=0;ctr<this.listOfElements.length;ctr++) { var tmpResult = this.listOfElements[ctr]; if(/^!/.test(tmpResult)) { var temp = tmpResult.replace(/^!/g, ""); if(temp == "true") tmpResult = "false"; else tmpResult = "true"; } if(tmpResult == "true") { if(result == true) {result = true;} else {result = false;} } else {result = false;} } return result; }); //************************************************** //***************the program************************ function equationAnalyzer(args) { try { var logEq = new LogicEquation(); logEq.cons(args[0]); //logEq.setEquation("[!true*!false*true]+[true*true*!false]"); //"[A*B*!C]+[A*B*C]" //alert(logEq.getEquation()); //alert(logEq.getEquationProducts()); logEq.resolveEquationKeys(args); logEq.tokenizeEquation(); alert(logEq.resolveEquation()); } catch(e) { alert(e.description); } } function main() {
  • 5. var args=new Array() args[0]='[!A*!B*C*D*E*F*G*H]+[A*B*!C*D*E*F*G*H]+[A*B*!C*D*E*F*G*H]'; args[1]=true; //A = true args[2]=true; //B = false args[3]=false; //C = false args[4]=true; //D = true args[5]=true; //E = true args[6]=true; //F = true args[7]=true; //G = true args[8]=false; //H = true equationAnalyzer(args); } </script> <button TYPE=BUTTON onclick="main()">EvalueLogicEquation </button> </body> </html>