コード例 #1
0
        /// <summary>
        /// Μέθοδος που αποθηκεύει το σύμβολο ενός χαρτιού.
        /// </summary>
        /// <param name="charSymbol"> Η συμβολοσειρά από την οποία θα πάρει το σύμβολο </param>
        /// <returns> σύμβολο χαρτιού </returns>
        private SymbolEnum readSymbol(char ch)
        {
            SymbolEnum resultSymbol = SymbolEnum.Empty;

            switch (ch)
            {
            case 'H':
            case 'h':
                resultSymbol = SymbolEnum.Hearts;
                break;

            case 'D':
            case 'd':
                resultSymbol = SymbolEnum.Diamonds;
                break;

            case 'C':
            case 'c':
                resultSymbol = SymbolEnum.Clubs;
                break;

            case 'S':
            case 's':
                resultSymbol = SymbolEnum.Spades;
                break;
            }
            return(resultSymbol);
        }
コード例 #2
0
ファイル: Area.cs プロジェクト: sdercolin/ciphervitx-unity
 /// <summary>
 /// 是否包含具备某势力的卡
 /// </summary>
 /// <param name="symbol">要查找的势力</param>
 /// <returns></returns>
 public bool HasSymbolOf(SymbolEnum symbol)
 {
     return(!list.TrueForAll(bondcard =>
     {
         return !(bondcard.FrontShown && bondcard.HasSymbol(symbol));
     }));
 }
コード例 #3
0
        // static
        public static RomanNumber Create(string symbol)
        {
            SymbolEnum type = (SymbolEnum)Enum.Parse(typeof(SymbolEnum), symbol);

            switch (type)
            {
            case SymbolEnum.I:
                return(I);

            case SymbolEnum.V:
                return(V);

            case SymbolEnum.X:
                return(X);

            case SymbolEnum.L:
                return(L);

            case SymbolEnum.C:
                return(C);

            case SymbolEnum.D:
                return(D);

            case SymbolEnum.M:
                return(M);

            default:
                return(null);
            }
        }
コード例 #4
0
 public static string ToDescriptionString(this SymbolEnum val)
 {
     DescriptionAttribute[] attributes = (DescriptionAttribute[])val
                                         .GetType()
                                         .GetField(val.ToString())
                                         .GetCustomAttributes(typeof(DescriptionAttribute), false);
     return(attributes.Length > 0 ? attributes[0].Description : string.Empty);
 }
コード例 #5
0
        public override string ToString()
        {
            string coefs = "";

            for (int i = 0; i < Coefficients.Count; i++)
            {
                coefs += Coefficients[i] + " ";
            }
            return(coefs + SymbolEnum.ToDescriptionString() + " " + FreeValue);
        }
コード例 #6
0
 public SymbolPainter(SymbolEnum symbol, bool fill, int penWidth, Color forecolor, Color hoverPen, Color clickPen)
 {
     _symbol    = symbol;
     _fill      = fill;
     _penWidth  = penWidth;
     _color     = forecolor;
     _hoverPen  = new Pen(hoverPen, penWidth);
     _clickPen  = new Pen(clickPen, penWidth);
     _pen       = new Pen(_color, penWidth);
     _fillBrush = new SolidBrush(forecolor);
 }
コード例 #7
0
 public SymbolPainter(SymbolEnum symbol, bool fill, int penWidth, Color forecolor, Color hoverPen, Color clickPen)
 {
     this.symbol    = symbol;
     this.fill      = fill;
     this.penWidth  = penWidth;
     this.color     = forecolor;
     this.hoverPen  = new Pen(hoverPen, penWidth);
     this.clickPen  = new Pen(clickPen, penWidth);
     this.pen       = new Pen(color, penWidth);
     this.fillBrush = new SolidBrush(forecolor);
 }
