public OperatorView(OperatorType type)
     : base(0, 0, 10, 10)
 {
     Type = type;
     LineWidth = 1;
     LineColor = new Color(0, 0, 0);
 }
Exemple #2
0
 public PriceFilter(StockInfo stockInfo, OperatorType operatorType, PriceFilterRightOperandType rightOperandType,
     double? percent = null, double? constant = null)
     : base(stockInfo, operatorType, percent)
 {
     this.rightOperandType = rightOperandType;
     this.constant = constant;
 }
Exemple #3
0
 /// <summary>
 ///   构造
 /// </summary>
 /// <param name = "fieldName">字段名</param>
 /// <param name = "operator">表达式操作符</param>
 /// <param name = "value">值</param>
 /// <param name = "nextUnionType">与下一个表达式的联合类型<see cref = "WhereUnionType" /></param>
 public FieldCondition(string fieldName, OperatorType @operator, object value, WhereUnionType @nextUnionType)
 {
     FieldName = fieldName;
     Operator = @operator;
     Value = value;
     NextUnionType = nextUnionType;
 }
 /// <summary>
 /// Gets the underlying base operator for the given compound operator.
 /// </summary>
 /// <param name="compoundOperatorType"> The type of compound operator. </param>
 /// <returns> The underlying base operator, or <c>null</c> if the type is not a compound
 /// operator. </returns>
 private static Operator GetCompoundBaseOperator(OperatorType compoundOperatorType)
 {
     switch (compoundOperatorType)
     {
         case OperatorType.CompoundAdd:
             return Operator.Add;
         case OperatorType.CompoundBitwiseAnd:
             return Operator.BitwiseAnd;
         case OperatorType.CompoundBitwiseOr:
             return Operator.BitwiseOr;
         case OperatorType.CompoundBitwiseXor:
             return Operator.BitwiseXor;
         case OperatorType.CompoundDivide:
             return Operator.Divide;
         case OperatorType.CompoundLeftShift:
             return Operator.LeftShift;
         case OperatorType.CompoundModulo:
             return Operator.Modulo;
         case OperatorType.CompoundMultiply:
             return Operator.Multiply;
         case OperatorType.CompoundSignedRightShift:
             return Operator.SignedRightShift;
         case OperatorType.CompoundSubtract:
             return Operator.Subtract;
         case OperatorType.CompoundUnsignedRightShift:
             return Operator.UnsignedRightShift;
     }
     return null;
 }
        public static Operator CreateOpPostAssign(this Node lhs, OperatorType op, Node rhs)
        {
            var e_lhs = lhs as Expression;
            var e_rhs = rhs as Expression;
            if (e_lhs == null || e_rhs == null) return null;

            OperatorType opAssign;
            if (EnumHelper.TryParse(op + "Assign", out opAssign))
            {
                if (op == OperatorType.Add && e_rhs.IsConstOne())
                {
                    return Operator.PostIncrement(e_lhs);
                }
                else if (op == OperatorType.Subtract && e_rhs.IsConstOne())
                {
                    return Operator.PostDecrement(e_lhs);
                }
                else
                {
                    return null;
                }
            }
            else
            {
                return null;
            }
        }
Exemple #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OperatorToken"/> class.
        /// </summary>
        /// <param name="op">The operator</param>
        public OperatorToken(OperatorType op)
        {
            Operator = op;
            Type = TokenType.Operator;

            switch (Operator)
            {
                case OperatorType.Plus:
                    Priority = 1;
                    break;
                case OperatorType.Minus:
                    Priority = 1;
                    break;
                case OperatorType.Mult:
                    Priority = 2;
                    break;
                case OperatorType.Div:
                    Priority = 2;
                    break;
                case OperatorType.LeftBraket:
                    Priority = 0;
                    break;
                case OperatorType.RightBraket:
                    break;
                default:
                    break;
            }
        }
Exemple #7
0
 public OpSlot(string value, OperatorType type, int position)
     : this()
 {
     this.Value = value;
     this.Type = type;
     this.Position = position;
 }
Exemple #8
0
    public void ApplyCSG()
    {
        switch (operation) {
        case OperatorType.Union:
            temp = modeller.getUnion ();
            break;
        case OperatorType.Intersection:
            temp = modeller.getIntersection ();
            break;
        case OperatorType.Difference:
            temp = modeller.getDifference ();
            break;
        }

        // Apply to output game object
        CSGGameObject.GenerateMesh(output, ObjMaterial, temp);
        // Make sure the output object has its 'solid' updated
        output.GetComponent<CSGObject> ().GenerateSolid ();

        // Hide the original objects
        objectA.SetActive (false);
        objectB.SetActive (false);

        lasten = enableOperator;
        lastop = operation;
    }
