samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/OrOperation.java
author Jaroslav Tulach <jtulach@netbeans.org>
Sat, 14 Jun 2008 09:52:45 +0200
changeset 52 4257f4cf226b
permissions -rw-r--r--
Adding samples from API fest to the repository, including pieces of their code in the document, not just links
     1 /*
     2  * OrOperation.java
     3  *
     4  * Created on July 12, 2006, 2:34 PM
     5  *
     6  * To change this template, choose Tools | Template Manager
     7  * and open the template in the editor.
     8  */
     9 
    10 package org.netbeans.apifest.boolcircuit;
    11 
    12 /**
    13  *
    14  */
    15 final class OrOperation extends Operation {
    16     
    17     private Input input1;
    18 
    19     private Input input2;
    20     
    21     /** Creates a new instance of orOperation */
    22     OrOperation(Input in1, Input in2) {
    23         input1 = in1;
    24         input2 = in2;
    25     }
    26 
    27     public boolean performBooleanOperation() {
    28         return input1.getBooleanValue() || input2.getBooleanValue();
    29     }
    30 
    31     public double performRealOperation() {
    32         return 1 - ( 1 - input1.getRealValue()) * (1 - input2.getRealValue());
    33     }
    34     
    35 }