示例#1
0
        public override DataType DetermineDataTypeOfResult(MathOperationDefinition theDefinition, TestExecution testExecution)
        {
            BasicMathOperationDefinition theMoreSpecificDef = (BasicMathOperationDefinition)theDefinition;

            bool foundDecimalNumber = false;
            bool foundIntegerNumber = false;
            bool foundBooleanValue  = false;

            foreach (DataValueDefinition num in theMoreSpecificDef.ValueObjects)
            {
                DataValueInstance value = testExecution.DataValueRegistry.GetObject(num.Name);
                ValueObjects.Add(value);
                switch (value.Type)
                {
                case DataType.DecimalNumber:
                    foundDecimalNumber = true;
                    break;

                case DataType.IntegerNumber:
                    foundIntegerNumber = true;
                    break;

                case DataType.Boolean:
                    foundBooleanValue = true;
                    break;

                case DataType.NotDefined:
                    throw new ArgumentException("Type not defined for '" + value.Name + "'.");
                    break;

                default:
                    throw new ArgumentException("Type " + value.Type + " not supported by the basic math operation definition object.");
                }
            }
            if (foundDecimalNumber)
            {
                return(DataType.DecimalNumber);
                //                mDataType = DataType.DecimalNumber;
            }
            else if (foundIntegerNumber)
            {
                return(DataType.IntegerNumber);
                //                Result.SetType(DataType.IntegerNumber);
                //                mDataType = DataType.IntegerNumber;
            }
            else if (foundBooleanValue)
            {
                return(DataType.Boolean);
                //                Result.SetType(DataType.Boolean);
                //                mDataType = DataType.Boolean;
            }
            throw new ArgumentException("Data type of math operation result can't be determined.");
        }
示例#2
0
 public CircleROIInstance(CircleROIDefinition theDefinition, TestExecution theExecution)
     : base(theDefinition, theExecution)
 {
     if (theDefinition.CenterX == null)
     {
         throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to CenterX");
     }
     if (theDefinition.CenterY == null)
     {
         throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to CenterY");
     }
     if (theDefinition.Radius == null)
     {
         throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to Radius");
     }
     centerX = theExecution.DataValueRegistry.GetObject(theDefinition.CenterX.Name);
     centerY = theExecution.DataValueRegistry.GetObject(theDefinition.CenterY.Name);
     radius  = theExecution.DataValueRegistry.GetObject(theDefinition.Radius.Name);
     color   = theDefinition.Color;
 }
        public RectangleROIByEdgesInstance(RectangleROIByEdgesDefinition theDefinition, TestExecution theExecution)
            : base(theDefinition, theExecution)
        {
            if (theDefinition.Top == null)
            {
                throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to Top");
            }
            if (theDefinition.Bottom == null)
            {
                throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to Bottom");
            }
            if (theDefinition.Left == null)
            {
                throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to Left");
            }
            if (theDefinition.Right == null)
            {
                throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to Right");
            }
            top    = theExecution.DataValueRegistry.GetObject(theDefinition.Top.Name);
            bottom = theExecution.DataValueRegistry.GetObject(theDefinition.Bottom.Name);
            left   = theExecution.DataValueRegistry.GetObject(theDefinition.Left.Name);
            right  = theExecution.DataValueRegistry.GetObject(theDefinition.Right.Name);

            if (theDefinition.TopPadding != null)
            {
                topPadding = theExecution.DataValueRegistry.GetObject(theDefinition.TopPadding.Name);
            }
            if (theDefinition.BottomPadding != null)
            {
                bottomPadding = theExecution.DataValueRegistry.GetObject(theDefinition.BottomPadding.Name);
            }
            if (theDefinition.LeftPadding != null)
            {
                leftPadding = theExecution.DataValueRegistry.GetObject(theDefinition.LeftPadding.Name);
            }
            if (theDefinition.RightPadding != null)
            {
                rightPadding = theExecution.DataValueRegistry.GetObject(theDefinition.RightPadding.Name);
            }
        }