Exemple #9
0
 /// <summary>
 /// parametru folosit in constructia HqlObject
 /// </summary>
 /// <example>memberName condition: paramName</example>
 /// <param name="paramName">numele parametrului folosit</param>
 /// <param name="paramValue">valoarea parametrului ce va fi inlocuit</param>
 /// <param name="memberName">membrul din query ce va fi comparat</param>
 /// <param name="condition">conditia de comparatie ('=', 'Like', etc)</param>
 public QueryParameter(string paramName, object paramValue, string memberName, OperatorType condition)
 {
     this.paramName = paramName;
     this.paramValue = paramValue;
     this.memberName = memberName;
     this.condition = condition;
 }
 public OperatorResolveResult(OperatorType @operator, TypeDefinition operatorType, params ResolveResult[] operands)
     : base(operatorType)
 {
     Operator = @operator;
     OperatorType = operatorType;
     Operands = new ReadOnlyCollection<ResolveResult>(operands);
 }
Exemple #11
0
        /// <summary>
        /// Returns .NET Expression type based on Operator Type
        /// </summary>
        /// <param name="opType"></param>
        /// <returns></returns>
        public static ExpressionType GetExpressionType(OperatorType opType)
        {
            ExpressionType exprType;
            
            switch ((OperatorType) opType )
            {
                case OperatorType.EqualsTo :  exprType = ExpressionType.Equal;
                    break;
                case OperatorType.NotEqualsTo: exprType = ExpressionType.NotEqual;
                    break;
                case OperatorType.GreaterThan: exprType = ExpressionType.GreaterThan;
                    break;
                case OperatorType.GreaterThanEqualsTo: exprType = ExpressionType.GreaterThanOrEqual;
                    break;
                case OperatorType.LessThan: exprType = ExpressionType.LessThan;
                    break;
                case OperatorType.LessThanEqualsTo: exprType = ExpressionType.LessThanOrEqual;
                    break;
                default: exprType = ExpressionType.IsFalse;
                    break;
            }

            return exprType;
            
        }
 /// <summary>
 /// Creates the condition based on it's region id, field, operator to evaluate to the value and whether it is case sensitive.
 /// </summary>
 /// <param name="regionid">The ID of the region.</param>
 /// <param name="field">The name of the field.</param>
 /// <param name="aValue">The value to match.</param>
 /// <param name="aOperator">The operator for the comparison.</param>
 /// <param name="casesensitive">Whether the value is matched with case sensitivity.</param>
 public Condition(string regionid, string field, string aValue, OperatorType aOperator, bool casesensitive)
 {
     this.RegionID = regionid;
     this.Field = field;
     this.Operator = aOperator;
     this.CaseSensitive = casesensitive;
     this.Value = aValue;
 }
Exemple #13
0
 public Operator(string name, OperatorType type, int precedence, AssociationType association, Func<double, double, double> body)
     : base(name)
 {
     this.Type = type;
     this.Precedence = precedence;
     this.Association = association;
     this.Body = body;
 }
Exemple #14
0
 public Token(OperatorType operatorType, int operandsCount, Associativity assoc)
 {
     this.Type = TokenType.Operator;
     this.OperatorType = operatorType;
     this.OperandsCount = operandsCount;
     this.Associativity = assoc;
     this.Precedence = GetPrecedence();
 }
Exemple #15
0
 // if numDigits = 0, don't care how much space it takes up
 private NumberSprite(ContentManager Content, int number, int numDigits, ColorType color, OperatorType op)
 {
     this.Content = Content;
     this.number = number;
     this.numDigits = numDigits;
     this.color = color;
     this.op = op;
 }
Exemple #16
0
        public Token(OperatorType opType, string text)
        {
            _type = TokenType.Operator;
            _opType = opType;
            _text = text;

            Initialize();
        }
 public Operator(string s, int p, string a, double v, OperatorType o)
 {
     str = s;
     precedence = p;
     associativity = a;
     value = v;
     opType = o;
 }
Exemple #18
0
		public FilterParameter(string columnName, object value, OperatorType op)
		{
			if (columnName == null)
				throw new ArgumentNullException("columnName");

			this.m_ColumnName = columnName;
			this.m_Value = value;
			this.m_Operator = op;
		}
