public expression(MemberInfo column, eOperation op, Func <object, object> filterValue, bool multivalued = false) { this.column = column; this.op = op; this.filterValue = filterValue; this.multivalued = multivalued; }
public FormMain() { InitializeComponent(); a = 0; b = 0; operation = eOperation.empty; }
public Operation(double num1, double num2, eOperation operation, Operation next = null, Operation prev = null) { this.num1 = num1; this.num2 = num2; this.operation = operation; this.nextOperation = next; this.prevOperation = prev; }
public ArithmeticWorksheet(string strTitle, string folderName, eOperation oper, int rows, int cols, int digits, string sec, string hint) : base(strTitle, folderName) { eOper = oper; iRows = rows; iCols = cols; iDigits = digits; strHint = hint; m_strSecret = sec; }
public ArithmeticWorksheet(string strTitle, string folderName,eOperation oper, int rows, int cols, int digits, string sec, string hint) : base(strTitle, folderName) { eOper = oper; iRows = rows; iCols = cols; iDigits = digits; strHint = hint; m_strSecret = sec; }
public void setVal(int[] val, eOperation op, char keyval, int ans = 0) { numbers = new int[val.Length]; for (int i = 0; i < val.Length; i++) { numbers[i] = val[i]; } oper = op; answer = ans; key = keyval; }
public void setVal(int[] val, eOperation op, char keyval, int ans = 0) { numbers = new int[val.Length]; for (int i = 0; i < val.Length; i++) { numbers[i] = val[i]; } oper = op; answer = ans; key = keyval; }
public void addOperation(double num1, double num2, eOperation operation) { if (head == null) { head = new Operation(num1, num2, operation); } else { Operation curent = head; while (curent.nextOperation != null) { curent = curent.nextOperation; } curent.nextOperation = new Operation(num1, num2, operation, null, curent); } count++; }
private void MulExprs(ref IExpr aExpr) { if (lex != null) { if (lex.Type == LexemType.MulOp) { eOperation lOp = ExprOp.ParseOperation(lex.Text); lex = lex.Next(); ExprOp lExprOp = aExpr as ExprOp; if (lExprOp == null || lExprOp.Operation != lOp) { lExprOp = new ExprOp(lOp); lExprOp.AddOperand(aExpr); aExpr = lExprOp; } lExprOp.AddOperand(Expr()); MulExprs(ref aExpr); } } }
/// <summary>Parse C# expression into the set of AND expression.</summary> static IEnumerable <expression> parseQuery(ParameterExpression eRecord, ParameterExpression eArgument, Expression body) { switch (body.NodeType) { case ExpressionType.Equal: case ExpressionType.LessThanOrEqual: case ExpressionType.GreaterThanOrEqual: { BinaryExpression be = (BinaryExpression)body; eOperation op = dictTypes[body.NodeType]; return(parseBinary(eRecord, eArgument, be.Left, op, be.Right)); } case ExpressionType.AndAlso: BinaryExpression bin = (BinaryExpression)body; return(parseQuery(eRecord, eArgument, bin.Left).Concat(parseQuery(eRecord, eArgument, bin.Right))); case ExpressionType.Call: MethodCallExpression mce = (MethodCallExpression)body; if (mce.Method == miLessOrEqual) { return(parseBinary(eRecord, eArgument, mce.Arguments[0], eOperation.LessThanOrEqual, mce.Arguments[1])); } if (mce.Method == miGreaterOrEqual) { return(parseBinary(eRecord, eArgument, mce.Arguments[0], eOperation.GreaterThanOrEqual, mce.Arguments[1])); } if (mce.Method == miContains) { return(parseContains(eRecord, eArgument, mce.Arguments[0], mce.Arguments[1])); } if (isContainsMethod(mce.Method)) { return(parseContains(eRecord, eArgument, mce.Object, mce.Arguments[0])); } throw new NotSupportedException("Method {0}::{1} is not supported".formatWith(mce.Method.DeclaringType.FullName, mce.Method.Name)); } throw new NotSupportedException("The expression {0} is not supported".formatWith(body.NodeType.ToString())); }
public void DoOperation(eOperation operation) { switch (operation) { case eOperation.ConvertToCurve: if (intCurIndex != -1 && shapes[intCurIndex] is ShapePolygon) { if (((ShapePolygon)shapes[intCurIndex]).ConvertPointToCurve()) { refControl.Invalidate(shapes[intCurIndex].InvalidationArea); } } break; case eOperation.ConvertToLine: if (intCurIndex != -1 && shapes[intCurIndex] is ShapePolygon) { if (((ShapePolygon)shapes[intCurIndex]).ConvertPointToLine()) { refControl.Invalidate(shapes[intCurIndex].InvalidationArea); } } break; case eOperation.Delete: Delete(); break; case eOperation.BringToFront: BringToFront(); break; case eOperation.SendToBack: SendToBack(); break; } isDirty = true; }
public ExprOp(eOperation aOperation) { mOperation = aOperation; Operands = new List <IExpr>(); }
SBlock CreateBlock(SBlock block, eOperation operation, bool ignoreOnEmptyParameters = false) { if (_tsm == null) { throw new Exception("DBriize.Exception: first search block must be added via TextSearchTable"); } //Returning parent block in case if this block must be ignored if (ignoreOnEmptyParameters && String.IsNullOrEmpty(block._fullMatchWords) && String.IsNullOrEmpty(block._containsWords)) { return(this); } if (block._tsm == null) { //Creating real block block._tsm = this._tsm; block.BlockId = this._tsm.cntBlockId++; this._tsm.WordsPrepare(block._fullMatchWords.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Where(r => r.Length > 2), true, ref block.ParsedWords); this._tsm.WordsPrepare(block._containsWords.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Where(r => r.Length > 2), false, ref block.ParsedWords); this._tsm.toComputeWordsOrigin = true; this._tsm.Blocks[block.BlockId] = block; } //Creating logical block SBlock b = null; switch (operation) { case eOperation.AND: b = new BlockAnd(); break; case eOperation.OR: b = new BlockOr(); break; case eOperation.XOR: b = new BlockXOR(); break; case eOperation.EXCLUDE: b = new BlockEXCLUDE(); break; } b._tsm = this._tsm; b.BlockId = this._tsm.cntBlockId++; b.LeftBlockId = BlockId; b.RightBlockId = block.BlockId; b.TransBlockOperation = operation; //SBlock b = new SBlock() //{ // _tsm = this._tsm, // BlockId = this._tsm.cntBlockId++, // LeftBlockId = this.BlockId, // RightBlockId = block.BlockId, // TransBlockOperation = operation //}; this._tsm.Blocks[b.BlockId] = b; return(b); }
private void Button_Plus_Click(object sender, EventArgs e) { operation = eOperation.addition; SetValueA(); }
public static void processXML() { string xmlfile = Settings.Default["xmlfile"].ToString(); if (xmlfile == null || xmlfile.Length == 0) { return; } if (!System.IO.File.Exists(xmlfile)) { Console.WriteLine(xmlfile + " does not exist"); return; } XmlReader rdr = XmlReader.Create(xmlfile.ToString()); string xmlNodeText; //common string type = ""; string folderName = ""; //arithmetic int iCols = 0; int iRows = 0; int iDigits = 0; eOperation oper = eOperation.addition; //trace, missing, words wtc. int iStep = 1; int iStart = 0; int iEnd = 0; int iFillpercent = 0; int iCount = 0; string colorText = "black"; string colorLine = "black"; string colorTitle = "black"; string strOperation = ""; string hint = ""; int iSheetIndex = 0; while (rdr.Read()) { switch (rdr.NodeType) { case XmlNodeType.Element: int numAttributes = rdr.AttributeCount; string nodeName = rdr.Name; if (nodeName.Equals("group")) { iRows = iCols = iDigits = iStart = iEnd = iFillpercent = iCount = 0; iStep = 1; folderName = rdr.GetAttribute("name"); iSheetIndex = 0; type = rdr.GetAttribute("type"); if (type.Equals("arithmetic")) { strOperation = rdr.GetAttribute("operation"); string cols = rdr.GetAttribute("columns"); if (cols != null && cols.Length > 0) { iCols = int.Parse(cols); } string rows = rdr.GetAttribute("rows"); if (rows != null && rows.Length > 0) { iRows = int.Parse(rows); } string digits = rdr.GetAttribute("digits"); if (digits != null && digits.Length > 0) { iDigits = int.Parse(digits); } hint = rdr.GetAttribute("hint"); } else { if (rdr.GetAttribute("start") != null) { iStart = int.Parse(rdr.GetAttribute("start")); } if (rdr.GetAttribute("end") != null) { iEnd = int.Parse(rdr.GetAttribute("end")); } if (rdr.GetAttribute("count") != null) { iCount = int.Parse(rdr.GetAttribute("count")); } string strStep = rdr.GetAttribute("step"); if (strStep != null && strStep.Length != 0) { iStep = int.Parse(rdr.GetAttribute("step")); } string strPercent = rdr.GetAttribute("fillpercent"); if (strPercent != null) { iFillpercent = int.Parse(strPercent); } } string txtclr = rdr.GetAttribute("textcolor"); if (txtclr != null && txtclr.Length > 0) { colorText = txtclr; } string ttlclr = rdr.GetAttribute("titlecolor"); if (ttlclr != null && ttlclr.Length > 0) { colorTitle = ttlclr; } string lnclr = rdr.GetAttribute("linecolor"); if (lnclr != null && lnclr.Length > 0) { colorLine = lnclr; } createHtml(folderName); } if (nodeName.Equals("sheet")) { string name = rdr.GetAttribute("name"); iSheetIndex++; if (name == null || name.Length == 0) { name = folderName + iSheetIndex.ToString(); } int sheetStart = 0; int sheetEnd = 0; int sheetCount = 0; int sheetStep = 0; int sheetPercent = 0; if (rdr.GetAttribute("start") != null) { sheetStart = int.Parse(rdr.GetAttribute("start")); } else { sheetStart = iStart; } if (rdr.GetAttribute("end") != null) { sheetEnd = int.Parse(rdr.GetAttribute("end")); } else { sheetEnd = iEnd; } string strStep = rdr.GetAttribute("step"); if (strStep != null && strStep.Length != 0) { sheetStep = int.Parse(strStep); } else { sheetStep = iStep; } string strPercent = rdr.GetAttribute("fillpercent"); if (strPercent != null) { sheetPercent = int.Parse(strPercent); } else { sheetPercent = iFillpercent; } string strCount = rdr.GetAttribute("count"); if (strCount != null) { sheetCount = int.Parse(strCount); } else { sheetCount = iCount; } Worksheet sht = null; if (type.Equals("numberstowords") || type.Equals("wordstonumbers")) { sht = new NumbersInWordsWorksheet(name, folderName, type, sheetStart, sheetEnd, sheetCount); } else if (type.Equals("missing") || type.Equals("trace")) { sht = new TracingMissingWorksheet(name, folderName, type, sheetStart, sheetEnd, sheetStep, sheetPercent); } else if (type.Equals("words")) { sht = new WordsWorksheet(name, folderName, sheetCount, sheetStart, sheetEnd, sheetStep); } else if (type.Equals("counting")) { // //// sht = new CountingWorksheet(name, folderName, sheetCount, sheetEnd); } else if (type.Equals("numbers")) { } else if (type.Equals("arithmetic")) { string strOper = rdr.GetAttribute("operation"); if (strOper == null || strOper.Length == 0) { strOper = strOperation; } int sheetCols = 0; string cols = rdr.GetAttribute("columns"); if (cols != null && cols.Length > 0) { sheetCols = int.Parse(cols); } else { sheetCols = iCols; } int sheetRows; string rows = rdr.GetAttribute("rows"); if (rows != null && rows.Length > 0) { sheetRows = int.Parse(rows); } else { sheetRows = iRows; } int sheetDigits; string digits = rdr.GetAttribute("digits"); if (digits != null && digits.Length > 0) { sheetDigits = int.Parse(digits); } else { sheetDigits = iDigits; } if (strOper.Contains("addition")) { oper = eOperation.addition; } if (strOper.Contains("subtraction")) { oper = eOperation.subtraction; } if (strOper.Equals("division")) { oper = eOperation.division; } if (strOper.Equals("multiplication")) { oper = eOperation.multiplication; } string sheethint = rdr.GetAttribute("hint"); if (sheethint == null || sheethint.Length == 0) { sheethint = hint; } string answer = rdr.GetAttribute("answer"); sht = new ArithmeticWorksheet(name, folderName, oper, sheetRows, sheetCols, sheetDigits, answer, sheethint); } /* else * { * if (rdr.GetAttribute("start") != null) * iStart = int.Parse(rdr.GetAttribute("start")); * if (rdr.GetAttribute("end") != null) * iEnd = int.Parse(rdr.GetAttribute("end")); * * * int count = 0; * if (rdr.GetAttribute("count") != null) * count = int.Parse(rdr.GetAttribute("count")); * * int step = 1; * if (strStep != null && strStep.Length != 0) * { * step = int.Parse(rdr.GetAttribute("step")); * } * * * int percent = 0; * if (strPercent != null) * percent = int.Parse(strPercent); * } * string txtclr = rdr.GetAttribute("textcolor"); * if (txtclr != null && txtclr.Length > 0) * colorText = txtclr; * string ttlclr = rdr.GetAttribute("titlecolor"); * if (ttlclr != null && ttlclr.Length > 0) * colorTitle = ttlclr; * string lnclr = rdr.GetAttribute("linecolor"); * if (lnclr != null && lnclr.Length > 0) * colorLine = lnclr; */ if (type.Equals("arithmetic")) { ((ArithmeticWorksheet)sht).generate(); sht.writePdf(); sht.writePdf(true); } else if (sht != null) { // sht.setColors(System.Drawing.Color.FromName(colorText), System.Drawing.Color.FromName(colorTitle), System.Drawing.Color.FromName(colorLine)); sht.writePdf(); } addHtml(name); } break; case XmlNodeType.Text: xmlNodeText = rdr.Value; break; case XmlNodeType.EndElement: xmlNodeText = string.Empty; break; default: break; } } }
public ChallengeBuilder SetCalculate(eOperation operation) { Operation = operation; return(this); }
public Challenge(int value, eOperation operation) { Value = value; Operation = operation; }
public OperationInput(eOperation type, int questions, int maxTable) { Type = type; NumberOfQuestions = questions; MaxTable = maxTable; }
public OperationInput(eOperation type, int questions, int minA, int minB, int maxA, int maxB) { Type = type; NumberOfQuestions = questions; MinA = minA; MinB = minB; MaxA = maxA; MaxB = maxB; }
private void Button_Minus_Click(object sender, EventArgs e) { operation = eOperation.subtraction; SetValueA(); }
private void Button_Multi_Click(object sender, EventArgs e) { operation = eOperation.multiplication; SetValueA(); }
static eOperation invert(this eOperation op) { return(dictInvert[op]); }
private void Cancel_Click(object sender, EventArgs e) { Screen.Text = string.Empty; operation = eOperation.empty; }
private void Button_Divide_Click(object sender, EventArgs e) { operation = eOperation.division; SetValueA(); }
public void DoOperation(eOperation operation) { switch (operation) { case eOperation.ConvertToCurve: if (intCurIndex != -1 && shapes[intCurIndex] is ShapePolygon) { if (((ShapePolygon)shapes[intCurIndex]).ConvertPointToCurve()) refControl.Invalidate(shapes[intCurIndex].InvalidationArea); } break; case eOperation.ConvertToLine: if (intCurIndex != -1 && shapes[intCurIndex] is ShapePolygon) { if (((ShapePolygon)shapes[intCurIndex]).ConvertPointToLine()) refControl.Invalidate(shapes[intCurIndex].InvalidationArea); } break; case eOperation.Delete: Delete(); break; case eOperation.BringToFront: BringToFront(); break; case eOperation.SendToBack: SendToBack(); break; } isDirty = true; }
SBlock CreateBlock(SBlock block, eOperation operation) { if (_tsm == null) throw new Exception("DBreeze.Exception: first search block must be added via TextSearchTable"); if (block._tsm == null) { //Creating real block block._tsm = this._tsm; block.BlockId = this._tsm.cntBlockId++; this._tsm.WordsPrepare(block._fullMatchWords.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Where(r => r.Length >= 2), true, ref block.ParsedWords); this._tsm.WordsPrepare(block._containsWords.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Where(r => r.Length >= 2), false, ref block.ParsedWords); this._tsm.toComputeWordsOrigin = true; this._tsm.Blocks[block.BlockId] = block; } //Creating logical block SBlock b = null; switch (operation) { case eOperation.AND: b = new BlockAnd(); break; case eOperation.OR: b = new BlockOr(); break; case eOperation.XOR: b = new BlockXOR(); break; case eOperation.EXCLUDE: b = new BlockEXCLUDE(); break; } b._tsm = this._tsm; b.BlockId = this._tsm.cntBlockId++; b.LeftBlockId = BlockId; b.RightBlockId = block.BlockId; b.TransBlockOperation = operation; //SBlock b = new SBlock() //{ // _tsm = this._tsm, // BlockId = this._tsm.cntBlockId++, // LeftBlockId = this.BlockId, // RightBlockId = block.BlockId, // TransBlockOperation = operation //}; this._tsm.Blocks[b.BlockId] = b; return b; }
static expression[] parseBinary(ParameterExpression eRecord, ParameterExpression eArgument, Expression eLeft, eOperation op, Expression eRight) { HasParam hp = new HasParam(eRecord); bool leftParam = hp.hasParameter(eLeft); bool rightParam = hp.hasParameter(eRight); if (!(leftParam ^ rightParam)) { throw new NotSupportedException("Binary expression is not supported: must contain a ESENT column on exactly one side of the comparison"); } MemberInfo mi; Func <object, object> val; if (leftParam) { // The column is on the left of the expression mi = parseColumn(eRecord, eLeft); val = parseConstant(eArgument, eRight); } else { // The column is on the right of the expression mi = parseColumn(eRecord, eRight); val = parseConstant(eArgument, eLeft); op = op.invert(); } var res = new expression(mi, op, val); return(new expression[1] { res }); }