示例#1
0
        public Boolean IsValid()
        {
            if (!ScanConstraint.IsValuedConstraint(this.Constraint))
            {
                return(true);
            }

            return(this.ConstraintValue != null);
        }
示例#2
0
        /// <summary>
        /// Determines if this constraint conflicts with another constraint.
        /// </summary>
        /// <param name="other">The other scan constraint.</param>
        /// <returns>True if the constraints conflict, otherwise false.</returns>
        public Boolean ConflictsWith(ScanConstraint other)
        {
            if (this.Constraint == other.Constraint)
            {
                return(true);
            }

            if (ScanConstraint.IsRelativeConstraint(this.Constraint) && ScanConstraint.IsRelativeConstraint(other.Constraint))
            {
                return(true);
            }

            if (ScanConstraint.IsValuedConstraint(this.Constraint) && ScanConstraint.IsValuedConstraint(other.Constraint))
            {
                if (!ScanConstraint.IsRelativeConstraint(this.Constraint) && !ScanConstraint.IsRelativeConstraint(other.Constraint))
                {
                    if ((this.Constraint == ConstraintType.LessThan || this.Constraint == ConstraintType.LessThanOrEqual || this.Constraint == ConstraintType.NotEqual) &&
                        (other.Constraint == ConstraintType.GreaterThan || other.Constraint == ConstraintType.GreaterThanOrEqual || other.Constraint == ConstraintType.NotEqual))
                    {
                        if ((dynamic)this.ConstraintValue <= (dynamic)other.ConstraintValue)
                        {
                            return(true);
                        }

                        return(false);
                    }

                    if ((this.Constraint == ConstraintType.GreaterThan || this.Constraint == ConstraintType.GreaterThanOrEqual || this.Constraint == ConstraintType.NotEqual) &&
                        (other.Constraint == ConstraintType.LessThan || other.Constraint == ConstraintType.LessThanOrEqual || other.Constraint == ConstraintType.NotEqual))
                    {
                        if ((dynamic)this.ConstraintValue >= (dynamic)other.ConstraintValue)
                        {
                            return(true);
                        }

                        return(false);
                    }

                    return(true);
                }
            }

            return(false);
        }
示例#3
0
        /// <summary>
        /// Determines if this constraint conflicts with another constraint.
        /// </summary>
        /// <param name="scanConstraint">The other scan constraint.</param>
        /// <returns>True if the constraints conflict, otherwise false.</returns>
        public Boolean ConflictsWith(ScanConstraint scanConstraint)
        {
            if (this.Constraint == scanConstraint.Constraint)
            {
                return(true);
            }

            if (this.IsRelativeConstraint() && scanConstraint.IsRelativeConstraint())
            {
                return(true);
            }

            if (this.IsValuedConstraint() && scanConstraint.IsValuedConstraint())
            {
                if (!this.IsRelativeConstraint() && !scanConstraint.IsRelativeConstraint())
                {
                    if ((this.Constraint == ConstraintsEnum.LessThan || this.Constraint == ConstraintsEnum.LessThanOrEqual || this.Constraint == ConstraintsEnum.NotEqual) &&
                        (scanConstraint.Constraint == ConstraintsEnum.GreaterThan || scanConstraint.Constraint == ConstraintsEnum.GreaterThanOrEqual || scanConstraint.Constraint == ConstraintsEnum.NotEqual))
                    {
                        if ((dynamic)this.ConstraintValue <= (dynamic)scanConstraint.ConstraintValue)
                        {
                            return(true);
                        }

                        return(false);
                    }

                    if ((this.Constraint == ConstraintsEnum.GreaterThan || this.Constraint == ConstraintsEnum.GreaterThanOrEqual || this.Constraint == ConstraintsEnum.NotEqual) &&
                        (scanConstraint.Constraint == ConstraintsEnum.LessThan || scanConstraint.Constraint == ConstraintsEnum.LessThanOrEqual || scanConstraint.Constraint == ConstraintsEnum.NotEqual))
                    {
                        if ((dynamic)this.ConstraintValue >= (dynamic)scanConstraint.ConstraintValue)
                        {
                            return(true);
                        }

                        return(false);
                    }

                    return(true);
                }
            }

            return(false);
        }