Exemple #19
0
 public Operator(OperatorType type, string representation, bool unary, bool scalar, bool vector, bool matrix)
     : this(type)
 {
     this.StringRepresentation = representation;
     this.IsUnary = unary;
     this.IsScalarOperator = scalar;
     this.IsVectorOperator = vector;
     this.IsMatrixOperator = matrix;
 }
 public static Associativity GetAssociativity(OperatorType operatorType) {
     switch (operatorType) {
         case OperatorType.Exponent:
         case OperatorType.LeftAssign:
         case OperatorType.Equals:
             return Associativity.Right;
     }
     return Associativity.Left;
 }
Exemple #21
0
 private void SetDefaults(string className, OperatorType operatorType, DataElement m_dataLeft, bool createNewId)
 {
     m_className = className;
     m_operatorType = operatorType;
     if (null != m_dataLeft)
     {
         m_dataLeft = new DataElement(m_dataLeft, m_dataLeft.ReadOnly, createNewId);
     }
 }
Exemple #22
0
 public static OperatorType GetUnaryForm(OperatorType operatorType) {
     switch (operatorType) {
         case OperatorType.Subtract:
             return OperatorType.UnaryMinus;
         case OperatorType.Add:
             return OperatorType.UnaryPlus;
     }
     return operatorType;
 }
Exemple #23
0
 public Condition(OperatorType operatorType, int right, ConditionAlgorithm algorithm, StateQuantityType conditionParameter)
 {
     _id = Guid.NewGuid();
     _operator = operatorType;
     _algorithm = algorithm;
     //_leftExpression = left;
     _rightExpression = right;
     _conditionParameter = conditionParameter;
 }
Exemple #24
0
 public static Operator FieldAndConstant(string fieldName, OperatorType @operator, object value)
 {
     return new Operator
     {
         LeftOperand = Operand.Create.Projection(Projection.Create.Field(fieldName)),
         Type = @operator,
         RightOperand = Operand.Create.Projection(Projection.Create.Constant(value))
     };
 }
Exemple #25
0
 public static Operator Operators(Operator left, OperatorType @operator, Operator right)
 {
     return new Operator
     {
         LeftOperand = Operand.Create.Operator(left),
         Type = @operator,
         RightOperand = Operand.Create.Operator(right)
     };
 }
        private int GetCurrentOperatorPrecedence(ParseContext context, OperatorType operatorType, out bool isUnary) {
            isUnary = false;

            if (IsUnaryOperator(context.Tokens, operatorType, -1)) {
                operatorType = OperatorType.Unary;
                isUnary = true;
            }

            return OperatorPrecedence.GetPrecedence(operatorType);
        }
 public CodeMemberOperatorOverride(OperatorType type,
     CodeParameterDeclarationExpression[] parameters,
     CodeTypeReference returnType,
     params CodeStatement[] statements)
 {
     m_operator = type;
     m_parameters = parameters;
     m_returnType = returnType;
     m_statements = statements;
 }
Exemple #28
0
 public override void Append(string lhs, string rhs, OperatorType op)
 {
     XmlNode operation = m_xmldoc.CreateElement(NxUtils.OperatorTypeToString(op));
     XmlAttribute attrLhs = m_xmldoc.CreateAttribute("leftId");
     attrLhs.Value = lhs;
     XmlAttribute attrRhs = m_xmldoc.CreateAttribute("rightId");
     attrRhs.Value = rhs;
     operation.Attributes.Append(attrLhs);
     operation.Attributes.Append(attrRhs);
     m_Or.AppendChild(operation);
 }
        /// <summary>
        /// Initializes a new instance of the OperatorSymbolToken class.
        /// </summary>
        /// <param name="document">The parent document.</param>
        /// <param name="text">The text of the operator symbol.</param>
        /// <param name="category">The category of the operator.</param>
        /// <param name="symbolType">The specific symbol type.</param>
        internal OperatorSymbolToken(CsDocument document, string text, OperatorCategory category, OperatorType symbolType)
            : base(document, text, (int)symbolType)
        {
            Param.AssertNotNull(document, "document");
            Param.AssertValidString(text, "text");
            Param.Ignore(category);
            Param.Ignore(symbolType);

            this.category = category;
            CsLanguageService.Debug.Assert(System.Enum.IsDefined(typeof(OperatorType), this.SymbolType), "The type is invalid.");
        }
        protected BinaryExpression(ExpressionBase left, ExpressionBase right, OperatorType type)
            : base(type)
        {
            if (left == null)
                throw new ArgumentNullException("left");
            if (right == null)
                throw new ArgumentNullException("right");

            Left = left;
            Right = right;
        }
