Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. package org.jonathanoliveira.logic_gates;
  2.  
  3. /*
  4. * All gates are made of components, no matter how many.
  5. * An AND gate must be able to receive a certain number of inputs and come out with the proper output.
  6. *
  7. * So, in essence, the behavior of an AND gate is the following:
  8. * if (ALL INPUTS): true, then OUTPUT == true
  9. * if (AT LEAST 1 INPUT): false, then OUTPUT == false
  10. *
  11. * AND | 0 | 1 |
  12. * --------------
  13. * 0 | 0 | 0 |
  14. * --------------
  15. * 1 | 0 | 1 |
  16. *
  17. * */
  18.  
  19. public class AND_Gate extends LinearWiredLogicGate {
  20.  
  21. public AND_Gate() {
  22. // sending to the constructor the proper component type that we want to use in an AND gate
  23. super(ComponentType.BUFFER);
  24. }
  25.  
  26. AND_Gate(int numInputs) {
  27. // sending the superclass constructor the component type that we want (buffer) and the number of buffers we want
  28. super(ComponentType.BUFFER, numInputs);
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement