public static Block Parse(XmlNode node, DFG <Block> dfg, ParserInfo parserInfo) { string id = ParseTools.ParseID(node); string output = ParseTools.ParseString(node, OUTPUT_FLUID_FIELD_NAME); Validator.CheckVariableName(id, output); parserInfo.AddVariable(id, VariableType.FLUID, output); XmlNode innerNode = node.GetInnerBlockNode(INPUT_FLUID_FIELD_NAME, parserInfo, new MissingBlockException(id, "Fluid is missing fluid definition blocks.")); if (innerNode != null) { switch (innerNode.GetAttributeValue(Block.TYPE_FIELD_NAME)) { case HeaterUsage.XML_TYPE_NAME: return(HeaterUsage.CreateHeater(output, innerNode, dfg, parserInfo)); case Mixer.XmlTypeName: return(Mixer.CreateMixer(output, innerNode, dfg, parserInfo)); case Union.XML_TYPE_NAME: return(Union.CreateUnion(output, innerNode, dfg, parserInfo)); default: return(CreateFluid(output, innerNode, dfg, parserInfo)); } } return(null); }
public static Block Parse(XmlNode node, ParserInfo parserInfo) { string id = ParseTools.ParseID(node); string moduleName = ParseTools.ParseString(node, MODULE_NAME_FIELD_NAME); parserInfo.AddVariable(id, VariableType.WASTE, moduleName); return(new WasteDeclaration(moduleName, parserInfo.GetUniqueAnonymousName(), id)); }
public static DropletDeclaration Parse(XmlNode node, ParserInfo parserInfo) { string id = ParseTools.ParseID(node); string output = ParseTools.ParseString(node, INPUT_FLUID_FIELD_NAME); parserInfo.AddVariable(id, VariableType.FLUID, output); return(new DropletDeclaration(output, id)); }
public static Block Parse(XmlNode node, ParserInfo parserInfo, bool canBeScheduled) { string id = ParseTools.ParseID(node); string arrayName = ParseTools.ParseString(node, ARRAY_NAME_FIELD_NAME); parserInfo.CheckVariable(id, new VariableType[] { VariableType.NUMBER_ARRAY, VariableType.FLUID_ARRAY }, arrayName); return(new GetArrayLength(arrayName, parserInfo.GetUniqueAnonymousName(), id, canBeScheduled)); }
public static Block Parse(XmlNode node, ParserInfo parserInfo, bool canBeScheduled) { string id = ParseTools.ParseID(node); string variableName = ParseTools.ParseString(node, VARIABLE_FIELD_NAME); parserInfo.CheckVariable(id, VariableType.NUMBER, variableName); return(new GetNumberVariable(variableName, parserInfo.GetUniqueAnonymousName(), id, canBeScheduled)); }
public static InputDeclaration Parse(XmlNode node, ParserInfo parserInfo) { string id = ParseTools.ParseID(node); float amount = ParseTools.ParseFloat(node, parserInfo, id, INPUT_AMOUNT_FIELD_NAME); string output = ParseTools.ParseString(node, INPUT_FLUID_FIELD_NAME); parserInfo.AddVariable(id, VariableType.FLUID, output); return(new InputDeclaration(output, amount, id)); }
public static Block Parse(XmlNode node, DFG <Block> dfg, ParserInfo parserInfo, bool canBeScheduled) { string id = ParseTools.ParseID(node); RoundOPTypes roundType = StringToRoundOPType(id, ParseTools.ParseString(node, OPTypeFieldName)); VariableBlock numberBlock = ParseTools.ParseBlock <VariableBlock>(node, dfg, parserInfo, id, NUMBER_FIELD_NAME, new MissingBlockException(id, "Number defining block is missing.")); dfg.AddNode(numberBlock); return(new RoundOP(numberBlock, parserInfo.GetUniqueAnonymousName(), roundType, id, canBeScheduled)); }
public static Block Parse(XmlNode node, DFG <Block> dfg, ParserInfo parserInfo) { string id = ParseTools.ParseID(node); string arrayName = ParseTools.ParseString(node, ARRAY_NAME_FIELD_NAME); parserInfo.AddVariable(id, VariableType.NUMBER_ARRAY, arrayName); VariableBlock arrayLengthBlock = ParseTools.ParseBlock <VariableBlock>(node, dfg, parserInfo, id, ARRAY_LENGTH_FIELD_NAME, new MissingBlockException(id, "Missing block which define the length of the array.")); dfg.AddNode(arrayLengthBlock); return(new NumberArray(arrayName, arrayLengthBlock, id)); }
public static Block Parse(XmlNode node, DFG <Block> dfg, ParserInfo parserInfo) { string id = ParseTools.ParseID(node); string output = ParseTools.ParseString(node, VARIABLE_FIELD_NAME); parserInfo.AddVariable(id, VariableType.NUMBER, output); VariableBlock operandBlock = ParseTools.ParseBlock <VariableBlock>(node, dfg, parserInfo, id, INPUT_VARIABLE_FIELD_NAME, new MissingBlockException(id, "Missing block to define the variables value.")); dfg.AddNode(operandBlock); return(new SetNumberVariable(operandBlock, output, id)); }
public static Block Parse(XmlNode node, DFG <Block> dfg, ParserInfo parserInfo, bool canBeScheduled) { string id = ParseTools.ParseID(node); string arrayName = ParseTools.ParseString(node, ARRAY_NAME_FIELD_NAME); parserInfo.CheckVariable(id, VariableType.NUMBER_ARRAY, arrayName); VariableBlock indexBlock = ParseTools.ParseBlock <VariableBlock>(node, dfg, parserInfo, id, INDEX_FIELD_NAME, new MissingBlockException(id, "Missing block which define the index into the array.")); dfg.AddNode(indexBlock); return(new GetArrayNumber(indexBlock, arrayName, parserInfo.GetUniqueAnonymousName(), id, canBeScheduled)); }
public static Block Parse(XmlNode node, DFG <Block> dfg, ParserInfo parserInfo, bool canBeScheduled) { string id = ParseTools.ParseID(node); BoolOPTypes opType = BoolOP.StringToBoolOPType(id, ParseTools.ParseString(node, OPTypeFieldName)); VariableBlock leftBoolBlock = ParseTools.ParseBlock <VariableBlock>(node, dfg, parserInfo, id, LeftBoolFieldName, new MissingBlockException(id, "Left side of boolean operator is missing a block.")); VariableBlock rightBoolBlock = ParseTools.ParseBlock <VariableBlock>(node, dfg, parserInfo, id, RightBoolFieldName, new MissingBlockException(id, "Right side of boolean operator is missing a block.")); dfg.AddNode(leftBoolBlock); dfg.AddNode(rightBoolBlock); return(new BoolOP(leftBoolBlock, rightBoolBlock, parserInfo.GetUniqueAnonymousName(), opType, id, canBeScheduled)); }
public static FluidInput Parse(XmlNode node, ParserInfo parserInfo, bool doVariableCheck = true) { string id = ParseTools.ParseID(node); string originalFluidName = ParseTools.ParseString(node, FLUID_NAME_FIELD_NAME); if (doVariableCheck) { parserInfo.CheckVariable(id, VariableType.FLUID, originalFluidName); } float amountInML = ParseTools.ParseFloat(node, parserInfo, id, FLUID_AMOUNT_FIELD_NAME); bool useAllFluid = FluidInput.StringToBool(ParseTools.ParseString(node, USE_ALL_FLUID_FIELD_NAME)); return(new BasicInput(id, originalFluidName, amountInML, useAllFluid)); }
public static WasteUsage Parse(XmlNode node, DFG <Block> dfg, ParserInfo parserInfo) { string id = ParseTools.ParseID(node); string moduleName = ParseTools.ParseString(node, MODULE_NAME_FIELD_NAME); parserInfo.CheckVariable(id, VariableType.WASTE, moduleName); FluidInput fluidInput = ParseTools.ParseFluidInput(node, dfg, parserInfo, id, INPUT_FLUID_FIELD_NAME, new MissingBlockException(id, "Waste is missing input fluid block.")); List <FluidInput> inputs = new List <FluidInput>(); inputs.Add(fluidInput); return(new WasteUsage(moduleName, inputs, null, id)); }
public static Block Parse(XmlNode node, DFG <Block> dfg, ParserInfo parserInfo, bool canBeScheduled) { string id = ParseTools.ParseID(node); string arrayName = ParseTools.ParseString(node, ARRAY_NAME_FIELD_NAME); parserInfo.CheckVariable(id, VariableType.NUMBER_ARRAY, arrayName); VariableBlock indexBlock = ParseTools.ParseBlock <VariableBlock>(node, dfg, parserInfo, id, INDEX_FIELD_NAME, new MissingBlockException(id, "Missing block to define the variables value.")); VariableBlock numberInput = ParseTools.ParseBlock <VariableBlock>(node, dfg, parserInfo, id, INPUT_NUMBER_FIELD_NAME, new MissingBlockException(id, "Mixer is missing input fluid block.")); dfg.AddNode(indexBlock); dfg.AddNode(numberInput); return(new SetArrayNumber(indexBlock, numberInput, arrayName, id, canBeScheduled)); }
public static Block CreateHeater(string output, XmlNode node, DFG <Block> dfg, ParserInfo parserInfo) { string id = ParseTools.ParseID(node); string moduleName = ParseTools.ParseString(node, MODULE_NAME_FIELD_NAME); parserInfo.CheckVariable(id, VariableType.HEATER, moduleName); int temperature = (int)ParseTools.ParseFloat(node, parserInfo, id, TEMPERATURE_FIELD_NAME); int time = (int)ParseTools.ParseFloat(node, parserInfo, id, TIME_FIELD_NAME); FluidInput fluidInput = ParseTools.ParseFluidInput(node, dfg, parserInfo, id, INPUT_FLUID_FIELD_NAME, new MissingBlockException(id, "Heater is missing input fluid block.")); List <FluidInput> inputs = new List <FluidInput>(); inputs.Add(fluidInput); return(new HeaterUsage(moduleName, inputs, output, temperature, time, id)); }
public static FluidInput Parse(XmlNode node, DFG <Block> dfg, ParserInfo parserInfo, bool doVariableCheck = true) { string id = ParseTools.ParseID(node); string arrayName = ParseTools.ParseString(node, ARRAY_NAME_FIELD_NAME); if (doVariableCheck) { parserInfo.CheckVariable(id, VariableType.FLUID_ARRAY, arrayName); } float amountInML = ParseTools.ParseFloat(node, parserInfo, id, FLUID_AMOUNT_FIELD_NAME); bool useAllFluid = FluidInput.StringToBool(ParseTools.ParseString(node, USE_ALL_FLUID_FIELD_NAME)); VariableBlock indexBlock = ParseTools.ParseBlock <VariableBlock>(node, dfg, parserInfo, id, INDEX_FIELD_NAME, new MissingBlockException(id, "Missing block which define the index into the array.")); dfg.AddNode(indexBlock); return(new GetArrayFluid(indexBlock, arrayName, id, amountInML, useAllFluid)); }
public static Block Parse(XmlNode node, DFG <Block> dfg, ParserInfo parserInfo) { string id = ParseTools.ParseID(node); string arrayName = ParseTools.ParseString(node, ARRAY_NAME_FIELD_NAME); parserInfo.CheckVariable(id, VariableType.FLUID_ARRAY, arrayName); VariableBlock indexBlock = ParseTools.ParseBlock <VariableBlock>(node, dfg, parserInfo, id, INDEX_FIELD_NAME, new MissingBlockException(id, "Missing block to define the index.")); FluidInput fluidInput = ParseTools.ParseFluidInput(node, dfg, parserInfo, id, INPUT_FLUID_FIELD_NAME, new MissingBlockException(id, "Missing input fluid block.")); dfg.AddNode(indexBlock); List <FluidInput> inputFluids = new List <FluidInput>(); inputFluids.Add(fluidInput); return(new SetArrayFluid(indexBlock, arrayName, inputFluids, id)); }