public VariableIncExp(char varName, OpEnum op, Dictionary <char, int> envVars, bool opBefore = false) { c_VarName = varName; c_OpBefore = opBefore; c_EnvVars = envVars; c_Op = op; }
public bool Equals(OpEnum obj) { if ((object)obj == null) { return(false); } return(StringComparer.OrdinalIgnoreCase.Equals(this.Value, obj.Value)); }
/// <summary> /// Initializes a new instance of the <see cref="PatchItem" /> class. /// </summary> /// <param name="op">Operation objects MUST have exactly one \"op\" member, whose value indicates the operation to perform (required).</param> /// <param name="path">path specifies a string format for identifying a specific value within a JSON document. It is used by all operations in patch to specify the part of the document to operate on. (required).</param> /// <param name="value">value.</param> public PatchItem(OpEnum op = default(OpEnum), string path = default(string), Object value = default(Object)) { this.Op = op; // to ensure "path" is required (not null) if (path == null) { throw new ArgumentNullException("path is a required property for PatchItem and cannot be null"); } this.Path = path; this.Value = value; }
/// <summary> /// Initializes a new instance of the <see cref="AggregateSpec" /> class. /// </summary> /// <param name="key">The key that uniquely identifies a queryable address in Lusid. (required).</param> /// <param name="op">The available values are: Sum, Proportion, Average, Count, Min, Max, Value (required).</param> public AggregateSpec(string key = default(string), OpEnum op = default(OpEnum)) { // to ensure "key" is required (not null) if (key == null) { throw new InvalidDataException("key is a required property for AggregateSpec and cannot be null"); } else { this.Key = key; } // to ensure "op" is required (not null) if (op == null) { throw new InvalidDataException("op is a required property for AggregateSpec and cannot be null"); } else { this.Op = op; } }
private IEvaluableExp BuildExpPre(string exp, Dictionary <char, int> envVars) { // build exp case: "j++" or "++j" : OpEnum curOP = OpEnum.Add; bool opBefore; char var; if (exp[0] == '+' || exp[0] == '-') { opBefore = true; var = exp[2]; } else { opBefore = false; var = exp[0]; } // Extractor the right op curOP = exp.Contains("++") ? OpEnum.Add : OpEnum.Sub; return(new VariableIncExp(var, curOP, envVars, opBefore)); }
/// <summary> /// Initializes a new instance of the <see cref="AggregateSpec" /> class. /// </summary> /// <param name="key">The key that uniquely identifies a queryable address in Lusid. (required).</param> /// <param name="op">The available values are: Sum, Proportion, Average, Count, Min, Max, Value, SumOfPositiveValues, SumOfNegativeValues, SumOfAbsoluteValues, ProportionOfAbsoluteValues (required).</param> public AggregateSpec(string key = default(string), OpEnum op = default(OpEnum)) { // to ensure "key" is required (not null) this.Key = key ?? throw new ArgumentNullException("key is a required property for AggregateSpec and cannot be null"); this.Op = op; }
public static Token TokenizeString(String expression, out List <Token> tokens) //str --> a trimmed string { tokens = new List <Token>(); int i = 0; String nextTokenStr; bool unaryFlag = true; while (i < expression.Length) { nextTokenStr = ""; while (i < expression.Length && Char.IsWhiteSpace(expression[i])) { i++; } if (i == expression.Length) { break; } nextTokenStr += expression[i++].ToString(); OpEnum opEnum = IsOperator(nextTokenStr); if (opEnum == OpEnum.Yes || opEnum == OpEnum.YesKeepGo) { if (opEnum == OpEnum.YesKeepGo) { if (i < expression.Length) { String tempStr = nextTokenStr + expression[i].ToString(); if (IsOperator(tempStr) == OpEnum.Yes) { tokens.Add(new Token(TokenType.Operator, tempStr)); i++; unaryFlag = true; continue; } } if (nextTokenStr == "!") { nextTokenStr = "~"; } } if (((nextTokenStr == "+" || nextTokenStr == "-") && unaryFlag) || nextTokenStr == "~") { tokens.Add(new Token(TokenType.Operator, "u" + nextTokenStr)); } else { tokens.Add(new Token(TokenType.Operator, nextTokenStr)); } if (expression[i - 1] != ')') { unaryFlag = true; } else { unaryFlag = false; } continue; } else { unaryFlag = false; } if (nextTokenStr == "\"") { i = SkipString(i, ref nextTokenStr, expression, false); if (i < 0) { return(Token.Error("Bad input. Input not valid: [ " + nextTokenStr + " ]")); } tokens.Add(new Token(TokenType.Text, nextTokenStr.Substring(1, nextTokenStr.Length - 2))); continue; } if (nextTokenStr == "{") { int startedCount = 1; while (i < expression.Length) { nextTokenStr += expression[i++].ToString(); if (expression[i - 1] == '\"') { i = SkipString(i, ref nextTokenStr, expression, true); if (i < 0) { return(Token.Error("Bad input. Input not valid: [ " + nextTokenStr + " ]")); } continue; } if (expression[i - 1] == '}') { startedCount--; if (startedCount == 0) { break; } } else if (expression[i - 1] == '{') { startedCount++; } } if (startedCount != 0) { return(Token.Error("Bad input. Bracket mismatch :[ " + nextTokenStr + " ]")); } tokens.Add(new Token(TokenType.Block, "", nextTokenStr.Substring(1, nextTokenStr.Length - 2))); continue; } while (i < expression.Length && !Char.IsWhiteSpace(expression[i]) && (IsOperator(expression[i].ToString()) == OpEnum.No) && expression[i] != '"' && expression[i] != '{') { nextTokenStr += expression[i++].ToString(); } if (Char.IsDigit(nextTokenStr[0]) || nextTokenStr[0] == '.') { try { Double.Parse(nextTokenStr); tokens.Add(new Token(TokenType.Vector, Double.Parse(nextTokenStr))); } catch (Exception) { return(Token.Error("Bad input: [ " + nextTokenStr + " ]")); } } else if (variables.Contains(nextTokenStr)) { tokens.Add(variables.GetToken(nextTokenStr)); } else { if (Function.IsDirective(nextTokenStr)) { tokens.Add(new Token(TokenType.Directive, nextTokenStr)); } else if (Function.IsFuction(nextTokenStr)) { tokens.Add(new Token(TokenType.Function, nextTokenStr)); } else if (BlockCommands.IsConditionCommand(nextTokenStr)) { tokens.Add(new Token(TokenType.Condition, nextTokenStr)); if (nextTokenStr == "else") { tokens.Add(new Token(TokenType.Operator, "(")); tokens.Add(new Token(TokenType.Bool, 0, 1)); tokens.Add(new Token(TokenType.Operator, ")")); } } else if (BlockCommands.IsLoopCommand(nextTokenStr)) { tokens.Add(new Token(TokenType.Loop, nextTokenStr)); if (nextTokenStr == "while") { nextTokenStr = ""; while (i < expression.Length && Char.IsWhiteSpace(expression[i])) { i++; } if (i == expression.Length || expression[i++] != '(') { return(Token.Error("Wrong use of 'while' statement.")); } int closeCount = -1; while (i < expression.Length) { if (expression[i] == ')') { ++closeCount; } else if (expression[i] == '(') { --closeCount; } if (closeCount == 0) { i++; break; } nextTokenStr += expression[i++].ToString(); } if (closeCount == 0) { tokens.Add(new Token(TokenType.Text, "(")); tokens.Add(new Token(TokenType.Text, nextTokenStr, nextTokenStr)); tokens.Add(new Token(TokenType.Text, ")")); } else { return(Token.Error("Wrong use of 'while' statement. () mismatch.")); } } } else if (nextTokenStr == "break") { tokens.Add(new Token(TokenType.Break, nextTokenStr)); } else if (nextTokenStr == "function") { tokens.Add(new Token(TokenType.FunctionDefiner, nextTokenStr)); } else { tokens.Add(new Token(TokenType.Text, nextTokenStr)); } } } return(Token.Void); }
private string ToPrint(OpEnum o) { switch (o) { case OpEnum.Equals: return "=="; break; case OpEnum.NotEquals: return "!="; break; case OpEnum.And: return "&&"; break; case OpEnum.Minus: return "-"; break; case OpEnum.Modulo: return "%"; break; case OpEnum.Or: return "||"; break; case OpEnum.LessThan: return "<"; break; case OpEnum.GreaterThan: return ">"; break; case OpEnum.LessThanOrEquals: return "<="; break; case OpEnum.GreaterThanOrEquals: return ">="; break; default: throw new ArgumentOutOfRangeException("o"); } }
public ExprTwo(Expr left, Expr right, OpEnum op) { this.left = left; this.right = right; this.op = op; }
public ExpressionCell(OpEnum op, MathCell[] operationArgs) { this.op = op; this.operationArgs = operationArgs; checkOperationArgs(); }
public string opString(OpEnum op) { switch (op) { case OpEnum.add: return "+"; case OpEnum.mult: return "*"; default: throw new Exception("Error: when looking up opstring, the op " + op.ToString() + " was not recognized."); } }
public Filter(OpEnum _operation, string _propertyname, object _value) { Operation = _operation; Value = _value; PropertyName = _propertyname; }
public RegularExp(IEvaluableExp leftExp, OpEnum op, IEvaluableExp rightExp) { m_LeftExp = leftExp; c_Op = op; m_RightExp = rightExp; }
public CustomTextFilter(OpEnum _operation, object _value) { InitializeComponent(); textBox1.Text = (string)_value; comboBox1.SelectedIndex = (int)_operation; }