コード例 #1
0
 internal static bool CompileTimeCompare(object x, object y, RelationOperator op)
 {
     if (x is string)
     {
         if (y is double)
         {
             return(Compare((string)x, (double)y, op));
         }
         if (y is string)
         {
             return(Compare((string)x, (string)y, op));
         }
     }
     else if (x is double)
     {
         if (y is double)
         {
             return(Compare((double)x, (double)y, op));
         }
         if (y is string)
         {
             return(Compare((double)x, (string)y, op));
         }
     }
     throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new QueryCompileException(QueryCompileError.InvalidComparison));
 }
コード例 #2
0
        internal static bool Compare(double x, double y, RelationOperator op)
        {
            switch (op)
            {
            default:
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperCritical(new QueryProcessingException(QueryProcessingError.TypeMismatch));

            case RelationOperator.Eq:
                return(x == y);

            case RelationOperator.Ge:
                return(x >= y);

            case RelationOperator.Gt:
                return(x > y);

            case RelationOperator.Le:
                return(x <= y);

            case RelationOperator.Lt:
                return(x < y);

            case RelationOperator.Ne:
                return(x != y);
            }
        }
コード例 #3
0
        static bool VersionCompare(Version l,
                                   float r,
                                   RelationOperator op)
        {
            switch (op)
            {
            case RelationOperator.Equal:
                return(l.Major == r && l.Minor == 0 && l.Build == 0 && l.Revision == 0);

            case RelationOperator.NotEqual:
                return(l.Major != r || l.Minor != 0 && l.Build != 0 || l.Revision != 0);

            case RelationOperator.Less:
                return(l.Major != r ? l.Major < r : false);

            case RelationOperator.Greater:
                return(l.Major != r ? l.Major > r : true);

            case RelationOperator.LessOrEqual:
                return(l.Major != r ? l.Major <= r : false);

            case RelationOperator.GreaterOrEqual:
                return(l.Major != r ? l.Major >= r : true);

            default:
                throw new NotSupportedException($"Relational operator {op} is not supported.");
            }
        }
コード例 #4
0
        static bool VersionCompare(float l,
                                   Version r,
                                   RelationOperator op)
        {
            switch (op)
            {
            case RelationOperator.Equal:
                return(r.Major == l && r.Minor == 0 && r.Build == 0 && r.Revision == 0);

            case RelationOperator.NotEqual:
                return(r.Major != l || r.Minor != 0 && r.Build != 0 || r.Revision != 0);

            case RelationOperator.Less:
                return(r.Major != l ? l < r.Major : true);

            case RelationOperator.Greater:
                return(r.Major != l ? l > r.Major : false);

            case RelationOperator.LessOrEqual:
                return(r.Major != l ? l <= r.Major : true);

            case RelationOperator.GreaterOrEqual:
                return(r.Major != l ? l >= r.Major : false);

            default:
                throw new NotSupportedException($"Relational operator {op} is not supported.");
            }
        }
コード例 #5
0
        // Converts expressions of the form:
        // x < 5 => -infinity <= x and x < 5
        // x <= 5 => -infinity <= x and x <= 5
        // x > 5 => 5 < x <= infinity
        // x >= 5 => 5 <= x <= infinity
        //
        // The variable is always to the left
        internal Interval(double literal, RelationOperator op)
        {
            this.lowerBound = double.MinValue;
            this.upperBound = double.MaxValue;
            this.lowerOp = IntervalOp.LessThanEquals;
            this.upperOp = IntervalOp.LessThanEquals;

            Fx.Assert(RelationOperator.Eq != op && RelationOperator.Ne != op, "");
            switch (op)
            {
                case RelationOperator.Lt:
                    this.upperBound = literal;
                    this.upperOp = IntervalOp.LessThan;
                    break;
                case RelationOperator.Le:
                    this.upperBound = literal;
                    break;
                case RelationOperator.Gt:
                    this.lowerBound = literal;
                    this.lowerOp = IntervalOp.LessThan;
                    break;
                case RelationOperator.Ge:
                    this.lowerBound = literal;
                    break;
            }
        }
        static bool NumberCompare(float l,
                                  float r,
                                  RelationOperator op)
        {
            IComparer comparer = CaseInsensitiveComparer.DefaultInvariant;

            switch (op)
            {
            case RelationOperator.Equal:
                return(comparer.Compare(l, r) == 0);

            case RelationOperator.NotEqual:
                return(comparer.Compare(l, r) != 0);

            case RelationOperator.Greater:
                return(comparer.Compare(l, r) > 0);

            case RelationOperator.GreaterOrEqual:
                return(comparer.Compare(l, r) >= 0);

            case RelationOperator.Less:
                return(comparer.Compare(l, r) < 0);

            case RelationOperator.LessOrEqual:
                return(comparer.Compare(l, r) <= 0);

            default:
                throw new NotSupportedException(String.Format("Relational operator {0} is not supported.", op));
            }
        }
