samples/apifest1/day2/inputandoperation/src/org/netbeans/apifest/boolcircuit/Factory.java
Adding samples from API fest to the repository, including pieces of their code in the document, not just links
4 * Created on July 12, 2006, 2:21 PM
6 * To change this template, choose Tools | Template Manager
7 * and open the template in the editor.
10 package org.netbeans.apifest.boolcircuit;
15 public class Factory {
17 /** Creates a new instance of Factory */
22 * @deprecated use for constants only.. use VariableInput instead..
24 public static Input createSimpleBooleanInput(boolean value) {
25 return new BooleanInput(value);
28 public static VariableInput createVariableInput() {
29 return new VariableInput();
32 * @throws IllegalArgument if the boolean operation was already used as input for another operation..
35 public static Input createOperationBasedBooleanInput(Operation op) throws IllegalArgumentException {
38 throw new IllegalArgumentException("Cannot use a single operation repeatedly.");
40 op.markOperationAsUsed();
41 return new OperationInput(op);
45 * WTF, just make another reasonable sounding factory method now that we have reals..
48 public static Input createOperationBasedInput(Operation op) throws IllegalArgumentException {
49 return createOperationBasedBooleanInput(op);
52 public static Operation createAndOperation(Input one, Input two) {
55 return new AndOperation(one, two);
58 public static Operation createOrOperation(Input one, Input two) {
61 return new OrOperation(one, two);
64 public static Operation createNotOperation(Input one) {
66 return new NotOperation(one);