Exemple #31
0
        public static PlainSMS CreatePlainSMS(SMSMessage message, List <string> numbers, OperatorType Op)
        {
            PlainSMS sms = new PlainSMS()
            {
                ID               = message.ID,
                AccountID        = message.AccountID,
                Channel          = message.Channel,
                Content          = message.Content,
                Numbers          = string.Join(",", numbers),
                SplitNumber      = message.SplitNumber,
                FeeTotalCount    = message.SplitNumber * numbers.Count,
                NumberCount      = numbers.Count,
                OperatorType     = Op,
                SendTime         = message.SendTime,
                Signature        = message.Signature,
                SMSLevel         = message.SMSLevel,
                SMSType          = message.SMSType,
                StatusReportType = message.StatusReportType,
                SPNumber         = message.SPNumber,
                Percent          = message.Percent
            };

            return(sms);
        }
Exemple #32
0
 public OperatorPattern(OperatorType type, bool simple)
     : this()
 {
     this.type   = type;
     this.simple = simple;
 }
Exemple #33
0
 static OperatorPattern OperatorNV(OperatorType type)
 {
     return(new OperatorPattern(type, true));
 }
Exemple #34
0
 /// <summary>
 /// Gets the token for the operator type ("+", "implicit", etc.)
 /// </summary>
 public static string GetToken(OperatorType type)
 {
     return(names[(int)type][0]);
 }
        /// <summary>
        /// Function to Load a CategoryEntity from database.
        /// </summary>
        /// <param name="propertyName">A string with the name of the field or a
        /// constant from the class that represent that field</param>
        /// <param name="expValue">The value that will be inserted on the where
        /// clause of the sql query</param>
        /// <param name="loadRelation">If is true load the relations</param>
        /// <returns>A list containing all the entities that match the where clause</returns>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="propertyName"/> is null or empty.
        /// If <paramref name="propertyName"/> is not a property of CategoryEntity class.
        /// If <paramref name="expValue"/> is null.
        /// </exception>
        /// <exception cref="UtnEmallDataAccessException">
        /// If an DbException occurs in the try block while accessing the database.
        /// </exception>
        public Collection <CategoryEntity> LoadWhere(string propertyName, object expValue, bool loadRelation, OperatorType operatorType)
        {
            if (String.IsNullOrEmpty(propertyName) || expValue == null)
            {
                throw new ArgumentException("The argument can not be null or be empty", "propertyName");
            }
            if (!properties.ContainsKey(propertyName))
            {
                throw new ArgumentException("The property " + propertyName + " is not a property of this entity", "propertyName");
            }
            Collection <CategoryEntity> categoryList;

            bool closeConnection = false;

            try
            {
                // Open a new connection with a database if necessary
                if (dbConnection == null || dbConnection.State.CompareTo(ConnectionState.Closed) == 0)
                {
                    closeConnection = true;
                    dbConnection    = dataAccess.GetNewConnection();
                    dbConnection.Open();
                }

                string op = DataAccessConnection.GetOperatorString(operatorType);
                // Build the query string

                string cmdText = "SELECT idCategory, description, name, idParentCategory, timestamp FROM [Category] WHERE " + propertyName + " " + op + " @expValue";
                // Create the command

                IDbCommand sqlCommand = dataAccess.GetNewCommand(cmdText, dbConnection, dbTransaction);
                // Add parameters values to the command

                IDbDataParameter parameter = dataAccess.GetNewDataParameter();
                parameter.ParameterName = "@expValue";
                Type parameterType = properties[propertyName];
                parameter.DbType = DataAccessConnection.GetParameterDBType(parameterType);

                parameter.Value = expValue;
                sqlCommand.Parameters.Add(parameter);
                // Create a DataReader

                IDataReader reader = sqlCommand.ExecuteReader();
                categoryList = new Collection <CategoryEntity>();
                CategoryEntity category;
                List <int>     listId = new List <int>();
                // Add list of Ids to a list
                while (reader.Read())
                {
                    listId.Add(reader.GetInt32(0));
                }
                // Close the reader

                reader.Close();
                // Load the entities

                foreach (int id in listId)
                {
                    category = Load(id, loadRelation, null);
                    categoryList.Add(category);
                }
            }
            catch (DbException dbException)
            {
                // Catch DbException and rethrow as custom exception
                throw new UtnEmallDataAccessException(dbException.Message, dbException);
            }
            finally
            {
                // Close connection if it was opened by myself
                if (closeConnection)
                {
                    dbConnection.Close();
                }
            }
            return(categoryList);
        }
 public TTEOperator(int precedence, string op, OperatorType type = OperatorType.Binary)
 {
     Precedence = precedence;
     Operator   = op;
     Type       = type;
 }
