Ejemplo n.º 1
0
 public CandleEventArg(CandleEventType _eventtype, IPair Candle, CandlesSeries _candlescopy)
 {
     this.EventType    = _eventtype;
     this.ComingCandle = Candle;
     this.Collected    = Candle.CollectedDate;
     this.Candlescopy  = _candlescopy;
 }
Ejemplo n.º 2
0
        private IPair <Element> ParseOrExpr(Token token)
        {
            var             startLoc = token.Range.Start;
            IPair <Element> pair     = ParseAndExpr(token);

            if (pair == null)
            {
                return(null);
            }
            while (true)
            {
                token = pair.Token;
                if (token is OrOpToken)
                {
                    var opToken   = (OrOpToken)token;
                    var rightPair = ParseAndExpr(token.Next);
                    if (rightPair == null)
                    {
                        throw Error("右辺が見つかりません。", token.Next);
                    }
                    var range = new TextRange(startLoc, rightPair.Token.Range.End);
                    pair = MakePair(new BinaryExpr(pair.Node, BinaryOperationType.Or, rightPair.Node, range), rightPair.Token);
                }
                else
                {
                    break;
                }
            }
            return(pair);
        }
Ejemplo n.º 3
0
        private IPair <Element> ParseUnknownMultipleExpr(Token token)
        {
            IPair <Element> pair = ParseUnaryExpr(token);

            if (pair == null)
            {
                return(null);
            }
            var startLoc = token.Range.Start;

            while (true)
            {
                token = pair.Token;
                if (token is UnknownOperatorToken)
                {
                    var rightPair = ParseUnaryExpr(token.Next);
                    if (rightPair == null)
                    {
                        throw Error("右辺が見つかりません。", token.Next);
                    }
                    var range = new TextRange(startLoc, rightPair.Token.Range.End);
                    pair = MakePair(new BinaryExpr(pair.Node, BinaryOperationType.Unknown, rightPair.Node, range), rightPair.Token);
                }
                else
                {
                    break;
                }
            }
            return(pair);
        }
Ejemplo n.º 4
0
        private IPair <Element> ParseAddExpr(Token token)
        {
            IPair <Element> pair = ParseMultipleExpr(token);

            if (pair == null)
            {
                return(null);
            }
            var startLoc = token.Range.Start;

            while (true)
            {
                token = pair.Token;
                var opType =
                    token is AddOpToken ? BinaryOperationType.Add :
                    token is SubOpToken ? BinaryOperationType.Subtract :
                    BinaryOperationType.Unknown;

                if (opType != BinaryOperationType.Unknown)
                {
                    var rightPair = ParseMultipleExpr(token.Next);
                    if (rightPair == null)
                    {
                        throw Error("右辺が見つかりません。", token.Next);
                    }
                    var range = new TextRange(startLoc, rightPair.Token.Range.End);
                    pair = MakePair(new BinaryExpr(pair.Node, opType, rightPair.Node, range), rightPair.Token);
                }
                else
                {
                    break;
                }
            }
            return(pair);
        }