コード例 #8
0
 private void Accept(SymbolEnum expectedSymbol)
 {
     if (lexicalAnalyzer.CurrentSymbol != expectedSymbol)
     {
         Error(symbolToErrorCodeMapping[expectedSymbol]);
     }
     else
     {
         NextSymbol();
     }
 }
 public void ParseSymbol(SymbolEnum symbol)
 {
     if (_tokens.Current is SymbolToken)
     {
         if (((SymbolToken)_tokens.Current).symbol == symbol)
         {
             return;
         }
         throw new Exception("Syntax error with unexpect symbol :" + _tokens.Current.str);
     }
     throw new Exception("Syntax error with unexpect token :" + _tokens.Current.str);
 }
コード例 #10
0
 /// <summary>
 /// The constructor used to build a card.
 /// </summary>
 /// <param name="suit">The suit of the card.</param>
 /// <param name="symbol">The symbol of the card.</param>
 public Card(
     SuitEnum suit,
     SymbolEnum symbol)
 {
     Suit         = suit;
     Symbol       = symbol;
     SuitString   = suit.ToString();
     SymbolString = symbol.ToString();
     CardValue    = (int)symbol;
     IsAce        = Symbol == SymbolEnum.Ace;
     IsFaceCard   = Value >= (int)SymbolEnum.Jack;
 }
コード例 #11
0
        public List <string> ToStringList()
        {
            var result = new List <string>();

            foreach (var coef in Coefficients)
            {
                result.Add(coef.ToString());
            }
            result.Add(SymbolEnum.ToDescriptionString());
            result.Add(FreeValue.ToString());
            return(result);
        }
コード例 #12
0
ファイル: SymbolPainter.cs プロジェクト: deveck/Deveck.Utils
        public SymbolPainter(SymbolEnum symbol, bool fill, int penWidth, Color forecolor, Color hoverPen, Color clickPen)
        {
            _symbol = symbol;
            _fill = fill;
            _penWidth = penWidth;
            _color = forecolor;
            _hoverPen = new Pen(hoverPen, penWidth);
            _clickPen = new Pen(clickPen, penWidth);
            _pen = new Pen(_color, penWidth);
            _fillBrush = new SolidBrush(forecolor);

            

        }
コード例 #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InputMarketIndex" /> class.
        /// </summary>
        /// <param name="symbol">Market index (required).</param>
        /// <param name="date">Date (yyyy-MM-dd, leave empty for last trading day).</param>
        public InputMarketIndex(SymbolEnum symbol = default(SymbolEnum), string date = default(string))
        {
            // to ensure "symbol" is required (not null)
            if (symbol == null)
            {
                throw new InvalidDataException("symbol is a required property for InputMarketIndex and cannot be null");
            }
            else
            {
                this.Symbol = symbol;
            }

            this.Date = date;
        }
コード例 #14
0
        private void NextSymbol()
        {
            if (symbolQueue.Count > 0)
            {
                CurrentSymbol = symbolQueue.Dequeue();
                return;
            }

            do
            {
                lexicalAnalyzer.NextSymbol();
            }while (lexicalAnalyzer.Error != null && !lexicalAnalyzer.IsFinished);

            CurrentSymbol = lexicalAnalyzer.CurrentSymbol;
        }
コード例 #15
0
        public static TypeDesc GetTypeAfterAddition(TypeDesc type1, TypeDesc type2, SymbolEnum operation)
        {
            if (type1 == null || type2 == null)
            {
                return(null);
            }

            switch (operation)
            {
            case SymbolEnum.Plus:
                if (type1 == TypeDesc.integerType && type2 == TypeDesc.integerType)
                {
                    return(TypeDesc.integerType);
                }
                if (type1 == TypeDesc.integerType && type2 == TypeDesc.realType ||
                    type1 == TypeDesc.realType && type2 == TypeDesc.integerType ||
                    type1 == TypeDesc.realType && type2 == TypeDesc.realType)
                {
                    return(TypeDesc.realType);
                }
                return(null);

            case SymbolEnum.Minus:
                if (type1 == TypeDesc.integerType && type2 == TypeDesc.integerType)
                {
                    return(TypeDesc.integerType);
                }
                if (type1 == TypeDesc.integerType && type2 == TypeDesc.realType ||
                    type1 == TypeDesc.realType && type2 == TypeDesc.integerType ||
                    type1 == TypeDesc.realType && type2 == TypeDesc.realType)
                {
                    return(TypeDesc.realType);
                }
                return(null);

            case SymbolEnum.OrSy:
                if (type1 == TypeDesc.booleanType && type2 == TypeDesc.booleanType)
                {
                    return(TypeDesc.booleanType);
                }
                return(null);

            default:
                return(null);
            }
        }