Exemple #37
0
        public static Task <ModernModeStatsContainer <WeaponSlot> > GetModernWeaponStatsAsync(this Dragon6Client client, UbisoftAccount account, PlaylistType playlistType = PlaylistType.All, OperatorType operatorType = OperatorType.Independent, DateTimeOffset?startDate = null, DateTimeOffset?endDate = null)
        {
            var request = new ModernWeaponStatsRequest(account)
            {
                Playlist     = playlistType,
                OperatorType = operatorType
            };

            ValueUtils.ApplyValue(startDate, s => request.StartDate = s);
            ValueUtils.ApplyValue(endDate, e => request.EndDate     = e);

            return(client.PerformAsync <JObject>(request)
                   .ContinueWith(t => t.Result.ProcessData <WeaponSlot>(request), TaskContinuationOptions.OnlyOnRanToCompletion));
        }
Exemple #38
0
 private void ThrowNotSupportedCollectionQueryOperator(OperatorType @operator, BlittableJsonReaderObject parameters)
 {
     throw new InvalidQueryException(
               $"Collection query does not support filtering by {Constants.Documents.Indexing.Fields.DocumentIdFieldName} using {@operator} operator. Supported operators are: =, IN",
               QueryText, parameters);
 }
Exemple #39
0
 public OptimizedChoose(string op, int precedence, OperatorType ot, ushort biffCode)
     : base(op, precedence, ot, biffCode)
 {
 }
Exemple #40
0
    public OperatorType operatorType;               // creates a variable to hold this object's enum value

    public Operator(OperatorType operatorType)      // constructor takes operator type
    {
        this.operatorType = operatorType;
    }
Exemple #41
0
 public Operator(string rep, OperatorType type = OperatorType.Binary)
 {
     Representation = rep;
     Type           = type;
 }
Exemple #42
0
 public CalculatorCommand(ICalculator calculator, OperatorType operatorType, double operand)
 {
     _calculator   = calculator;
     _operatorType = operatorType;
     _operand      = operand;
 }
 public Conditional(string op, int precedence, OperatorType ot, ushort biffCode)
     : base(op, precedence, ot, biffCode)
 {
 }
Exemple #44
0
 public bool HasOperatorDefined(OperatorType Operator)
 {
     return(unaryOperators.ContainsKey(Operator) || binaryOperators.ContainsKey(Operator));
 }