示例#4
0
 public RectangleROIByCenterInstance(RectangleROIByCenterDefinition theDefinition, TestExecution theExecution)
     : base(theDefinition, theExecution)
 {
     if (theDefinition.Center_Y == null)
     {
         throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to Center_Y");
     }
     if (theDefinition.Height == null)
     {
         throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to Height");
     }
     if (theDefinition.Center_X == null)
     {
         throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to Center_X");
     }
     if (theDefinition.Width == null)
     {
         throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to Width");
     }
     mCenter_Y = theExecution.DataValueRegistry.GetObject(theDefinition.Center_Y.Name);
     mHeight   = theExecution.DataValueRegistry.GetObject(theDefinition.Height.Name);
     mCenter_X = theExecution.DataValueRegistry.GetObject(theDefinition.Center_X.Name);
     mWidth    = theExecution.DataValueRegistry.GetObject(theDefinition.Width.Name);
 }
示例#5
0
        public RectangleROIInstance(RectangleROIDefinition theDefinition, TestExecution theExecution)
            : base(theDefinition, theExecution)
        {
            // TODO: support Top+Height or Bottom+Height
            if (theDefinition.Top != null || theDefinition.Bottom != null)
            {
                if (theDefinition.Top == null)
                {
                    throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to Top");
                }
                if (theDefinition.Bottom == null)
                {
                    throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to Bottom");
                }
                mTop    = theExecution.DataValueRegistry.GetObject(theDefinition.Top.Name);
                mBottom = theExecution.DataValueRegistry.GetObject(theDefinition.Bottom.Name);
            }
            else if (theDefinition.Center_Y != null || theDefinition.Height != null)
            {
                if (theDefinition.Center_Y == null)
                {
                    throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to Center_Y");
                }
                if (theDefinition.Height == null)
                {
                    throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to Height");
                }
                mCenter_Y = theExecution.DataValueRegistry.GetObject(theDefinition.Center_Y.Name);
                mHeight   = theExecution.DataValueRegistry.GetObject(theDefinition.Height.Name);
            }
            else
            {
                throw new ArgumentException("ROI '" + theDefinition.Name + "' has no Y-axis location settings");
            }

            if (theDefinition.Left != null || theDefinition.Right != null)
            {
                if (theDefinition.Left == null)
                {
                    throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to Left");
                }
                if (theDefinition.Right == null)
                {
                    throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to Right");
                }
                mLeft  = theExecution.DataValueRegistry.GetObject(theDefinition.Left.Name);
                mRight = theExecution.DataValueRegistry.GetObject(theDefinition.Right.Name);
            }
            else if (theDefinition.Center_X != null || theDefinition.Width != null)
            {
                if (theDefinition.Center_X == null)
                {
                    throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to Center_X");
                }
                if (theDefinition.Width == null)
                {
                    throw new ArgumentException("ROI '" + theDefinition.Name + "' doesn't have a value assigned to Width");
                }
                mCenter_X = theExecution.DataValueRegistry.GetObject(theDefinition.Center_X.Name);
                mWidth    = theExecution.DataValueRegistry.GetObject(theDefinition.Width.Name);
            }
            else
            {
                throw new ArgumentException("ROI '" + theDefinition.Name + "' has no X-axis location settings");
            }

            if (theDefinition.TopPadding != null)
            {
                mTopPadding = theExecution.DataValueRegistry.GetObject(theDefinition.TopPadding.Name);
            }
            if (theDefinition.BottomPadding != null)
            {
                mBottomPadding = theExecution.DataValueRegistry.GetObject(theDefinition.BottomPadding.Name);
            }
            if (theDefinition.LeftPadding != null)
            {
                mLeftPadding = theExecution.DataValueRegistry.GetObject(theDefinition.LeftPadding.Name);
            }
            if (theDefinition.RightPadding != null)
            {
                mRightPadding = theExecution.DataValueRegistry.GetObject(theDefinition.RightPadding.Name);
            }
        }