Beispiel #1
0
        public static string BoolOpTypeToString(BoolOPTypes type)
        {
            switch (type)
            {
            case BoolOPTypes.EQ:
                return("EQ");

            case BoolOPTypes.NEQ:
                return("NEQ");

            case BoolOPTypes.LT:
                return("LT");

            case BoolOPTypes.LTE:
                return("LTE");

            case BoolOPTypes.GT:
                return("GT");

            case BoolOPTypes.GTE:
                return("GTE");

            default:
                throw new InternalParseException("Failed to parse the boolean operator type. Type: " + type.ToString());
            }
        }
Beispiel #2
0
 public BoolOP(VariableBlock leftBlock, VariableBlock rightBlock, string output, BoolOPTypes opType, string id, bool canBeScheduled) :
     base(false, null, new List <string>() { leftBlock?.OutputVariable, rightBlock?.OutputVariable }, output, id, canBeScheduled)
 {
     this.OPType     = opType;
     this.LeftBlock  = leftBlock;
     this.RightBlock = rightBlock;
 }
Beispiel #3
0
        public string AddBoolOPBlock(BoolOPTypes type, string leftBlock, string rightBlock)
        {
            string a = GetUniqueName();

            AddBlock(a, BoolOP.XML_TYPE_NAME);
            SetField(a, BoolOP.OPTypeFieldName, BoolOP.BoolOpTypeToString(type));
            AddConnection(a, BoolOP.LeftBoolFieldName, leftBlock);
            AddConnection(a, BoolOP.RightBoolFieldName, rightBlock);

            return(a);
        }
Beispiel #4
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));
        }