protected override void Operar() { bool A, B, C; A = double.TryParse(Argumento, out number); B = Argumento.Equals(ArgDefecto); C = Argumento.Equals($"{ModuloCancelativo}"); if (C) { Result = "Math ERROR"; } else if (A) { double Arg = double.Parse(Argumento); if (Arg < 1) { Result = "Math ERROR"; } else { Result = $"{Math.Log(Arg)}"; } } else if (B) { Result = $"{ModuloCancelativo}"; } else { Result = new ProductoEntero(Coeficiente, Foco).Result; } }
public Boolean Agregar(Entidad po_Clase, Connection_Psg po_Conexion) { string sql3 = @"add_entidad"; po_Conexion.OpenConection(); List <Argumento> elements = new List <Argumento>(); Argumento argumento = new Argumento("id", po_Clase.Id.ToString()); elements.Add(argumento); Argumento argumento2 = new Argumento("nombre", po_Clase.Nombre.ToString()); elements.Add(argumento2); Argumento argumento3 = new Argumento("esvendedor", po_Clase.EsVendedor.ToString()); elements.Add(argumento3); Argumento argumento4 = new Argumento("escliente", po_Clase.EsCliente.ToString()); elements.Add(argumento4); Argumento argumento5 = new Argumento("escolaborador", po_Clase.EsColaborador.ToString()); elements.Add(argumento5); Argumento argumento6 = new Argumento("escliente", po_Clase.EsProveedor.ToString()); elements.Add(argumento6); po_Conexion.ExecuteQueries(sql3, elements); return(true); }
public Instruccion1Arg(params Argumento[] argumentos) { if (argumentos.Length != 1) { throw new ArgumentOutOfRangeException(); } argumento = argumentos[0]; }
public Instruccion2Arg(params Argumento[] argumentos) { if (argumentos.Length != 2) { throw new ArgumentOutOfRangeException(); } argumento1 = argumentos[0]; argumento2 = argumentos[1]; }
protected override void Operar() { bool A, B; A = double.TryParse(Argumento, out number); B = Argumento.Equals(ArgDefecto); if (A) { double Arg = double.Parse(Argumento); Result = $"{Math.Sin(Arg)}"; } else if (B) { Result = $"{Modulo}"; } else { Result = new ProductoEntero(Coeficiente, Foco).Result; } }
public static Instruccion DescodificarInstruccion(byte codigo, ushort pos) { Instruccion instruccion = null; ArgMemoria argumentoMemoria = Argumento.ConvertirEnArgumento((Main.ObtenerMemoria.ObtenerDireccion((ushort)(pos + 1)).Contenido * 256 + Main.ObtenerMemoria.ObtenerDireccion((ushort)(pos + 2)).Contenido).ToString("X4"), true) as ArgMemoria; ArgRegistro argumentoRegistro = Argumento.ConvertirEnArgumento(Main.ObtenerNombreRegistro(codigo % 4), false) as ArgRegistro; ArgLiteral argumentoLiteral = Argumento.ConvertirEnArgumento(Main.ObtenerMemoria.ObtenerDireccion((ushort)(pos + 1)).Contenido.ToString(), false) as ArgLiteral; switch (codigo / 8) { case 0: instruccion = new LD(argumentoRegistro); break; case 1: instruccion = new ST(argumentoRegistro); break; case 4: case 5: instruccion = new LDM(argumentoMemoria, argumentoRegistro); break; case 6: case 7: instruccion = new STM(argumentoRegistro, argumentoMemoria); break; case 2: case 3: instruccion = new LDI(argumentoLiteral, argumentoRegistro); break; case 8: instruccion = new ADD(argumentoRegistro); break; case 9: instruccion = new SUB(argumentoRegistro); break; case 10: instruccion = new CMP(argumentoRegistro); break; case 11: instruccion = new INC(); break; case 12: instruccion = new ADI(argumentoLiteral); break; case 13: instruccion = new SUI(argumentoLiteral); break; case 14: case 15: instruccion = new CMI(argumentoLiteral); break; case 16: instruccion = new ANA(argumentoRegistro); break; case 17: instruccion = new ORA(argumentoRegistro); break; case 18: instruccion = new XRA(argumentoRegistro); break; case 19: instruccion = new CMA(); break; case 20: instruccion = new ANI(argumentoLiteral); break; case 21: instruccion = new ORI(argumentoLiteral); break; case 22: case 23: instruccion = new XRI(argumentoLiteral); break; case 24: case 25: instruccion = new JMP(argumentoMemoria); break; case 26: instruccion = new BEQ(argumentoMemoria); break; case 27: instruccion = new BC(argumentoMemoria); break; case 28: case 29: instruccion = new LF(); break; case 30: instruccion = new IN(argumentoMemoria, argumentoRegistro); break; case 31: instruccion = new OUT(argumentoRegistro, argumentoMemoria); break; } return(instruccion); }
public static Instruccion ConvertirEnInstruccion(string[] instruccionArgumentos) { if (instruccionArgumentos.Length < 1) { throw new ArgumentOutOfRangeException(); } Instruccion _instruccion = null; string instruccion = instruccionArgumentos[0].ToUpperInvariant(); string[] argumentos = new string[instruccionArgumentos.Length - 1]; for (int i = 1; i < instruccionArgumentos.Length; i++) { argumentos[i - 1] = instruccionArgumentos[i]; } switch (instruccion) { case "STM": _instruccion = new STM(Argumento.ConvertirEnArgumento(argumentos, true, -1, 1)); break; case "LDM": _instruccion = new LDM(Argumento.ConvertirEnArgumento(argumentos, true, -1, 0)); break; case "LDI": _instruccion = new LDI(Argumento.ConvertirEnArgumento(argumentos, false, 0)); break; case "BEQ": _instruccion = new BEQ(Argumento.ConvertirEnArgumento(argumentos, true, -1, 0)); break; case "BC": _instruccion = new BC(Argumento.ConvertirEnArgumento(argumentos, true, -1, 0)); break; case "JMP": _instruccion = new JMP(Argumento.ConvertirEnArgumento(argumentos, true, -1, 0)); break; case "LD": _instruccion = new LD(Argumento.ConvertirEnArgumento(argumentos, false)); break; case "ST": _instruccion = new ST(Argumento.ConvertirEnArgumento(argumentos, false)); break; case "ADD": _instruccion = new ADD(Argumento.ConvertirEnArgumento(argumentos, false)); break; case "SUB": _instruccion = new SUB(Argumento.ConvertirEnArgumento(argumentos, false)); break; case "CMP": _instruccion = new CMP(Argumento.ConvertirEnArgumento(argumentos, false)); break; case "INC": _instruccion = new INC(Argumento.ConvertirEnArgumento(argumentos, false)); break; case "ADI": _instruccion = new ADI(Argumento.ConvertirEnArgumento(argumentos, false, 0)); break; case "SUI": _instruccion = new SUI(Argumento.ConvertirEnArgumento(argumentos, false, 0)); break; case "CMI": _instruccion = new CMI(Argumento.ConvertirEnArgumento(argumentos, false, 0)); break; case "ANA": _instruccion = new ANA(Argumento.ConvertirEnArgumento(argumentos, false)); break; case "ORA": _instruccion = new ORA(Argumento.ConvertirEnArgumento(argumentos, false)); break; case "XRA": _instruccion = new XRA(Argumento.ConvertirEnArgumento(argumentos, false)); break; case "CMA": _instruccion = new CMA(Argumento.ConvertirEnArgumento(argumentos, false)); break; case "ANI": _instruccion = new ANI(Argumento.ConvertirEnArgumento(argumentos, false, 0)); break; case "ORI": _instruccion = new ORI(Argumento.ConvertirEnArgumento(argumentos, false, 0)); break; case "XRI": _instruccion = new XRI(Argumento.ConvertirEnArgumento(argumentos, false, 0)); break; case "LF": _instruccion = new LF(Argumento.ConvertirEnArgumento(argumentos, false)); break; case "IN": _instruccion = new IN(Argumento.ConvertirEnArgumento(argumentos, true, -1, 0)); break; case "OUT": _instruccion = new OUT(Argumento.ConvertirEnArgumento(argumentos, true, -1, 1)); break; default: throw new ArgumentException(); } return(_instruccion); }