Example #1
0
        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));
        }
Example #2
0
        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));
        }
Example #3
0
        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));
        }
Example #4
0
        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));
        }
Example #5
0
        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));
        }
Example #6
0
        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));
        }
Example #7
0
        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));
        }
Example #8
0
        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));
        }