Пример #1
0
        public string AddRoundBlock(RoundOPTypes roundType, string inputBlockName)
        {
            string a = GetUniqueName();

            AddBlock(a, RoundOP.XML_TYPE_NAME);
            SetField(a, RoundOP.OPTypeFieldName, RoundOP.RoundOpTypeToString(roundType));
            AddConnection(a, RoundOP.NUMBER_FIELD_NAME, inputBlockName);

            return(a);
        }
Пример #2
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));
        }
Пример #3
0
        public static string RoundOpTypeToString(RoundOPTypes type)
        {
            switch (type)
            {
            case RoundOPTypes.ROUND:
                return("ROUND");

            case RoundOPTypes.ROUNDDOWN:
                return("ROUNDDOWN");

            case RoundOPTypes.ROUNDUP:
                return("ROUNDUP");

            default:
                throw new InternalParseException("Failed to parse the round operator type. Type: " + type.ToString());
            }
        }
Пример #4
0
 public RoundOP(VariableBlock numberBlock, string output, RoundOPTypes roundType, string id, bool canBeScheduled) :
     base(false, null, new List <string>() { numberBlock?.OutputVariable }, output, id, canBeScheduled)
 {
     this.NumberBlock = numberBlock;
     this.RoundType   = roundType;
 }