コード例 #16
0
        /// <summary>Makes the HTTP request (Sync).</summary>
        /// <param name="side">Order side</param>
        /// <param name="symbol">Currency symbol for order</param>
        /// <param name="orderType">Order type</param>
        /// <param name="timeInForce">Time in force for order</param>
        /// <param name="qty">Order quantity of perpetual contracts to buy or sell</param>
        /// <param name="price">Order price of perpetual contracts to buy or sell.</param>
        /// <param name="takeProfit">Order take profit (TP) price</param>
        /// <param name="stopLoss">Order stop loss (SL) price </param>
        /// <param name="reduceOnly">Reduce only</param>
        /// <param name="closeOnTrigger">Closing trigger.  When creating a closing order, it is highly recommended to set as true to avoid failing by insufficient available margin.</param>
        /// <param name="orderLinkId">Custom order identifier.</param>
        /// <param name="trailingStop">Order trailing stop (TS) units.</param>
        /// <remarks>As of 20190117 ByBit only support order quantity in an integer.</remarks>
        /// <returns><see cref="OrderResBase"/> object.</returns>
        public OrderResBase CallApi(SideEnum side, SymbolEnum symbol, OrderTypeEnum orderType, TimeInForceEnum timeInForce, decimal qty, double price, double?takeProfit = null, double?stopLoss = null, bool?reduceOnly = null, bool?closeOnTrigger = null, string orderLinkId = null, string trailingStop = null)
        {
            formParams.Add("side", Configuration.ApiClient.ParameterToString(side));                    // form parameter
            formParams.Add("symbol", Configuration.ApiClient.ParameterToString(symbol));                // form parameter
            formParams.Add("order_type", Configuration.ApiClient.ParameterToString(orderType));         // form parameter
            formParams.Add("time_in_force", Configuration.ApiClient.ParameterToString(timeInForce));    // form parameter
            formParams.Add("qty", Configuration.ApiClient.ParameterToString(qty));                      // form parameter
            queryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "price", price)); // query parameter
            if (takeProfit != null)
            {
                queryParams.AddRange(Configuration.ApiClient.ParameterToKeyValuePairs("", "take_profit", takeProfit)); // query parameter
            }

            if (stopLoss != null)
            {
                formParams.Add("stop_loss", Configuration.ApiClient.ParameterToString(stopLoss)); // form parameter
            }

            if (reduceOnly != null)
            {
                formParams.Add("reduce_only", Configuration.ApiClient.ParameterToString(reduceOnly)); // form parameter
            }

            if (closeOnTrigger != null)
            {
                formParams.Add("close_on_trigger", Configuration.ApiClient.ParameterToString(closeOnTrigger)); // form parameter
            }

            if (orderLinkId != null)
            {
                formParams.Add("order_link_id", Configuration.ApiClient.ParameterToString(orderLinkId)); // form parameter
            }

            if (trailingStop != null)
            {
                formParams.Add("trailing_stop", Configuration.ApiClient.ParameterToString(trailingStop)); // form parameter
            }

            IRestResponse localVarResponse = CallApi(path, Method.POST, queryParams, formParams, headerParams);

            return(ProcessRestResponce(localVarResponse).Data);
        }
コード例 #17
0
        private List <Google.OrTools.LinearSolver.Constraint> CreateConstraints(Solver solver, List <Constraint> _constraints)
        {
            //create constraints
            List <Google.OrTools.LinearSolver.Constraint> constraints = new List <Google.OrTools.LinearSolver.Constraint>();

            for (int i = 0; i < _constraints.Count; i++)
            {
                Google.OrTools.LinearSolver.Constraint c;
                SymbolEnum symbolEnum = _constraints[i].SymbolEnum;
                switch (symbolEnum)
                {
                case SymbolEnum.Equal: { c = solver.MakeConstraint(_constraints[i].FreeValue, _constraints[i].FreeValue); constraints.Add(c); break; }

                case SymbolEnum.LessOrEqual: { c = solver.MakeConstraint(double.NegativeInfinity, _constraints[i].FreeValue); constraints.Add(c); break; }

                case SymbolEnum.MoreOrEqual: { c = solver.MakeConstraint(_constraints[i].FreeValue, double.PositiveInfinity); constraints.Add(c); break; }
                }
            }
            return(constraints);
        }
