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

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 

Recently uploaded (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

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>