samples/apifest1/day2/welltestedsolution/src/org/netbeans/apifest/custom/Gte.java
changeset 52 4257f4cf226b
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/samples/apifest1/day2/welltestedsolution/src/org/netbeans/apifest/custom/Gte.java	Sat Jun 14 09:52:45 2008 +0200
     1.3 @@ -0,0 +1,46 @@
     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.custom;
    1.24 +
    1.25 +import org.netbeans.apifest.boolcircuit.Circuit;
    1.26 +
    1.27 +/**
    1.28 + */
    1.29 +public class Gte extends Circuit{
    1.30 +
    1.31 +    private Circuit in1;
    1.32 +    private Circuit in2;
    1.33 +    
    1.34 +    public Gte (Circuit in1, Circuit in2) {
    1.35 +        if (in1 == null || in2 == null)
    1.36 +            throw new IllegalArgumentException();
    1.37 +        this.in1 = in1;
    1.38 +        this.in2 = in2;
    1.39 +    }
    1.40 +    
    1.41 +    protected double doEvaluate(double... inputs) {
    1.42 +        return (in1.evaluateFuzzy(inputs) >= in2.evaluateFuzzy(inputs))? 1.0: 0.0;
    1.43 +    }
    1.44 +
    1.45 +    public int maxInputs() {
    1.46 +        return Math.max(in1.maxInputs(), in2.maxInputs());
    1.47 +    }
    1.48 +    
    1.49 +}