samples/apifest1/day2/elementbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java
changeset 132 3bc4c54f4bcc
parent 59 02e05defc6a0
child 153 b5cbb797ec0a
     1.1 --- a/samples/apifest1/day2/elementbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java	Sat Jun 14 09:52:52 2008 +0200
     1.2 +++ b/samples/apifest1/day2/elementbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit.java	Sat Jun 14 09:56:12 2008 +0200
     1.3 @@ -1,22 +1,3 @@
     1.4 -/*
     1.5 - * The contents of this file are subject to the terms of the Common Development
     1.6 - * and Distribution License (the License). You may not use this file except in
     1.7 - * compliance with the License.
     1.8 - *
     1.9 - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
    1.10 - * or http://www.netbeans.org/cddl.txt.
    1.11 - *
    1.12 - * When distributing Covered Code, include this CDDL Header Notice in each file
    1.13 - * and include the License file at http://www.netbeans.org/cddl.txt.
    1.14 - * If applicable, add the following below the CDDL Header, with the fields
    1.15 - * enclosed by brackets [] replaced by your own identifying information:
    1.16 - * "Portions Copyrighted [year] [name of copyright owner]"
    1.17 - *
    1.18 - * The Original Software is NetBeans. The Initial Developer of the Original
    1.19 - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
    1.20 - * Microsystems, Inc. All Rights Reserved.
    1.21 - */
    1.22 -
    1.23  package org.netbeans.apifest.boolcircuit;
    1.24  
    1.25  // BEGIN: apifest.day2.elementbasedsolution.Circuit
    1.26 @@ -40,7 +21,8 @@
    1.27                  return e1.result() || e2.result();
    1.28              }
    1.29              public double doubleResult() {
    1.30 -                return 1.0 - (1.0 - e1.doubleResult()) * (1.0 - e2.doubleResult());
    1.31 +                return 1.0 - 
    1.32 +                    (1.0 - e1.doubleResult()) * (1.0 - e2.doubleResult());
    1.33              }
    1.34          };
    1.35      }
    1.36 @@ -56,7 +38,9 @@
    1.37          };
    1.38      }
    1.39      
    1.40 -    public static Element operation(final Operation op, final Element... elements) {
    1.41 +    public static Element operation(
    1.42 +        final Operation op, final Element... elements
    1.43 +    ) {
    1.44          return new Element() {
    1.45              public boolean result() {
    1.46                  return doubleResult() >= 1.0;
    1.47 @@ -99,11 +83,13 @@
    1.48          }
    1.49  
    1.50          public boolean result() {
    1.51 -            return booleanValue != null ? booleanValue : doubleValue >= 1.0;
    1.52 +            return booleanValue != null ? 
    1.53 +                booleanValue : doubleValue >= 1.0;
    1.54          }
    1.55  
    1.56          public double doubleResult() {
    1.57 -            return doubleValue != null ? doubleValue : (booleanValue ? 1.0 : 0.0);
    1.58 +            return doubleValue != null ? 
    1.59 +                doubleValue : (booleanValue ? 1.0 : 0.0);
    1.60          }
    1.61  
    1.62      }