Exemple #45
0
 private void AddBinaryOperator(OperatorType Type, IBinaryOperator Operator)
 {
     binaryOperators.Add(Type, Operator);
 }
        static void Main(string[] args)
        {
            int      ifInt;
            string   ifString;
            DateTime ifDateTime;
            TimeSpan ifTimeSpan;



            Console.WriteLine("Welcome to the Calculator App!");
            Console.WriteLine("Press CTRL+C if you would like to exit");

            while (true)
            {
                var          firstArg   = GetArgument("\nEnter your first Argument\n");
                ArgumentType argOneType = GetArgumentType(firstArg);

                Console.WriteLine("Enter your operator type\n");
                ConsoleKeyInfo key       = Console.ReadKey();
                char           operatorC = char.ToUpper(key.KeyChar);
                while (!((operatorC) == '+' || (operatorC) == '-' || (operatorC) == '*' || (operatorC) == '/'))
                {
                    Console.WriteLine("\nEnter your operator type\n");
                    key       = Console.ReadKey();
                    operatorC = (key.KeyChar);
                }
                OperatorType finalOperator = GetOperatorType(operatorC);

                var          secondArg  = GetArgument("\nEnter your second Argument\n");
                ArgumentType argTwoType = GetArgumentType(secondArg);

                if (argOneType == ArgumentType.String && argTwoType == ArgumentType.String)
                {
                    string finalString;
                    switch (finalOperator)
                    {
                    case OperatorType.Addition:
                        finalString = firstArg + secondArg;
                        Console.WriteLine(finalString);
                        break;

                    case OperatorType.Division:
                        Console.WriteLine("Sorry this operation isn't supported with these two types, Heres what are:\nStandard mathematics for numerical arguments\nString + String => Concatenation of strings\nString - String => Remove characters in first string found in second string\nDate/Time - Date/Time => Time Span\nDate/Time +/- Time span => Date/Time\nString * Number => String repeated that number of times\n");
                        break;

                    case OperatorType.Multiplication:
                        Console.WriteLine("Sorry this operation isn't supported with these two types, Heres what are:\nStandard mathematics for numerical arguments\nString + String => Concatenation of strings\nString - String => Remove characters in first string found in second string\nDate/Time - Date/Time => Time Span\nDate/Time +/- Time span => Date/Time\nString * Number => String repeated that number of times\n");

                        break;

                    case OperatorType.Subtraction:
                        finalString = secondArg.Replace(firstArg, "");
                        Console.WriteLine(finalString);

                        break;
                    }
                }
                else if ((argOneType == ArgumentType.TimeSpan && argTwoType == ArgumentType.DateTime) || argOneType == ArgumentType.DateTime && argTwoType == ArgumentType.TimeSpan)
                {
                    DateTime d1 = DateTime.Parse(firstArg);
                    TimeSpan d2 = TimeSpan.Parse(secondArg);
                    DateTime finalDateTime;

                    switch (finalOperator)
                    {
                    case OperatorType.Addition:
                        Console.WriteLine("Sorry this operation isn't supported with these two types, Heres what are:\nStandard mathematics for numerical arguments\nString + String => Concatenation of strings\nString - String => Remove characters in first string found in second string\nDate/Time - Date/Time => Time Span\nDate/Time +/- Time span => Date/Time\nString * Number => String repeated that number of times\n");
                        break;

                    case OperatorType.Division:
                        Console.WriteLine("Sorry this operation isn't supported with these two types, Heres what are:\nStandard mathematics for numerical arguments\nString + String => Concatenation of strings\nString - String => Remove characters in first string found in second string\nDate/Time - Date/Time => Time Span\nDate/Time +/- Time span => Date/Time\nString * Number => String repeated that number of times\n");
                        break;

                    case OperatorType.Multiplication:
                        Console.WriteLine("Sorry this operation isn't supported with these two types, Heres what are:\nStandard mathematics for numerical arguments\nString + String => Concatenation of strings\nString - String => Remove characters in first string found in second string\nDate/Time - Date/Time => Time Span\nDate/Time +/- Time span => Date/Time\nString * Number => String repeated that number of times\n");

                        break;

                    case OperatorType.Subtraction:

                        finalDateTime = d1 - d2;
                        Console.WriteLine(finalDateTime);
                        break;
                    }
                }
                else if (argOneType == ArgumentType.DateTime && argTwoType == ArgumentType.DateTime)

                {
                    DateTime d1 = DateTime.Parse(firstArg);
                    DateTime d2 = DateTime.Parse(secondArg);
                    TimeSpan finalDateTime;

                    switch (finalOperator)
                    {
                    case OperatorType.Addition:
                        Console.WriteLine("Sorry this operation isn't supported with these two types, Heres what are:\nStandard mathematics for numerical arguments\nString + String => Concatenation of strings\nString - String => Remove characters in first string found in second string\nDate/Time - Date/Time => Time Span\nDate/Time +/- Time span => Date/Time\nString * Number => String repeated that number of times\n");
                        break;

                    case OperatorType.Division:
                        Console.WriteLine("Sorry this operation isn't supported with these two types, Heres what are:\nStandard mathematics for numerical arguments\nString + String => Concatenation of strings\nString - String => Remove characters in first string found in second string\nDate/Time - Date/Time => Time Span\nDate/Time +/- Time span => Date/Time\nString * Number => String repeated that number of times\n");
                        break;

                    case OperatorType.Multiplication:
                        Console.WriteLine("Sorry this operation isn't supported with these two types, Heres what are:\nStandard mathematics for numerical arguments\nString + String => Concatenation of strings\nString - String => Remove characters in first string found in second string\nDate/Time - Date/Time => Time Span\nDate/Time +/- Time span => Date/Time\nString * Number => String repeated that number of times\n");

                        break;

                    case OperatorType.Subtraction:

                        finalDateTime = d1 - d2;
                        Console.WriteLine(finalDateTime);
                        break;
                    }
                }
                else if (argOneType == ArgumentType.String && argTwoType == ArgumentType.Number)
                {
                    int    finalSecond = int.Parse(secondArg);
                    string finalString = "";
                    switch (finalOperator)
                    {
                    case OperatorType.Addition:
                        Console.WriteLine("Sorry this operation isn't supported with these two types, Heres what are:\nStandard mathematics for numerical arguments\nString + String => Concatenation of strings\nString - String => Remove characters in first string found in second string\nDate/Time - Date/Time => Time Span\nDate/Time +/- Time span => Date/Time\nString * Number => String repeated that number of times\n");
                        break;

                    case OperatorType.Division:
                        Console.WriteLine("Sorry this operation isn't supported with these two types, Heres what are:\nStandard mathematics for numerical arguments\nString + String => Concatenation of strings\nString - String => Remove characters in first string found in second string\nDate/Time - Date/Time => Time Span\nDate/Time +/- Time span => Date/Time\nString * Number => String repeated that number of times\n");
                        break;

                    case OperatorType.Multiplication:
                        for (int i = 0; i < finalSecond; i++)
                        {
                            finalString += firstArg;
                        }
                        Console.WriteLine(finalString);
                        break;

                    case OperatorType.Subtraction:
                        Console.WriteLine("Sorry this operation isn't supported with these two types, Heres what are:\nStandard mathematics for numerical arguments\nString + String => Concatenation of strings\nString - String => Remove characters in first string found in second string\nDate/Time - Date/Time => Time Span\nDate/Time +/- Time span => Date/Time\nString * Number => String repeated that number of times\n");

                        break;
                    }
                }

                else if (argOneType == ArgumentType.Number && argTwoType == ArgumentType.Number)
                {
                    int finalFirst  = int.Parse(firstArg);
                    int finalSecond = int.Parse(secondArg);

                    switch (finalOperator)
                    {
                    case OperatorType.Addition:
                        Console.WriteLine(finalFirst + finalSecond);

                        break;

                    case OperatorType.Division:
                        Console.WriteLine(finalFirst / finalSecond);

                        break;

                    case OperatorType.Multiplication:
                        Console.WriteLine(finalFirst * finalSecond);


                        break;

                    case OperatorType.Subtraction:
                        Console.WriteLine(finalFirst - finalSecond);


                        break;
                    }
                }

                Console.WriteLine("Press CTRL+C if you would like to exit\n");
            }
        }
 public UnaryOperatorNode(OperatorType operatorType)
 {
     OperatorType = operatorType;
     NodeType     = NodeType.UnaryOperatorNode;
 }
