samples/apifest1/day1/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 */
21 public static Input createSimpleBooleanInput(boolean value) {
22 return new BooleanInput(value);
26 * @throws IllegalArgument if the boolean operation was already used as input for another operation..
28 public static Input createOperationBasedBooleanInput(Operation op) throws IllegalArgumentException {
31 throw new IllegalArgumentException("Cannot use a single operation repeatedly.");
33 op.markOperationAsUsed();
34 return new OperationInput(op);
37 public static Operation createAndOperation(Input one, Input two) {
40 return new AndOperation(one, two);
43 public static Operation createOrOperation(Input one, Input two) {
46 return new OrOperation(one, two);
49 public static Operation createNotOperation(Input one) {
51 return new NotOperation(one);