author | Jaroslav Tulach <jtulach@netbeans.org> |
Sat, 14 Jun 2008 09:52:45 +0200 | |
changeset 52 | 4257f4cf226b |
permissions | -rw-r--r-- |
jtulach@52 | 1 |
/* |
jtulach@52 | 2 |
* The contents of this file are subject to the terms of the Common Development |
jtulach@52 | 3 |
* and Distribution License (the License). You may not use this file except in |
jtulach@52 | 4 |
* compliance with the License. |
jtulach@52 | 5 |
* |
jtulach@52 | 6 |
* You can obtain a copy of the License at http://www.netbeans.org/cddl.html |
jtulach@52 | 7 |
* or http://www.netbeans.org/cddl.txt. |
jtulach@52 | 8 |
* |
jtulach@52 | 9 |
* When distributing Covered Code, include this CDDL Header Notice in each file |
jtulach@52 | 10 |
* and include the License file at http://www.netbeans.org/cddl.txt. |
jtulach@52 | 11 |
* If applicable, add the following below the CDDL Header, with the fields |
jtulach@52 | 12 |
* enclosed by brackets [] replaced by your own identifying information: |
jtulach@52 | 13 |
* "Portions Copyrighted [year] [name of copyright owner]" |
jtulach@52 | 14 |
* |
jtulach@52 | 15 |
* The Original Software is NetBeans. The Initial Developer of the Original |
jtulach@52 | 16 |
* Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun |
jtulach@52 | 17 |
* Microsystems, Inc. All Rights Reserved. |
jtulach@52 | 18 |
*/ |
jtulach@52 | 19 |
|
jtulach@52 | 20 |
package org.netbeans.apifest.custom; |
jtulach@52 | 21 |
|
jtulach@52 | 22 |
import org.netbeans.apifest.boolcircuit.Circuit; |
jtulach@52 | 23 |
|
jtulach@52 | 24 |
/** |
jtulach@52 | 25 |
*/ |
jtulach@52 | 26 |
public class Gte extends Circuit{ |
jtulach@52 | 27 |
|
jtulach@52 | 28 |
private Circuit in1; |
jtulach@52 | 29 |
private Circuit in2; |
jtulach@52 | 30 |
|
jtulach@52 | 31 |
public Gte (Circuit in1, Circuit in2) { |
jtulach@52 | 32 |
if (in1 == null || in2 == null) |
jtulach@52 | 33 |
throw new IllegalArgumentException(); |
jtulach@52 | 34 |
this.in1 = in1; |
jtulach@52 | 35 |
this.in2 = in2; |
jtulach@52 | 36 |
} |
jtulach@52 | 37 |
|
jtulach@52 | 38 |
protected double doEvaluate(double... inputs) { |
jtulach@52 | 39 |
return (in1.evaluateFuzzy(inputs) >= in2.evaluateFuzzy(inputs))? 1.0: 0.0; |
jtulach@52 | 40 |
} |
jtulach@52 | 41 |
|
jtulach@52 | 42 |
public int maxInputs() { |
jtulach@52 | 43 |
return Math.max(in1.maxInputs(), in2.maxInputs()); |
jtulach@52 | 44 |
} |
jtulach@52 | 45 |
|
jtulach@52 | 46 |
} |