コード例 #18
0
ファイル: Card.cs プロジェクト: sdercolin/ciphervitx-unity
    /// <summary>
    /// 是否具备某个势力
    /// </summary>
    /// <param name="symbol">势力</param>
    /// <returns></returns>
    public bool HasSymbol(SymbolEnum symbol)
    {
        bool hasNow = symbols.Contains(symbol);

        BuffList.ForEach(x =>
        {
            SymbolBuff buff = x as SymbolBuff;
            if (buff != null)
            {
                if (buff.IsAdding)
                {
                    hasNow = true;
                    return;
                }
                else
                {
                    hasNow = false;
                }
            }
        });
        return(hasNow);
    }
コード例 #19
0
        // <простой тип> ::= <перечислимый тип> | <ограниченный тип> | <имя типа>
        private void SimpleType(HashSet <SymbolEnum> followers)
        {
            if (IsStartSubrangeType(CurrentSymbol) && CurrentSymbol != SymbolEnum.Identifier)
            {
                NeutralizerDecorator(SubrangeType, Starters.SubrangeType, Followers.SubrangeType, FORBIDDEN_SYMBOL_ERROR_CODE, followers);
            }
            else if (CurrentSymbol == SymbolEnum.Identifier)
            {
                var identifier = FindIdentifier(lexicalAnalyzer.IdentifierName);

                NextSymbol();
                if (CurrentSymbol == SymbolEnum.TwoDots)
                {
                    CurrentSymbol = SymbolEnum.Identifier;
                    symbolQueue.Enqueue(SymbolEnum.TwoDots);
                    NeutralizerDecorator(SubrangeType, Starters.SubrangeType, Followers.SubrangeType, FORBIDDEN_SYMBOL_ERROR_CODE, followers);
                }
                else
                {
                    lastVarDeclarationType = identifier.type;
                }
            }
        }
コード例 #20
0
        //private void RepeatStatement()
        //{
        //    Accept(SymbolEnum.RepeatSy);
        //    Statement();
        //    while (CurrentSymbol == SymbolEnum.Semicolon)
        //    {
        //        NextSymbol();
        //        Statement();
        //    }
        //    Accept(SymbolEnum.UntilSy);
        //    Expression();
        //}

        //private void ForStatement()
        //{
        //    Accept(SymbolEnum.ForSy);
        //    ForStatementParameter();
        //    Accept(SymbolEnum.Assign);
        //    ForList();
        //    Accept(SymbolEnum.DoSy);
        //    Statement();
        //}

        //private void ForStatementParameter()
        //{
        //    Accept(SymbolEnum.Identifier);
        //}

        //private void ForList()
        //{
        //    Expression();
        //    if (CurrentSymbol == SymbolEnum.ToSy || CurrentSymbol == SymbolEnum.DowntoSy)
        //    {
        //        NextSymbol();
        //    }
        //    Expression();
        //}

        //private void WithStatement()
        //{
        //    // TODO
        //}

        private bool IsComparisonOperator(SymbolEnum symbol)
        {
            SymbolEnum[] allowedSymbols = { SymbolEnum.Equals, SymbolEnum.NotEquals, SymbolEnum.Less, SymbolEnum.LessEquals, SymbolEnum.GreaterEquals, SymbolEnum.Greater, SymbolEnum.InSy };
            return(allowedSymbols.Contains(symbol));
        }
コード例 #21
0
 private bool IsStartRepetitiveStatement(SymbolEnum symbol)
 {
     SymbolEnum[] allowedSymbols = { SymbolEnum.WhileSy };
     return(allowedSymbols.Contains(symbol));
 }