Ejemplo n.º 5
0
        //  constructor
        public Order()
        {
            type_ = 0;

            param1_ = new IPair();
            param2_ = new IPair();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// اعمال مجوز تاخیر مجاز بعد از ماموریت ساعت 23
        /// </summary>
        /// <param name="MyRule"></param>
        public void R4503(AssignedRule MyRule)
        {
            //3021 تاخیر مجاز
            //تاخیر ساعتي 3029
            //201 کد پیشکارت درخواست تاخیر مجاز ماموریت

            /*if (this.DoConcept(3029).Value > 0)
             * {
             *  PairableScndCnpValue late = ((PairableScndCnpValue)this.DoConcept(3029));
             *  Permit permit = this.Person.GetPermitByDate(this.RuleCalculateDate, EngEnvironment.GetPrecard(201));
             *  if (permit != null && (permit.Value > 0 || permit.PairCount > 0))
             *  {
             *      IPair pair = new ShiftPair();
             *      pair.From = this.Person.GetShiftByDate(this.RuleCalculateDate).Pairs.OrderBy(x => x.From).First().From;
             *      pair.To = pair.From + MyRule["First", this.RuleCalculateDate].ToInt();
             *      this.DoConcept(3021).Value = Operation.Intersect(pair, late).Value;
             *      ((PairableScndCnpValue)this.DoConcept(3029)).AddPairs(Operation.Differance(late, pair));
             *      this.ReCalculate(13, 3020, 3028);
             *  }
             * }*/

            Permit permit = this.Person.GetPermitByDate(this.RuleCalculateDate, EngEnvironment.GetPrecard(201));

            if (permit != null && (permit.Value > 0 || permit.PairCount > 0))
            {
                GetLog(MyRule, DebugRuleState.Before, 4002);
                IPair pair  = permit.Pairs.First();
                IPair mojaz = new ShiftPair(1, 6 * 60);
                PairableScndCnpValue overtime = Operation.Intersect(pair, mojaz);
                ((PairableScndCnpValue)this.DoConcept(4002)).AppendPairs(overtime);
                GetLog(MyRule, DebugRuleState.After, 4002);
            }
        }
Ejemplo n.º 7
0
        //  overload
        public override void Update()
        {
            base.Update();   //  count for life
            //delta
            IPair delta = new IPair();

            if (move_vector_ != null)
            {
                delta.Add(move_vector_);
            }
            delta.Add(repulse_);
            pos_.Add(delta);
            if (GameDef.CollisionWall(pos_, Radius))
            {
                Explode = true;
            }
            //if (delta.Zero()) Explode = true;
            //  effect update
            if (effect_list_ != null)
            {
                foreach (Effect effect in effect_list_)
                {
                    //  特效也會做平移
                    effect.Pos.Add(delta);  //  effect update 由 list 執行
                }
            }
        }
Ejemplo n.º 8
0
 public override void Update()
 {
     base.Update();
     foreach (Unit unit in Game.Unit_List)
     {
         if (unit == Caster)
         {
             continue;
         }
         IPair delta  = Pos - unit.Pos;
         int   radius = (RADIUS + unit.Radius) * GameDef.PIXEL_SCALE;
         if (delta.LengthSquare() > radius * radius || delta.Zero())
         {
             continue;
         }
         delta.ChangeLength(STRENGTH);
         unit.AddRepulse(delta);
     }
     foreach (Missile missile in Game.Missile_List)
     {
         if (missile.Caster == Caster)
         {
             continue;
         }
         IPair delta  = Pos - missile.Pos;
         int   radius = (RADIUS + missile.Radius) * GameDef.PIXEL_SCALE;
         if (delta.LengthSquare() > radius * radius || delta.Zero())
         {
             continue;
         }
         delta.ChangeLength(STRENGTH);
         missile.AddRepulse(delta);
     }
 }
Ejemplo n.º 9
0
        public virtual void CheckCollision(Unit unit)
        {
            IPair delta            = pos_ - unit.Pos;
            int   collision_radius = (radius_ + unit.Radius) * GameDef.PIXEL_SCALE;

            if (delta.LengthSquare() > collision_radius * collision_radius)
            {
                return;
            }
            if (caster_ == unit)
            {
                if (hurt_self_)
                {
                    Collision = true;
                }
            }
            else
            {
                Collision = true;
                if (explode_enemy_)
                {
                    Explode = true;
                }
            }
        }
Ejemplo n.º 10
0
        private IPair <TKey, TValue> Push(IPair <TKey, TValue> node)
        {
            LinearAddition(node);
            //BinarySearchAddition(node);

            return(node);
        }
Ejemplo n.º 11
0
        private void Push(IPair <TKey, TValue> node)
        {
            _heap.Add(node);

            var i    = _heap.Count - 1;
            var flag = true;

            if (Type == HeapType.MaxHeap)
            {
                flag = false;
            }

            while (i > 0)
            {
                if ((_heap[i].CompareTo(_heap[(i - 1) / 2]) > 0) ^ flag)
                {
                    var temp = _heap[i];
                    _heap[i]           = _heap[(i - 1) / 2];
                    _heap[(i - 1) / 2] = temp;
                    i = (i - 1) / 2;
                }
                else
                {
                    break;
                }
            }
        }
Ejemplo n.º 12
0
        ///////////////////////////////////////////////////////////////////////

        internal ArgumentList( /* NOTE: For [apply] and [proc] use only. */
            StringPairList list,
            ArgumentFlags flags
            )
            : this()
        {
            if (list != null)
            {
                int count = list.Count;

                for (int index = 0; index < count; index++)
                {
                    IPair <string> element = list[index];

                    //
                    // HACK: Skip over any null entries, thus ignoring
                    //       them.
                    //
                    if (element == null)
                    {
                        continue;
                    }

                    //
                    // NOTE: Does this argument list accept a variable
                    //       numbers of arguments (COMPAT: Tcl)?  If so,
                    //       add a flag to the final argument to mark it
                    //       as an "argument list".
                    //
                    ArgumentFlags nameFlags = ArgumentFlags.None;

                    if ((index == (count - 1)) && String.Compare(
                            element.X, TclVars.Arguments,
                            StringOps.SystemStringComparisonType) == 0)
                    {
                        nameFlags |= ArgumentFlags.ArgumentList;
                    }

                    ArgumentFlags valueFlags = (element.Y != null) ?
                                               ArgumentFlags.HasDefault : ArgumentFlags.None;

                    Argument argument;

                    if (FlagOps.HasFlags(flags, ArgumentFlags.NameOnly, true))
                    {
                        argument = Argument.InternalCreate(
                            flags | nameFlags | valueFlags, element.X,
                            Argument.NoValue, element.Y);
                    }
                    else
                    {
                        argument = Argument.InternalCreate(
                            flags | nameFlags | valueFlags, Argument.NoName,
                            element.X, element.Y);
                    }

                    this.Add(argument);
                }
            }
        }
Ejemplo n.º 13
0
        public override void Cast(Unit unit, IPair destination, Effect[] effect_list)
        {
            base.Cast(unit, destination, effect_list);
            MITraceBall missile = new MITraceBall(unit);

            missile.Register();
        }
Ejemplo n.º 14
0
        public override void Cast(Unit unit, IPair destination, Effect[] effect_list)
        {
            base.Cast(unit, destination, effect_list);
            MIGravity missile = new MIGravity(unit, destination);

            missile.Register();
        }
Ejemplo n.º 15
0
    public override TileChunk GetChunk(TileMap tile_map, int pos_x, int pos_y)
    {
        IPair index = new IPair(pos_x, pos_y);

        if (!chunks.ContainsKey(index))
        {
            TileChunk chunk = ScriptableObject.CreateInstance <TileChunk>();

            chunk.index_x = pos_x;
            chunk.index_y = pos_y;
            chunk.pos_x   = pos_x * tile_map.chunk_size_x;
            chunk.pos_y   = pos_y * tile_map.chunk_size_y;
            chunk.size_x  = tile_map.chunk_size_x;
            chunk.size_y  = tile_map.chunk_size_y;

            TileChunkDataLayer data_layer = new TileChunkDataLayer(chunk.size_x, chunk.size_y);

            for (int i = 0; i < chunk.size_x * chunk.size_y; ++i)
            {
                data_layer.ids[i] = (Random.value >= 0.5f ? 1 : 0);
            }

            chunk.data_layers = new List <TileChunkDataLayer>();
            chunk.user_data   = new List <ScriptableObject>();

            chunk.data_layers.Add(data_layer);

            chunks.Add(index, chunk);
        }

        return(chunks[index]);
    }
Ejemplo n.º 16
0
        private IPair <Element> ParseProperty(Token token)
        {
            IPair <Element> pair = ParseUnit(token);

            if (pair == null)
            {
                return(null);
            }
            var startLoc = token.Range.Start;

            while (true)
            {
                var nextToken = pair.Token
                                .MatchFlow((SuffixToken t) => t.Text == "の")
                                .MatchFlow((SymbolToken t) => true);
                if (nextToken == null)
                {
                    break;
                }
                var propToken = (SymbolToken)pair.Token.Next;
                var propName  = propToken.Text;
                var range     = new TextRange(startLoc, propToken.Range.End);
                pair = MakePair(new PropertyAccess(pair.Node, propName, range), nextToken);
            }
            return(pair);
        }
Ejemplo n.º 17
0
 private bool _isValidPair(IPair pair)
 {
     return
         (pair.Name.Equals("BIO-BTC") ||
          pair.Name.Equals("BIO-RUR") ||
          pair.Name.Equals("BIO-ETH"));
 }
Ejemplo n.º 18
0
 public async Task <IOrder> OrderAsync(IPair pair, string Id, System.Threading.CancellationToken cancellationToken)
 {
     throw new InvalidOperationException("Not support at this time");
     //if (!_isValidPair(pair))
     //	throw new InvalidOperationException($"Pair {pair.Name} not supported.");
     //IEnumerable<IOrder> orders = await OrdersAsync(pair, false, cancellationToken);
     //return orders.Where(o => o.Id.Equals(Id)).FirstOrDefault();
 }
Ejemplo n.º 19
0
        public void Delete(IPair <TKey, TValue> x)
        {
            // make newParent as small as possible
            DecreaseKey(x, _minKeyValue);

            // remove the smallest, which decreases n also
            Pop();
        }
Ejemplo n.º 20
0
 public override void StopCast(Unit unit, IPair destination, Effect[] effect_list)
 {
     if (effect_list != null)
     {
         effect_list[0].Unregister();
         effect_list[0] = null;
     }
 }
Ejemplo n.º 21
0
 /// <summary>
 /// 移除Piar
 /// </summary>
 /// <param name="pair">要移除的Pair</param>
 public async Task <bool> RemovePairAsync(IPair pair)
 {
     return(await Task.Run(() => {
         lock (_pairsLocker) {
             return _pairs.Remove(pair);
         }
     }));
 }
 public AlgorithmeHaussierOrdreUnique(IPair pair, decimal montantFiat, decimal pourcentageAchat, decimal pourcentageVente, int id)
 {
     this.pair                   = pair;
     montantFiatOrdre            = montantFiat;
     pourcentageBaisseAvantAchat = pourcentageAchat;
     pourcentageHausseAvantVente = pourcentageVente;
     iDAlgorithmeHaussier        = id;
     sauvegardeDernierOrdre      = "logAlgH_" + iDAlgorithmeHaussier + ".json";
 }
Ejemplo n.º 23
0
        public void Cast(int id, IPair destination)
        {
            param1_.Clone(destination);

            param2_.X = id;
            param2_.Y = 0;

            type_ = 2;
        }
Ejemplo n.º 24
0
 //  constructor
 public Missile(int life_time, Unit caster)
     : base(life_time)
 {
     pos_         = new IPair();
     repulse_     = new IPair();
     caster_      = caster;
     move_vector_ = null;
     effect_list_ = null;
     Explode      = Collision = false;
 }
Ejemplo n.º 25
0
        public void DecreaseKey(IPair <TKey, TValue> node, TKey newKey)
        {
            _heap.Remove(node);

            var item = node as PairNode <TKey, TValue>;

            item.Key = newKey;

            Push(node);
        }
Ejemplo n.º 26
0
        public void DecreaseKey(IPair <TKey, TValue> item, TKey newKey)
        {
            _list.Remove(item);

            var node = item as PairNode <TKey, TValue>;

            node.Key = newKey;

            Push(node);
        }
Ejemplo n.º 27
0
        /// <summary>
        ///    Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <returns>
        ///    <c>true</c> if the current object is equal to the <paramref name = "other" /> parameter; otherwise, <c>false</c>.
        /// </returns>
        /// <param name = "other">An object to compare with this object.
        /// </param>
        public bool Equals(IPair <TFirst, TSecond> other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            return(firstEqualityComparer.Equals(First, other.First) &&
                   secondEqualityComparer.Equals(Second, other.Second));
        }
Ejemplo n.º 28
0
        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region IComparer<IPair<T>> Members
        public int Compare(
            IPair <T> left,
            IPair <T> right
            )
        {
            if ((left == null) && (right == null))
            {
                return(0);
            }
            else if (left == null)
            {
                return(-1);
            }
            else if (right == null)
            {
                return(1);
            }
            else
            {
                IComparer <T> localComparer = (comparer != null) ?
                                              comparer : Comparer <T> .Default;

                switch (comparisonType)
                {
                case PairComparison.LXRX:
                {
                    return(localComparer.Compare(left.X, right.X));
                }

                case PairComparison.LXRY:
                {
                    return(localComparer.Compare(left.X, right.Y));
                }

                case PairComparison.LYRX:
                {
                    return(localComparer.Compare(left.Y, right.X));
                }

                case PairComparison.LYRY:
                {
                    return(localComparer.Compare(left.Y, right.Y));
                }
                }
            }

            if (throwOnError)
            {
                throw new ScriptException();
            }
            else
            {
                return(0);
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// 移除Pair
        /// </summary>
        /// <param name="pair">要移除的Pair</param>
        public async Task <bool> RemovePairAsync(IPair pair)
        {
            Pair p = pair as Pair;

            p.UpdateMethod = UpdateMethod.Delete;
            return(await Task.Run(() => {
                lock (_pairsLocker) {
                    return RemovePairHelper(p);
                }
            }));
        }
Ejemplo n.º 30
0
        public override Effect[] BeginCast(Unit unit, IPair destination)
        {
            IPair delta = destination - unit.Pos;

            delta.ChangeLength(GameDef.UNIT_RADIUS * GameDef.PIXEL_SCALE);

            Effect[] effect_list = new Effect[1];
            effect_list[0] = new EFMakeFireBall(unit, delta);
            effect_list[0].Register();
            return(effect_list);
        }
 public GreatesCommonDenominatorSyntax
     (IPair @operator, ParsedSyntax left, IToken token, ParsedSyntax right)
     : base(@operator, left, token, right) { }
Ejemplo n.º 32
0
 public PowerSyntax(IPair @operator, ParsedSyntax left, IToken token, ParsedSyntax right)
     : base(@operator, left, token, right) {}
Ejemplo n.º 33
0
 protected abstract object GetPairPart(IPair pair);
Ejemplo n.º 34
0
 protected override object GetPairPart(IPair pair)
 {
     return pair.GetRest();
 }