Handle logic boolean function
- Obtain a callable object from a descriptive String or a litteral expression
- Obtain the truth table for a logic function
- Get a representation as a sum of minterms or a product of maxterms
Main interface with different implementation listed in the next sections.
List of methods required by this interface :
get(boolean... vs)computes the result of the function for some inputs (NB: the order of the input must follow the alphabetical order)getNames()returns aStringarray where each element is only one character and represent the name of the corresponding variablegetTruthTable()returns a boolean array of all value of the function for the 2^n possibles input combinationgetTruthTableRepresentation()returns a formatted String representing the truth-tableexpressAsSumOfMinterms()returns a String that can be used to create a new function that will behave exactly as this one using the sum of the mintermsgetMinTermsIndex()returns the indexs corresponding to the minterms of this functionexpressAsProductOfMaxterms()returns a String that can be used to create a new function that will behave exactly as this one using the product of the maxtermsgetMaxTermsIndex()returns the indexs corresponding to the maxterms of this function
The constructor of this class takes a String argument storing the description of the function using letters (a-z) for variables and litterals (0 or 1) and limited boolean operators (&, *, |, +, ', !). The description is parsed with a Parser object and throws RuntimeException is the String isn't valid.
The object is built using LogicNode objects representing either a constant, a variable or a binary / unary operator.
The constructor of this class is similar to the constructor of the LogicChain class, it first create a LogicNode object and then compute and store the truth table.
The constructor expects a CallableLogic object and store it. CallableHandler objects do not print names unless provided by the setNames method.
Functional interface returning a boolean value for a list of boolean inputs.