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
jtulach@52
     1
/*
jtulach@52
     2
 * OrOperation.java
jtulach@52
     3
 *
jtulach@52
     4
 * Created on July 12, 2006, 2:34 PM
jtulach@52
     5
 *
jtulach@52
     6
 * To change this template, choose Tools | Template Manager
jtulach@52
     7
 * and open the template in the editor.
jtulach@52
     8
 */
jtulach@52
     9
jtulach@52
    10
package org.netbeans.apifest.boolcircuit;
jtulach@52
    11
jtulach@52
    12
/**
jtulach@52
    13
 *
jtulach@52
    14
 */
jtulach@52
    15
final class OrOperation extends Operation {
jtulach@52
    16
    
jtulach@52
    17
    private Input input1;
jtulach@52
    18
jtulach@52
    19
    private Input input2;
jtulach@52
    20
    
jtulach@52
    21
    /** Creates a new instance of orOperation */
jtulach@52
    22
    OrOperation(Input in1, Input in2) {
jtulach@52
    23
        input1 = in1;
jtulach@52
    24
        input2 = in2;
jtulach@52
    25
    }
jtulach@52
    26
jtulach@52
    27
    public boolean performBooleanOperation() {
jtulach@52
    28
        return input1.getBooleanValue() || input2.getBooleanValue();
jtulach@52
    29
    }
jtulach@52
    30
jtulach@52
    31
    public double performRealOperation() {
jtulach@52
    32
        return 1 - ( 1 - input1.getRealValue()) * (1 - input2.getRealValue());
jtulach@52
    33
    }
jtulach@52
    34
    
jtulach@52
    35
}