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)); }
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); } }
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."); } }
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."); } }
// 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)); } }
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)); } }
// 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."); } }
public RelationInfo(ALine myAline) { InitializeComponent(); this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; relationName = myAline.Text; relationdata = RelationOperator.LoadRelationInfo(); ShowInfo(); }
public ConditionRelationalExpression (ConditionExpression left, ConditionExpression right, RelationOperator op) { this.left = left; this.right = right; this.op = op; }
public ConditionRelationalExpression(ConditionExpression left, ConditionExpression right, RelationOperator op) { this.left = left; this.right = right; this.op = op; }
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); }
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); }
//显示选中模块的关系 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; } }
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); }
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)); }
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)); }
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); }
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); }
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); }
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); }
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); }
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)); } }
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); } }
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)); } }
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)); } }
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)); } }
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); }
//删除关系 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; } } }
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)); } }
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(); }
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)); }
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); }
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) { }
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)); } }
internal static bool Compare(bool x, NodeSequence y, RelationOperator op) { Fx.Assert(null != y, ""); return QueryValueModel.Compare(x, QueryValueModel.Boolean(y), op); }
protected RelationOpcode(OpcodeID id, RelationOperator op) : base(id) { this.op = op; }
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)); } }
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)); } }
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)); } }
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)); } }
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)); } }
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)); } }
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)); }
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); }
internal static bool Compare(NodeSequence x, bool y, RelationOperator op) { Fx.Assert(null != x, ""); return QueryValueModel.Compare(QueryValueModel.Boolean(x), y, op); }
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; }
internal static bool Compare(NodeSequence x, NodeSequence y, RelationOperator op) { Fx.Assert(null != x, ""); return x.Compare(y, op); }
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); } }
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); } }
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); } }
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); } }
internal RelationOpcode(RelationOperator op) : this(OpcodeID.Relation, op) { }
internal static bool Compare(double x, string y, RelationOperator op) { Fx.Assert(null != y, ""); return QueryValueModel.Compare(x, QueryValueModel.Double(y), op); }