Exemple #48
0
 public ConditionalOperatorToken(OperatorType operatorType = OperatorType.EqualTo, TokenOpType opType = TokenOpType.Expression, ConditionalTokens tokens = null)
     : base(opType, tokens)
 {
     OperatorType = operatorType;
 }
        static private bool GetOperatorType(string operation, char?pred_symbol, out OperatorType type)
        {
            switch (operation)
            {
            case "(":
                type = OperatorType.LeftBracket;
                break;

            case ")":
                type = OperatorType.RightBracket;
                break;

            //case "++":
            //    type = OperatorType.Increment;
            //    break;
            //case "--":
            //    type = OperatorType.Decrement;
            //    break;
            case "-":
                if (pred_symbol == null || pred_symbol == '(')
                {
                    type = OperatorType.UnaryMinus;
                }
                else
                {
                    type = OperatorType.Substract;
                }
                break;

            case "+":
                if (pred_symbol == null || pred_symbol == '(')
                {
                    type = OperatorType.UnaryPlus;
                }
                else
                {
                    type = OperatorType.Add;
                }
                break;

            case "!":
                type = OperatorType.Not;
                break;

            case "*":
                type = OperatorType.Multiply;
                break;

            case "/":
                type = OperatorType.Divide;
                break;

            case "%":
                type = OperatorType.ModuleDivide;
                break;

            case "<<":
                type = OperatorType.LeftShift;
                break;

            case ">>":
                type = OperatorType.RightShift;
                break;

            case ">":
                type = OperatorType.More;
                break;

            case "<":
                type = OperatorType.Less;
                break;

            case ">=":
                type = OperatorType.MoreOrEqual;
                break;

            case "<=":
                type = OperatorType.LessOrEqual;
                break;

            case "==":
                type = OperatorType.Equal;
                break;

            case "!=":
                type = OperatorType.NotEqual;
                break;

            case "&":
                type = OperatorType.And;
                break;

            case "^":
                type = OperatorType.Xor;
                break;

            case "|":
                type = OperatorType.Or;
                break;

            default:
                type = OperatorType.None;
                return(false);
            }
            return(true);
        }
 public OperatorRenderingExpressionItem(OperatorType type)
 {
     mvarType = type;
 }
