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

How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

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>