Abstract:
An improved electronic spreadsheet is provided for applications requiring conditional expression execution behavior. Each cell having an executable expression is cooperative with an implicit conditional execution wrapper. The execution of each cellular expression is implicitly conditioned on the state of an individually assigned logical switch expression. The improved electronic spreadsheet also includes a user interface by which a user can assign logical switch expressions to a cell, or to a range of cells. The improved electronic spreadsheet facilitates the use of spreadsheets for wider range of applications than was possible with conventional electronic spreadsheets.

Description:
FIELD OF THE DISCLOSURE 
     The present disclosure related to electronic spreadsheets, and more particularly to computer programming using electronic spreadsheets. 
     BACKGROUND OF THE DISCLOSURE 
     The superior ease-of-use characteristics of electronic spreadsheets are well-known, especially in the field of office automation. The use of electronic spreadsheets in other fields is also know, although in the past, many computer applications have been unable to take advantage of the spreadsheet metaphor. One reason for this may be computer applications are often required to exhibit conditional statement execution behavior. However, conditional statement execution behavior is beyond the capability of conventional electronic spreadsheet programs. 
     In the field of pattern recognition, for example, it is common for a single program to execute one set of instructions during training, and another set of instructions during classification, the instructions for classification being dependent on exemplar data extracted during training. In this field it is also common for programs to dynamically adapt their order of execution based on external control parameters. Consequently, known electronic spreadsheets cannot adequately be used for programming applications in the field of pattern recognition. 
     In conventional programming, positional order of program statements and conditional branching within program statements drive the order of execution of the program statements. In the BASIC programming language, for example, a program statement at line 20 in a program listing is always executed after the program statement at line 10, unless a branch statement is encountered and a jump instruction is invoked. 
     Unlike a programming language, an electronic spreadsheet is essentially a means for graphically representing a single expression by distributing the expression across a rectangular grid of cells (or any regular array of cells), each cell being a parenthetical expression that can be a function of some number of other expressions in cells across the grid. As in typical expression evaluation, precedence and dependencies drive the order of execution. Since the order of executing is not explicitly programmed, there is no spreadsheet equivalent to a jump instruction in conventional spreadsheets. The limitation of conventional spreadsheets makes programming certain kinds of behavior difficult, if not impossible. 
     Conventional electronic spreadsheets are known to support limited conditional behavior, e.g., conditional argument value assignment using the standard IF functions. An IF function consists of three arguments: A, B, and C, where argument A is a logical switch expression, and arguments B and C are the two possible expressions to be evaluated. If the expression in argument A evaluates TRUE, the expression in argument B is evaluated and returned. If the expression in argument A evaluates FALSE, the expression in argument C is evaluated and returned. 
     Like IF, the CHOOSE function simply evaluates and returns one of N expressions. The evaluation of the expression in the first argument of the CHOOSE function determines which of the N expressions will be evaluated and returned, which is essentially a generalization of the IF function. However, the functions IF, CHOOSE, and similar functions, are only capable of selecting among result values, and are incapable of controlling the order of execution of expressions associated with a cell or a set of cells within the spreadsheet. 
     SUMMARY OF THE DISCLOSURE 
     In accordance with one embodiment apparatus may be provided, which comprise an electronic spreadsheet generator, stored executable expressions, switch expressions, a user interface, an evaluator, and an execution controller. The electronic spreadsheet generator is configured to generate a spreadsheet on a computer screen, the spreadsheet having a plurality of cells. The stored executable expressions respectively correspond to select ones of the plurality of cells. The switch expressions respectively correspond to the cells. The user interface is configured to receive data for and to display, on a computer screen, cells of the spreadsheet, the executable expressions, and the switch expressions. The evaluator is configured to evaluate a given switch expression from among the switch expressions, the given switch expression corresponding to a given cell among the plurality of cells. The execution controller is configured to allow a given executable expression corresponding to the given cell to be executed when the given switch expression is evaluated to create one result, and is configured to disallow the given executable expression to be executed when the given switch expression is evaluated to create another result. The given switch expression for the given cell is supplemental to the given executable expression. 
    
    
     
       BRIEF DESCRIPTION OF DRAWING 
       Aspects of the disclosure will be more fully understood from the following detailed description, in conjunction with the following figures, wherein: 
         FIG. 1  is a sequence of four instances of a portion of an electronic spreadsheet per one embodiment, each instance including a dialog box and a pop-up window making explicit the logical switch expression of the conditional wrapper associated with each cell of the embodiment; 
         FIG. 2  is a listing BASIC computer program that is the functional equivalent of the spreadsheet of  FIG. 1 ; and 
         FIG. 3  is a flow chart illustrating an embodiment of a method for programming conditional execution in an electronic spreadsheet. 
     
    
    
     DETAILED DESCRIPTION 
     Embodiments of the disclosure provide methods and apparatuses for programming conditional execution behavior in an electronic spreadsheet, and methods of programming the order of execution of expressions associated with cells in an electronic spreadsheet. While providing such methods and apparatuses, the fundamental characteristics of conventional electronic spreadsheets can be preserved to a high degree. Moreover, the disclosed methods and apparatuses for programming conditional behavior in electronic spreadsheets may be made to be easy and intuitive to use. 
     An embodiment includes implicit conditional wrappers associated with each cell of the electronic spreadsheet, whereby the execution of each cellular expression is conditioned upon the state of an individually assigned logical switch expression included in an associated implicit conditional wrapper. 
     In a preferred embodiment, every expression in every cell is enabled or disabled by an implicit conditional wrapper. This implicit conditional wrapper uses a logical switch expression to control the execution of the cell&#39;s expression, i.e., to enable or disable the execution of the cell&#39;s expression based on the value of the logical switch expression. 
     In a preferred embodiment, the logical switch expression is entered into the implicit conditional wrapper of a cell using a pop-up dialog box and an associated pop-up window, for example. The dialog box can then be closed by the user, causing the pop-up window and its entered logical switch expression to disappear along with the dialog box. Closing the dialog box makes the logical switch expression appear to no longer be associated with the cell, thereby making the logical switch expression invisible or “implicit”, because the existence and nature of the logical switch expression is not visible to the user solely by looking at the contents of the cell. However, the effects of the logical switch expression become manifest upon execution of the electronic spreadsheet. 
     The logical switch expression can be any legal spreadsheet expression that can be evaluated to logical TRUE or FALSE. If the logical switch expression evaluates to TRUE, the cell&#39;s corresponding expression is evaluated, a new result value is returned, and the cell&#39;s internal result buffer is updated accordingly. If the logical switch expression evaluates FALSE, the cell&#39;s expression is not evaluated, and the cell&#39;s result buffer is returned unmodified. 
     In a preferred embodiment, individual switch expressions are initialized to a constant logical TRUE. In another preferred embodiment, the spreadsheet user interface supports the interactive assignment of a switch expression to any cell or range of cells within the spreadsheet, using dialog boxes and pop-up windows, for example. A user selecting a “cell state” display mode from a menu after selecting a cell will cause a dialog box to appear, along with an associated window that displays the associated logical switch expression. 
     The default behavior of the improved electronic spreadsheet is unaffected by the extension and improvements described above if all individual logical switch expressions are initialized to a constant logical TRUE. In this case, a user can ignore the implicit conditionals. Alternatively, the user can mark arbitrary sets of cells, and then selectively assign logical switch expressions to program desired electronic spreadsheet behavior beyond the capacity of known electronic spreadsheets, such as providing various orders of cell execution. 
     Per certain embodiments, the conventional spreadsheet metaphor can be efficiently and elegantly extended to meet many of the fundamental requirements of conditional expression execution in computer programming. 
       FIG. 1  shows a sequence of four instances  1 ,  4 ,  7 ,  10  of a portion of an electronic spreadsheet incorporating certain improvements of the present disclosure. In the first spreadsheet instance  1 , cell B 1  is selected by a user, and is seen to be equal to the logical constant FALSE. After a user selects a “cell state” display mode from a pull-down menu, selecting a cell or plurality of cells causes an enable dialog box  2  to appear as well as causing an associated logical switch expression pop-up window  3  to appear (also see  FIG. 3 , step  15 ). The enable dialog box  2 , superimposed on the spreadsheet grid, shows that the enable switch expression is equal to the logical constant TRUE, indicating that the expression in B 1  will be executed. It is also possible for the user to change the enable switch expression by entering a new enable switch expression  15 , as shown in  FIG. 3 . 
     Thus, the value of B 1  will be FALSE, provided that the enable switch expression that controls the execution of cell B 1  is set to TRUE. The implicit conditional expression (including the enable switch expression) that controls the execution of cell B 1  is shown in the pop-up window  3  that appears with the enable dialog  2 , and contains the logical expression: IF(TRUE, B 1 =FALSE). 
     In spreadsheet instance  4 , cell B 2  is selected and conditionally set equal to the results of the expression evaluated in B 3 , based on the conditional expression in the pop-up window  6 . Enable dialog  5  shows that the enable switch expression is equal to the result of expression evaluated in cell BI. Since B 1  is known to evaluate to FALSE, in this case, the expression in B 2  will not be executed. The implicit conditional expression associated with cell B 2  is shown in the pop-up window  6 . 
     In spreadsheet instance  7 , cell B 3  is selected and set equal to the result of an image measurement function performed on an external image data buffer. Enable dialog  8  shows that the enable switch expression is equal to the logical constant TRUE, indicating that the expression in B 3  will be executed. The implicit conditional expression associated with cell B 3  is shown in the pop-up window  9 . 
     In spreadsheet instance  10 , cell B 4  is selected and set equal to the result of a logical operation performed on the results of the expressions evaluated in B 2  and B 3 . Enable dialog  11  shows that the enable switch expression is equal to the logical constant TRUE, indicating that the expression in B 4  will be executed. The implicit conditional expression associated with cell B 4  is shown in the pop-up window  12 . 
     Referring to  FIG. 2 , a BASIC program fragment  13  shows the BASIC program steps that together are equivalent to the electronic spreadsheet program shown in  FIG. 1 . This BASIC program will exhibit the same behavior, i.e., evaluate expressions, assign values, and transfer program control, so as to achieve the same result as the execution of the illustrated embodiment of an electronic spreadsheet, yet via an entirely different user interface.  FIG. 2  emphasizes and illustrates that the illustrated example spreadsheet can achieve functionality that was previously not possible in electronic spreadsheets, and prior to the present disclosure, was possible only using computer languages like BASIC, COBOL, FORTRAN, and C, for example. 
     In the forgoing example illustrated in  FIG. 1 , a spreadsheet is programmed to behave in one of two possible ways, depending on cell B 1 . If the expression in cell B 1  is set to TRUE (thereby indicating that the spreadsheet is in training mode in the example of  FIG. 1 ), the spreadsheet executes a training sequence whereby the results of an image measurement executed in cell B 3  are saved in cell B 2  for future comparisons. 
     If the expression in cell B 1  evaluates to FALSE (thereby indicating testing mode in the example of  FIG. 1 ), the training step associated with the expression in cell B 1  is not executed. The expression in cell B 4  goes on to perform a test which compares the current image measurement performed in B 3  to the measurement saved on the most recent training cycle in cell B 2 . 
     Other modifications and implementations will occur to those skilled in the art without departing from the spirit and the scope of the invention as claimed. Accordingly, the above description is not intended to limit the invention except as indicated in the claims now or as they may be amended.