Exemple #51
0
        public static TokenRole GetRole(OperatorType type)
        {
            switch (type)
            {
            case OperatorType.LogicalNot:
                return(LogicalNotRole);

            case OperatorType.OnesComplement:
                return(OnesComplementRole);

            case OperatorType.Increment:
                return(IncrementRole);

            case OperatorType.Decrement:
                return(DecrementRole);

            case OperatorType.True:
                return(TrueRole);

            case OperatorType.False:
                return(FalseRole);

            case OperatorType.Addition:
            case OperatorType.UnaryPlus:
                return(AdditionRole);

            case OperatorType.Subtraction:
            case OperatorType.UnaryNegation:
                return(SubtractionRole);

            case OperatorType.Multiply:
                return(MultiplyRole);

            case OperatorType.Division:
                return(DivisionRole);

            case OperatorType.Modulus:
                return(ModulusRole);

            case OperatorType.BitwiseAnd:
                return(BitwiseAndRole);

            case OperatorType.BitwiseOr:
                return(BitwiseOrRole);

            case OperatorType.ExclusiveOr:
                return(ExclusiveOrRole);

            case OperatorType.LeftShift:
                return(LeftShiftRole);

            case OperatorType.RightShift:
                return(RightShiftRole);

            case OperatorType.Equality:
                return(EqualityRole);

            case OperatorType.Inequality:
                return(InequalityRole);

            case OperatorType.GreaterThan:
                return(GreaterThanRole);

            case OperatorType.LessThan:
                return(LessThanRole);

            case OperatorType.GreaterThanOrEqual:
                return(GreaterThanOrEqualRole);

            case OperatorType.LessThanOrEqual:
                return(LessThanOrEqualRole);

            case OperatorType.Implicit:
                return(ImplicitRole);

            case OperatorType.Explicit:
                return(ExplicitRole);

            default:
                throw new System.ArgumentOutOfRangeException();
            }
        }
Exemple #52
0
        public static ModernModeStatsContainer <IEnumerable <ModernStatsTrend> > GetModernStatsTrendFor <T>(this T client, AccountInfo account, PlaylistType playlistType = PlaylistType.All, OperatorType operatorType = OperatorType.Independent, TrendSpan trendSpan = TrendSpan.Weekly, DateTimeOffset?startDate = null, DateTimeOffset?endDate = null)
            where T : ModernDragon6Client
        {
            var request = new ModernStatsTrendRequest(account)
            {
                Playlist     = playlistType,
                OperatorType = operatorType,
                TrendSpan    = trendSpan
            };

            ValueUtils.ApplyValue(startDate, s => request.StartDate = s);
            ValueUtils.ApplyValue(endDate, e => request.EndDate     = e);

            return(client.Perform <JObject>(request)
                   .ProcessData <IEnumerable <ModernStatsTrend> >(request, client));
        }
Exemple #53
0
 public TokenOperator(OperatorType operatorType, bool unary) :
     this(unary) {
     OperatorType = operatorType;
 }
Exemple #54
0
 public TokenItem(OperatorType opType)
 {
     Type        = TokenType.Operator;
     Operator    = Operator.Operators[opType];
     TokenString = Operator.OperatorString;
 }
Exemple #55
0
 static OperatorPattern OperatorNN(OperatorType type)
 {
     return(new OperatorPattern(type, false));
 }
Exemple #56
0
 public Value operate(OperatorType op_type, Value val2)
 {
     // This is needed to be able to use the class in a list.
     return(null);
 }
Exemple #57
0
 public IBinaryOperator BinaryOperation(OperatorType Operator)
 {
     return(binaryOperators[Operator]);
 }
Exemple #58
0
 public T this[OperatorType type] => type switch
 {
Exemple #59
0
 public IUnaryOperator UnaryOperation(OperatorType Operator)
 {
     return(unaryOperators[Operator]);
 }
 public Conditional(string op, int precedence, OperatorType ot, ushort biffCode, uint functionCode, short numOfArgs)
     : base(op, precedence, ot, biffCode, functionCode, numOfArgs)
 {
 }