protected static Gate GenerateGate(string type) { Gate gate = null; if (type.Equals("AND", StringComparison.OrdinalIgnoreCase)) { gate = new AndGate(); } else if (type.Equals("OR", StringComparison.OrdinalIgnoreCase)) { gate = new OrGate(); } else if (type.Equals("NOT", StringComparison.OrdinalIgnoreCase)) { gate = new NotGate(); } else if (type.Equals("XOR", StringComparison.OrdinalIgnoreCase)) { gate = new XorGate(); } else if (type.Equals("NAND", StringComparison.OrdinalIgnoreCase)) { gate = new NandGate(); } else if (type.Equals("NOR", StringComparison.OrdinalIgnoreCase)) { gate = new NorGate(); } else if (type.Equals("BUFFER", StringComparison.OrdinalIgnoreCase)) { gate = new BufferGate(); } else if (type.Equals("OUTPUT", StringComparison.OrdinalIgnoreCase)) { gate = new OutputOnlyGate(); } else if (type.Equals("TRUE", StringComparison.OrdinalIgnoreCase)) { gate = new AlwaysTrueGate(); } else if (type.Equals("FALSE", StringComparison.OrdinalIgnoreCase)) { gate = new AlwaysFalseGate(); } else if (type.Equals("INPUT", StringComparison.OrdinalIgnoreCase)) { gate = new InputOnlyGate(); } else if (type.Equals("CLOCK", StringComparison.OrdinalIgnoreCase)) { gate = new ClockGate(); } return(gate); }
public override Gate Clone() { Gate clone_gate = new NorGate(); return(clone_gate); }