コード例 #22
0
 private bool IsStartStructuredStatement(SymbolEnum symbol)
 {
     return(CurrentSymbol == SymbolEnum.BeginSy || CurrentSymbol == SymbolEnum.IfSy || IsStartRepetitiveStatement(symbol));
 }
コード例 #23
0
 private bool IsStartSimpleStatement(SymbolEnum symbol)
 {
     return(CurrentSymbol == SymbolEnum.Identifier);
 }
コード例 #24
0
 private bool IsStartStructuredType(SymbolEnum symbol)
 {
     SymbolEnum[] allowedSymbols = { SymbolEnum.ArraySy };
     return(allowedSymbols.Contains(symbol));
 }
コード例 #25
0
ファイル: SymbolPainter.cs プロジェクト: deveck/Deveck.Utils
 public static Painter Create(Painter backgroundPainter, SymbolEnum symbol, bool fill, int penWidth, Color forecolor, Color hoverColor, Color clickColor)
 {
     return new StackedPainters(
         new PainterFilterNoText(backgroundPainter),
         new SymbolPainter(symbol, fill, penWidth, forecolor, hoverColor, clickColor));
 }
コード例 #26
0
 private bool IsStartSubrangeType(SymbolEnum symbol)
 {
     SymbolEnum[] allowedSymbols = { SymbolEnum.Minus, SymbolEnum.Plus, SymbolEnum.IntConstant, SymbolEnum.RealConstant, SymbolEnum.Identifier, SymbolEnum.CharConstant };
     return(allowedSymbols.Contains(symbol));
 }
コード例 #27
0
 private bool IsStartSimpleType(SymbolEnum symbol)
 {
     return(IsStartSubrangeType(symbol) || symbol == SymbolEnum.Identifier);
 }
コード例 #28
0
 public Card(int number, SymbolEnum symbol)
 {
     Number = number;
     Symbol = symbol;
 }
コード例 #29
0
ファイル: Buff.cs プロジェクト: sdercolin/ciphervitx-unity
 public SymbolBuff(Skill origin, bool isAdding, SymbolEnum value, LastingTypeEnum lastingType = LastingTypeEnum.Forever) : base(origin, lastingType)
 {
     IsAdding = isAdding;
     Value    = value;
 }
コード例 #30
0
 public string[] Call(string s, SymbolEnum univ_pos, Dictionary <string, string> morphology)
 {
     throw new NotImplementedException();
 }
コード例 #31
0
 public bool IsBaseForm(SymbolEnum univ_pos, Dictionary <string, string> morphology)
 {
     throw new NotImplementedException();
 }
コード例 #32
0
        public static TypeDesc GetTypeAfterMultiplication(TypeDesc type1, TypeDesc type2, SymbolEnum operation)
        {
            if (type1 == null || type2 == null)
            {
                return(null);
            }

            switch (operation)
            {
            case SymbolEnum.Star:
                if (type1 == TypeDesc.integerType && type2 == TypeDesc.integerType)
                {
                    return(TypeDesc.integerType);
                }
                if (type1 == TypeDesc.integerType && type2 == TypeDesc.realType ||
                    type1 == TypeDesc.realType && type2 == TypeDesc.integerType ||
                    type1 == TypeDesc.realType && type2 == TypeDesc.realType)
                {
                    return(TypeDesc.realType);
                }
                return(null);

            case SymbolEnum.Slash:
                if (type1 == TypeDesc.integerType && type2 == TypeDesc.integerType ||
                    type1 == TypeDesc.integerType && type2 == TypeDesc.realType ||
                    type1 == TypeDesc.realType && type2 == TypeDesc.integerType ||
                    type1 == TypeDesc.realType && type2 == TypeDesc.realType)
                {
                    return(TypeDesc.realType);
                }
                return(null);

            case SymbolEnum.ModSy:
            case SymbolEnum.DivSy:
                if (type1 == TypeDesc.integerType && type2 == TypeDesc.integerType)
                {
                    return(TypeDesc.integerType);
                }
                return(null);

            case SymbolEnum.AndSy:
                if (type1 == TypeDesc.booleanType && type2 == TypeDesc.booleanType)
                {
                    return(TypeDesc.booleanType);
                }
                return(null);

            default:
                return(null);
            }
        }