This repository was archived by the owner on Jul 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathL.java
More file actions
58 lines (47 loc) · 1.32 KB
/
Copy pathL.java
File metadata and controls
58 lines (47 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
public class L{
//two input and
public static boolean and2(boolean a, boolean b){
return (a && b);
}
//three input and
public static boolean and3(boolean a, boolean b, boolean c){
return (a && b && c);
}
//two input nand
public static boolean nand2(boolean a, boolean b){
return !(a && b);
}
//3 input nand
public static boolean nand3(boolean a, boolean b, boolean c){
return !(a && b && c);
}
//two input or
public static boolean or2(boolean a, boolean b){
return (a || b);
}
//three input or
public static boolean or3(boolean a, boolean b, boolean c){
return (a || b || c);
}
//two input nor
public static boolean nor2(boolean a, boolean b){
return !(a || b);
}
//three input nor
public static boolean nor3(boolean a, boolean b, boolean c){
return !(a || b || c);
}
//two input xor
public static boolean xor2(boolean a, boolean b){
return ((a && !b) || (!a && b));
}
//two input xnor
public static boolean xnor2(boolean a, boolean b){
return ((a && b) || (!a && !b));
}
//three input xor in xnor in future--maybe?
//inverter
public static boolean invert(boolean a){
return (!a);
}
}