コード例 #7
0
        static bool NumberCompare(float l,
                                  float r,
                                  RelationOperator op)
        {
            switch (op)
            {
            case RelationOperator.Equal:
                return(l == r);

            case RelationOperator.NotEqual:
                return(l != r);

            case RelationOperator.Greater:
                return(l > r);

            case RelationOperator.GreaterOrEqual:
                return(l >= r);

            case RelationOperator.Less:
                return(l < r);

            case RelationOperator.LessOrEqual:
                return(l <= r);

            default:
                throw new NotSupportedException(String.Format("Relational operator {0} is not supported.", op));
            }
        }
コード例 #8
0
        // see https://github.com/Microsoft/msbuild/blob/03d1435c95e6a85fbf949f94958e743bc44c4186/src/Build/Evaluation/Conditionals/NumericComparisonExpressionNode.cs#L42
        static bool VersionCompare(Version l,
                                   Version r,
                                   RelationOperator op)
        {
            switch (op)
            {
            case RelationOperator.Equal:
                return(l == r);

            case RelationOperator.NotEqual:
                return(l != r);

            case RelationOperator.Less:
                return(l < r);

            case RelationOperator.Greater:
                return(l > r);

            case RelationOperator.LessOrEqual:
                return(l <= r);

            case RelationOperator.GreaterOrEqual:
                return(l >= r);

            default:
                throw new NotSupportedException($"Relational operator {op} is not supported.");
            }
        }
コード例 #9
0
ファイル: QueryIntervalOp.cs プロジェクト: dox0/DotNet471RS3
        // Converts expressions of the form:
        // x < 5 => -infinity <= x and x < 5
        // x <= 5 => -infinity <= x and x <= 5
        // x > 5 => 5 < x <= infinity
        // x >= 5 => 5 <= x <= infinity
        //
        // The variable is always to the left
        internal Interval(double literal, RelationOperator op)
        {
            this.lowerBound = double.MinValue;
            this.upperBound = double.MaxValue;
            this.lowerOp    = IntervalOp.LessThanEquals;
            this.upperOp    = IntervalOp.LessThanEquals;

            Fx.Assert(RelationOperator.Eq != op && RelationOperator.Ne != op, "");
            switch (op)
            {
            case RelationOperator.Lt:
                this.upperBound = literal;
                this.upperOp    = IntervalOp.LessThan;
                break;

            case RelationOperator.Le:
                this.upperBound = literal;
                break;

            case RelationOperator.Gt:
                this.lowerBound = literal;
                this.lowerOp    = IntervalOp.LessThan;
                break;

            case RelationOperator.Ge:
                this.lowerBound = literal;
                break;
            }
        }
コード例 #10
0
 public RelationInfo(ALine myAline)
 {
     InitializeComponent();
     this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
     relationName       = myAline.Text;
     relationdata       = RelationOperator.LoadRelationInfo();
     ShowInfo();
 }
コード例 #11
0
		public ConditionRelationalExpression (ConditionExpression left,
						      ConditionExpression right,
						      RelationOperator op)
		{
			this.left = left;
			this.right = right;
			this.op = op;
		}
コード例 #12
0
 public ConditionRelationalExpression(ConditionExpression left,
                                      ConditionExpression right,
                                      RelationOperator op)
 {
     this.left  = left;
     this.right = right;
     this.op    = op;
 }
コード例 #13
0
ファイル: QueryNode.cs プロジェクト: longde123/playscript
 internal bool Compare(ref NodeSequenceItem item, RelationOperator op)
 {
     for (int i = 0; i < this.count; ++i)
     {
         if (this.items[i].Compare(ref item, op))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #14
0
 internal bool Compare(NodeSequence sequence, RelationOperator op)
 {
     for (int i = 0; i < sequence.count; i++)
     {
         if (this.Compare(ref sequence.items[i], op))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #15
0
 //显示选中模块的关系
 private void btnSelected_Click(object sender, EventArgs e)
 {
     if (IsModuleChecked())
     {
         GetModulesList();
         relation = new RelationData();
         relation = RelationOperator.GetRelationInfoForImport(selectModule);
         dgv_importRelation.AutoGenerateColumns = false;
         dgv_importRelation.DataSource          = relation.Tables[RelationData.RELATION_TABLE].DefaultView;
     }
 }
コード例 #16
0
ファイル: QueryNode.cs プロジェクト: longde123/playscript
 internal bool Compare(double val, RelationOperator op)
 {
     for (int i = 0; i < this.count; ++i)
     {
         if (this.items[i].Compare(val, op))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #17
0
        internal static bool Compare(bool x, string y, RelationOperator op)
        {
            switch (op)
            {
            case RelationOperator.Eq:
                return(x == Boolean(y));

            case RelationOperator.Ne:
                return(x != Boolean(y));
            }
            return(Compare(Double(x), Double(y), op));
        }
コード例 #18
0
        internal static bool Compare(double x, bool y, RelationOperator op)
        {
            switch (op)
            {
            case RelationOperator.Eq:
                return(Boolean(x) == y);

            case RelationOperator.Ne:
                return(Boolean(x) != y);
            }
            return(Compare(x, Double(y), op));
        }
コード例 #19
0
        internal static bool Compare(double x, bool y, RelationOperator op)
        {
            switch (op)
            {
                case RelationOperator.Eq:
                    return (Boolean(x) == y);

                case RelationOperator.Ne:
                    return (Boolean(x) != y);
            }
            return Compare(x, Double(y), op);
        }
コード例 #20
0
        internal static bool Compare(bool x, bool y, RelationOperator op)
        {
            switch (op)
            {
                case RelationOperator.Eq:
                    return (x == y);

                case RelationOperator.Ne:
                    return (x != y);
            }
            return Compare(Double(x), Double(y), op);
        }
コード例 #21
0
        internal static bool Compare(bool x, string y, RelationOperator op)
        {
            switch (op)
            {
                case RelationOperator.Eq:
                    return (x == Boolean(y));

                case RelationOperator.Ne:
                    return (x != Boolean(y));
            }
            return Compare(Double(x), Double(y), op);
        }
コード例 #22
0
ファイル: QueryNode.cs プロジェクト: longde123/playscript
 internal bool Compare(NodeSequence sequence, RelationOperator op)
 {
     Fx.Assert(null != sequence, "");
     for (int i = 0; i < sequence.count; ++i)
     {
         if (this.Compare(ref sequence.items[i], op))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #23
0
ファイル: QueryNode.cs プロジェクト: longde123/playscript
 internal bool Compare(string val, RelationOperator op)
 {
     Fx.Assert(null != val, "");
     for (int i = 0; i < this.count; ++i)
     {
         if (this.items[i].Compare(val, op))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #24
0
        internal static bool Compare(bool x, double y, RelationOperator op)
        {
            switch (op)
            {
            default:
                return(QueryValueModel.Compare(QueryValueModel.Double(x), y, op));

            case RelationOperator.Eq:
                return(x == QueryValueModel.Boolean(y));

            case RelationOperator.Ne:
                return(x != QueryValueModel.Boolean(y));
            }
        }
コード例 #25
0
        internal static bool Compare(double x, bool y, RelationOperator op)
        {
            switch (op)
            {
            default:
                return(QueryValueModel.Compare(x, QueryValueModel.Double(y), op));

            case RelationOperator.Eq:
                return(QueryValueModel.Boolean(x) == y);

            case RelationOperator.Ne:
                return(QueryValueModel.Boolean(x) != y);
            }
        }
コード例 #26
0
        internal static bool Compare(string x, bool y, RelationOperator op)
        {
            Fx.Assert(null != x, "");
            switch (op)
            {
            default:
                return(QueryValueModel.Compare(QueryValueModel.Double(x), QueryValueModel.Double(y), op));

            case RelationOperator.Eq:
                return(y == QueryValueModel.Boolean(x));

            case RelationOperator.Ne:
                return(y != QueryValueModel.Boolean(x));
            }
        }
コード例 #27
0
        static bool BoolCompare(bool l,
                                bool r,
                                RelationOperator op)
        {
            switch (op)
            {
            case RelationOperator.Equal:
                return(l == r);

            case RelationOperator.NotEqual:
                return(l != r);

            default:
                throw new NotSupportedException(String.Format("Relational operator {0} is not supported.", op));
            }
        }
コード例 #28
0
        static bool StringCompare(string l,
                                  string r,
                                  RelationOperator op)
        {
            switch (op)
            {
            case RelationOperator.Equal:
                return(string.Equals(l, r, StringComparison.OrdinalIgnoreCase));

            case RelationOperator.NotEqual:
                return(!string.Equals(l, r, StringComparison.OrdinalIgnoreCase));

            default:
                throw new NotSupportedException(String.Format("Relational operator {0} is not supported.", op));
            }
        }
コード例 #29
0
ファイル: Parser.cs プロジェクト: alikhil/expression-parser
        private Expression ParseRelation()
        {
            Expression       term  = ParseTerm();
            RelationOperator relOp = ParseRelationOperator();

            if (relOp != RelationOperator.None)
            {
                var right = ParseTerm();
                if (right == null)
                {
                    throw new ParsingException(ErrorKind.Relation, Seek, GetNextChar());
                }
                return(new Relation(relOp, term, right));
            }
            return(term);
        }
コード例 #30
0
ファイル: Relation.cs プロジェクト: leolzc7/CloudMapSystem
        //删除关系
        private void btnDelete_Click(object sender, EventArgs e)
        {
            pageStatus = RecordStatus.View;
            SetFormControlerStatus();
            SetFormControlerData();

            if (MessageBox.Show("您确定要删除所选系统吗?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
            {
                selectSource = dataGridView_relation.CurrentRow.Cells[1].Value.ToString();
                selectTarget = dataGridView_relation.CurrentRow.Cells[2].Value.ToString();
                if (RelationOperator.DeleteRelationInfo(selectSource, selectTarget))
                {
                    RelationEditForm_Load(sender, e);
                }
            }
            else
            {
                selectSource = dataGridView_relation.CurrentRow.Cells[1].Value.ToString();
                selectTarget = dataGridView_relation.CurrentRow.Cells[2].Value.ToString();
                DataRow dr = relationdata.Tables[RelationData.RELATION_TABLE].Select(RelationData.SOURCENAME_FIELD + "='" + selectSource + "' and  " + RelationData.TARGETNAME_FIELD + "='" + selectTarget + "'")[0];
                name.Text          = dr[RelationData.NAME_FIELD].ToString();
                source.Text        = dr[RelationData.SOURCENAME_FIELD].ToString();
                target.Text        = dr[RelationData.TARGETNAME_FIELD].ToString();
                type.Text          = dr[RelationData.TYPE_FIELD].ToString();
                comboBox_Type.Text = dr[RelationData.TYPE_FIELD].ToString();
                comment.Text       = dr[RelationData.COMMENT_FIELD].ToString();
                if (dr[RelationData.BIDIRECTION_FIELD].ToString() == "0")
                {
                    radioButton_single.Checked      = true;
                    radioButton_bidirection.Checked = false;
                }
                else
                {
                    radioButton_single.Checked      = false;
                    radioButton_bidirection.Checked = true;
                }
                if (dr[RelationData.SHOW_FIELD].ToString() == "1")
                {
                    checkBox_showRelationName.Checked = true;
                }
                else
                {
                    checkBox_showRelationName.Checked = false;
                }
            }
        }
コード例 #31
0
ファイル: ModuleOne.cs プロジェクト: leolzc7/CloudMapSystem
        public static List <LineInfo> GetLineInfo(List <Module> modulesList, int X, int Y, int level, string type)
        {
            Grid myGrid = new Grid(X, Y); // Grid class instance initialization

            ModuleOne[]     modules = myGrid.readModule(modulesList);
            int             num_par = (int)(Math.Ceiling(Math.Sqrt(modules.Length)));
            List <LineInfo> allLine = new List <LineInfo>();

            int[] rows    = new int[num_par];
            int[] columns = new int[num_par];
            // 调用DataAccess中的方法,读入关系表,包含源模块、目标模块和是否双向
            List <RelationOperator.relation> relationArray = RelationOperator.GetRelationArray(level, type);

            myGrid.getGlobalInfo(modules, relationArray, rows, columns);
            myGrid.setRouteForModules(modules, relationArray, rows, columns, allLine);
            Console.Write("successful!");
            return(allLine);
        }
        static bool StringCompare(string l,
                                  string r,
                                  RelationOperator op)
        {
            IComparer comparer = CaseInsensitiveComparer.DefaultInvariant;

            switch (op)
            {
            case RelationOperator.Equal:
                return(comparer.Compare(l, r) == 0);

            case RelationOperator.NotEqual:
                return(comparer.Compare(l, r) != 0);

            default:
                throw new NotSupportedException(String.Format("Relational operator {0} is not supported.", op));
            }
        }
コード例 #33
0
ファイル: Relation.cs プロジェクト: leolzc7/CloudMapSystem
        private void RelationEditForm_Load(object sender, EventArgs e)
        {
            dataGridView_relation.AutoGenerateColumns = false;
            relationdata = RelationOperator.LoadRelationInfo();
            dataGridView_relation.DataSource = relationdata.Tables[RelationData.RELATION_TABLE].DefaultView;

            dgv_source.AutoGenerateColumns = false;
            moduledata            = ModulesOperator.LoadModulesInfo();
            dgv_source.DataSource = moduledata.Tables[ModuleData.MODULES_TABLE].DefaultView;

            dgv_target.AutoGenerateColumns = false;
            moduledata            = ModulesOperator.LoadModulesInfo();
            dgv_target.DataSource = moduledata.Tables[ModuleData.MODULES_TABLE].DefaultView;

            pageStatus = RecordStatus.View;
            SetFormControlerStatus();
            SetFormControlerData();
        }
コード例 #34
0
        internal bool CompareTo(double val, RelationOperator op)
        {
            switch (this.type)
            {
            case ValueDataType.Boolean:
                return(QueryValueModel.Compare(this.boolVal, val, op));

            case ValueDataType.Double:
                return(QueryValueModel.Compare(this.dblVal, val, op));

            case ValueDataType.Sequence:
                return(QueryValueModel.Compare(this.sequence, val, op));

            case ValueDataType.String:
                return(QueryValueModel.Compare(this.strVal, val, op));
            }
            throw DiagnosticUtility.ExceptionUtility.ThrowHelperCritical(new QueryProcessingException(QueryProcessingError.TypeMismatch));
        }
コード例 #35
0
        internal static bool Compare(string x, string y, RelationOperator op)
        {
            switch (op)
            {
            case RelationOperator.Eq:
                return(Equals(x, y));

            case RelationOperator.Ne:
                return((x.Length != y.Length) || (0 != string.CompareOrdinal(x, y)));

            case RelationOperator.Gt:
            case RelationOperator.Ge:
            case RelationOperator.Lt:
            case RelationOperator.Le:
                return(Compare(Double(x), Double(y), op));
            }
            return(false);
        }
コード例 #36
0
        internal Interval(double literal, RelationOperator op)
        {
            switch (op)
            {
                case RelationOperator.Gt:
                    this.lowerBound = literal;
                    this.lowerOp = IntervalOp.LessThan;
                    return;

                case RelationOperator.Ge:
                    this.lowerBound = literal;
                    return;

                case RelationOperator.Lt:
                    this.upperBound = literal;
                    this.upperOp = IntervalOp.LessThan;
                    return;

                case RelationOperator.Le:
                    this.upperBound = literal;
                    return;
            }
        }
 internal NumberIntervalOpcode(double literal, RelationOperator op) : base(OpcodeID.NumberInterval, literal, op)
 {
 }
コード例 #38
0
 internal static bool Compare(bool x, double y, RelationOperator op)
 {
     switch (op)
     {
         default:
             return QueryValueModel.Compare(QueryValueModel.Double(x), y, op);
         case RelationOperator.Eq:
             return (x == QueryValueModel.Boolean(y));
         case RelationOperator.Ne:
             return (x != QueryValueModel.Boolean(y));
     }
 }
コード例 #39
0
 internal static bool Compare(bool x, NodeSequence y, RelationOperator op)
 {
     Fx.Assert(null != y, "");
     return QueryValueModel.Compare(x, QueryValueModel.Boolean(y), op);
 }
コード例 #40
0
 protected RelationOpcode(OpcodeID id, RelationOperator op) : base(id)
 {
     this.op = op;
 }
コード例 #41
0
		static bool StringCompare (string l,
					   string r,
					   RelationOperator op)
		{
			IComparer comparer = CaseInsensitiveComparer.DefaultInvariant;
			
			switch (op) {
			case RelationOperator.Equal:
				return comparer.Compare (l, r) == 0;
			case RelationOperator.NotEqual:
				return comparer.Compare (l, r) != 0;
			default:
				throw new NotSupportedException (String.Format ("Relational operator {0} is not supported.", op));
			}
		}
コード例 #42
0
		static bool StringCompare (string l,
					   string r,
					   RelationOperator op)
		{
			switch (op) {
			case RelationOperator.Equal:
				return string.Equals (l, r, StringComparison.OrdinalIgnoreCase);
			case RelationOperator.NotEqual:
				return !string.Equals (l, r, StringComparison.OrdinalIgnoreCase);
			default:
				throw new NotSupportedException (String.Format ("Relational operator {0} is not supported.", op));
			}
		}
コード例 #43
0
		static bool NumberCompare (float l,
					   float r,
					   RelationOperator op)
		{
			IComparer comparer = CaseInsensitiveComparer.DefaultInvariant;
			
			switch (op) {
			case RelationOperator.Equal:
				return comparer.Compare (l, r) == 0;
			case RelationOperator.NotEqual:
				return comparer.Compare (l, r) != 0;
			case RelationOperator.Greater:
				return comparer.Compare (l, r) > 0;
			case RelationOperator.GreaterOrEqual:
				return comparer.Compare (l, r) >= 0;
			case RelationOperator.Less:
				return comparer.Compare (l, r) < 0;
			case RelationOperator.LessOrEqual:
				return comparer.Compare (l, r) <= 0;
			default:
				throw new NotSupportedException (String.Format ("Relational operator {0} is not supported.", op));
			}
		}
コード例 #44
0
		static bool NumberCompare (float l,
					   float r,
					   RelationOperator op)
		{
			switch (op) {
			case RelationOperator.Equal:
				return l == r;
			case RelationOperator.NotEqual:
				return l != r;
			case RelationOperator.Greater:
				return l > r;
			case RelationOperator.GreaterOrEqual:
				return l >= r;
			case RelationOperator.Less:
				return l < r;
			case RelationOperator.LessOrEqual:
				return l <= r;
			default:
				throw new NotSupportedException (String.Format ("Relational operator {0} is not supported.", op));
			}
		}
コード例 #45
0
		static bool BoolCompare (bool l,
					 bool r,
					 RelationOperator op)
		{
			switch (op) {
			case RelationOperator.Equal:
				return l == r;
			case RelationOperator.NotEqual:
				return l != r;
			default:
				throw new NotSupportedException (String.Format ("Relational operator {0} is not supported.", op));
			}
		}
コード例 #46
0
 internal static bool Compare(string x, bool y, RelationOperator op)
 {
     Fx.Assert(null != x, "");
     switch (op)
     {
         default:
             return QueryValueModel.Compare(QueryValueModel.Double(x), QueryValueModel.Double(y), op);
         case RelationOperator.Eq:
             return (y == QueryValueModel.Boolean(x));
         case RelationOperator.Ne:
             return (y != QueryValueModel.Boolean(x));
     }
 }
コード例 #47
0
        internal static bool CompileTimeCompare(object x, object y, RelationOperator op)
        {
            Fx.Assert(null != x && null != y, "");

            if (x is string)
            {
                if (y is double)
                {
                    return QueryValueModel.Compare((string)x, (double)y, op);
                }
                else if (y is string)
                {
                    return QueryValueModel.Compare((string)x, (string)y, op);
                }
            }
            else if (x is double)
            {
                if (y is double)
                {
                    return QueryValueModel.Compare((double)x, (double)y, op);
                }
                else if (y is string)
                {
                    return QueryValueModel.Compare((double)x, (string)y, op);
                }
            }
            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new QueryCompileException(QueryCompileError.InvalidComparison));
        }
コード例 #48
0
 internal static bool Compare(string x, double y, RelationOperator op)
 {
     Fx.Assert(null != x, "");
     return QueryValueModel.Compare(QueryValueModel.Double(x), y, op);
 }
 internal bool Compare(ref NodeSequenceItem item, RelationOperator op)
 {
     return QueryValueModel.Compare(this.StringValue(), item.StringValue(), op);
 }
 internal bool Compare(double dblVal, RelationOperator op)
 {
     return QueryValueModel.Compare(this.NumberValue(), dblVal, op);
 }
 internal bool Compare(string strVal, RelationOperator op)
 {
     return QueryValueModel.Compare(this.StringValue(), strVal, op);
 }
コード例 #52
0
 internal static bool Compare(NodeSequence x, bool y, RelationOperator op)
 {
     Fx.Assert(null != x, "");
     return QueryValueModel.Compare(QueryValueModel.Boolean(x), y, op);
 }
コード例 #53
0
        internal static bool Compare(string x, string y, RelationOperator op)
        {
            Fx.Assert(null != x && null != y, "");
            switch (op)
            {
                default:
                    Fx.Assert("Invalid RelationOperator");
                    break;

                case RelationOperator.Eq:
                    return QueryValueModel.Equals(x, y);
                case RelationOperator.Ge:
                case RelationOperator.Gt:
                case RelationOperator.Le:
                case RelationOperator.Lt:
                    return QueryValueModel.Compare(QueryValueModel.Double(x), QueryValueModel.Double(y), op);
                case RelationOperator.Ne:
                    return (x.Length != y.Length || 0 != string.CompareOrdinal(x, y));
            }

            return false;
        }
コード例 #54
0
 internal static bool Compare(NodeSequence x, NodeSequence y, RelationOperator op)
 {
     Fx.Assert(null != x, "");
     return x.Compare(y, op);
 }
コード例 #55
0
 internal static bool Compare(double x, bool y, RelationOperator op)
 {
     switch (op)
     {
         default:
             return QueryValueModel.Compare(x, QueryValueModel.Double(y), op);
         case RelationOperator.Eq:
             return (QueryValueModel.Boolean(x) == y);
         case RelationOperator.Ne:
             return (QueryValueModel.Boolean(x) != y);
     }
 }
コード例 #56
0
 internal static bool Compare(string x, NodeSequence y, RelationOperator op)
 {
     Fx.Assert(null != y, "");
     switch (op)
     {
         default:
             return y.Compare(x, op);
         case RelationOperator.Ge:
             return y.Compare(x, RelationOperator.Le);
         case RelationOperator.Gt:
             return y.Compare(x, RelationOperator.Lt);
         case RelationOperator.Le:
             return y.Compare(x, RelationOperator.Ge);
         case RelationOperator.Lt:
             return y.Compare(x, RelationOperator.Gt);
     }
 }
コード例 #57
0
        internal bool CompareTo(double val, RelationOperator op)
        {
            switch (this.type)
            {
                default:
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperCritical(new QueryProcessingException(QueryProcessingError.TypeMismatch));

                case ValueDataType.Boolean:
                    return QueryValueModel.Compare(this.boolVal, val, op);

                case ValueDataType.Double:
                    return QueryValueModel.Compare(this.dblVal, val, op);

                case ValueDataType.Sequence:
                    return QueryValueModel.Compare(this.sequence, val, op);

                case ValueDataType.String:
                    return QueryValueModel.Compare(this.strVal, val, op);
            }
        }
コード例 #58
0
        internal static bool Compare(double x, double y, RelationOperator op)
        {
            switch (op)
            {
                default:
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperCritical(new QueryProcessingException(QueryProcessingError.TypeMismatch));

                case RelationOperator.Eq:
                    return (x == y);
                case RelationOperator.Ge:
                    return (x >= y);
                case RelationOperator.Gt:
                    return (x > y);
                case RelationOperator.Le:
                    return (x <= y);
                case RelationOperator.Lt:
                    return (x < y);
                case RelationOperator.Ne:
                    return (x != y);
            }
        }
コード例 #59
0
 internal RelationOpcode(RelationOperator op) : this(OpcodeID.Relation, op)
 {
 }
コード例 #60
0
 internal static bool Compare(double x, string y, RelationOperator op)
 {
     Fx.Assert(null != y, "");
     return QueryValueModel.Compare(x, QueryValueModel.Double(y), op);
 }